Merge branch 'stabilization/2106' of https://github.com/o3de/o3de into cgalvan/FixLCGraphNotOpeningOnEdit

This commit is contained in:
Chris Galvan
2021-07-06 10:15:32 -05:00
634 changed files with 8648 additions and 14565 deletions
@@ -689,6 +689,81 @@ namespace AZ
return 1;
}
int Class__IndexAllowNil(lua_State* l)
{
LSV_BEGIN(l, 1);
// calling format __index(table,key)
lua_getmetatable(l, -2); // load the userdata metatable
int metaTableIndex = lua_gettop(l);
// Check if the key is string, if so we expect it to be a function or property name
// otherwise we allow users to provide custom index handlers
// Technically we can allow strings too, but it will clash with function/property names and it be hard to figure
// out what is going on from with in the system.
if (lua_type(l, -2) == LUA_TSTRING)
{
lua_pushvalue(l, -2); // duplicate the key
lua_rawget(l, -2); // load the value at this index
}
else
{
lua_pushliteral(l, "__AZ_Index");
lua_rawget(l, -2); // check if the user provided custom Index method in the class metatable
if (lua_isnil(l, -1)) // if not report an error
{
lua_rawgeti(l, -2, AZ_LUA_CLASS_METATABLE_NAME_INDEX); // load the class name for a better error
if (!lua_isstring(l, -1)) // if we failed it means we are the base metatable
{
lua_pop(l, 1);
lua_rawgeti(l, 1, AZ_LUA_CLASS_METATABLE_NAME_INDEX);
}
ScriptContext::FromNativeContext(l)->Error(ScriptContext::ErrorType::Warning, true, "Invalid index type [], should be string! '%s:%s'!", lua_tostring(l, -1), lua_tostring(l, -4));
}
else
{
// if we have custom index handler
lua_pushvalue(l, -4); // duplicate the table (class pointer)
lua_pushvalue(l, -4); // duplicate the index value for the call
lua_call(l, 2, 1); // call the function
}
lua_remove(l, metaTableIndex); // remove the metatable
return 1;
}
if (!lua_isnil(l, -1))
{
if (lua_tocfunction(l, -1) == &Internal::LuaPropertyTagHelper) // if it's a property
{
lua_getupvalue(l, -1, 1); // push on the stack the getter function
lua_remove(l, -2); // remove property object
if (lua_isnil(l, -1))
{
lua_rawgeti(l, -2, AZ_LUA_CLASS_METATABLE_NAME_INDEX); // load the class name for a better error
if (!lua_isstring(l, -1)) // if we failed it means we are the base metatable
{
lua_pop(l, 1);
lua_rawgeti(l, 1, AZ_LUA_CLASS_METATABLE_NAME_INDEX);
}
ScriptContext::FromNativeContext(l)->Error(ScriptContext::ErrorType::Warning, true, "Property '%s:%s' is write only", lua_tostring(l, -1), lua_tostring(l, -4));
lua_pop(l, 1); // pop class name
}
else
{
lua_pushvalue(l, -4); // copy the user data to be passed as a this pointer.
lua_call(l, 1, 1); // call a function with one argument (this pointer) and 1 result
}
}
}
lua_remove(l, metaTableIndex); // remove the metatable
return 1;
}
//=========================================================================
// Class__NewIndex
// [3/22/2012]
@@ -826,30 +901,6 @@ namespace AZ
return 1;
}
//=========================================================================
// ClassMetatable__Index
// [3/24/2012]
//=========================================================================
int ClassMetatable__Index(lua_State* l)
{
// since the Class__Index is generic function (ask for the class metatable)
// we can reuse the code for the base metatable (which is a metatable
// of the class metatable)
return Class__Index(l);
}
//=========================================================================
// ClassMetatable__NewIndex
// [3/30/2012]
//=========================================================================
int ClassMetatable__NewIndex(lua_State* l)
{
// since the Class__NewIndex is generic function (ask for the class metatable)
// we can reuse the code for the base metatable (which is a metatable
// of the class metatable)
return Class__NewIndex(l);
}
inline size_t BufferStringCopy(const char* source, char* destination, size_t destinationSize)
{
size_t srcLen = strlen(source);
@@ -5053,9 +5104,20 @@ LUA_API const Node* lua_getDummyNode()
lua_pushcclosure(m_lua, &DefaultBehaviorCaller::Destroy, 0);
lua_rawset(m_lua, -3);
lua_pushliteral(m_lua, "__index");
lua_pushcclosure(m_lua, &Internal::Class__Index, 0);
lua_rawset(m_lua, -3);
{
lua_pushliteral(m_lua, "__index");
if (FindAttribute(Script::Attributes::UseClassIndexAllowNil, behaviorClass->m_attributes))
{
lua_pushcclosure(m_lua, &Internal::Class__IndexAllowNil, 0);
}
else
{
lua_pushcclosure(m_lua, &Internal::Class__Index, 0);
}
lua_rawset(m_lua, -3);
}
lua_pushliteral(m_lua, "__newindex");
lua_pushcclosure(m_lua, &Internal::Class__NewIndex, 0);
@@ -16,19 +16,20 @@ namespace AZ
{
namespace Attributes
{
const static AZ::Crc32 Ignore = AZ_CRC("ScriptIgnore", 0xeb7615e1); ///< Don't use the element in the script reflection
const static AZ::Crc32 ClassNameOverride = AZ_CRC("ScriptClassNameOverride", 0x891238a3); ///< Provide a custom name for script reflection, that doesn't match the behavior Context name
const static AZ::Crc32 MethodOverride = AZ_CRC("ScriptFunctionOverride", 0xf89a7882); ///< Use a custom function in the attribute instead of the function
const static AZ::Crc32 ConstructorOverride = AZ_CRC("ConstructorOverride", 0xef5ce4aa); ///< You can provide a custom constructor to be called when created from Lua script
const static AZ::Crc32 EventHandlerCreationFunction = AZ_CRC_CE("EventHandlerCreationFunction"); ///< helps create a handler for any script target so that script functions can be used for AZ::Event signals
const static AZ::Crc32 GenericConstructorOverride = AZ_CRC("GenericConstructorOverride", 0xe6a1698e); ///< You can provide a custom constructor to be called when creating a script
const static AZ::Crc32 ReaderWriterOverride = AZ_CRC("ReaderWriterOverride", 0x1ad9ce2a); ///< paired with \ref ScriptContext::CustomReaderWriter allows you to customize read/write to Lua VM
const static AZ::Crc32 ConstructibleFromNil = AZ_CRC("ConstructibleFromNil", 0x23908169); ///< Applied to classes. Value (bool) specifies if the class be default constructed when nil is provided.
const static AZ::Crc32 ToolTip = AZ_CRC("ToolTip", 0xa1b95fb0); ///< Add a tooltip for a method/event/property
const static AZ::Crc32 Category = AZ_CRC("Category", 0x064c19c1); ///< Provide a category to allow for partitioning/sorting/ordering of the element
const static AZ::Crc32 Deprecated = AZ_CRC("Deprecated", 0xfe49a138); ///< Marks a reflected class, method, EBus or property as deprecated.
const static AZ::Crc32 DisallowBroadcast = AZ_CRC("DisallowBroadcast", 0x389b0ac7); ///< Marks a reflected EBus as not allowing Broadcasts, only Events.
const static AZ::Crc32 ClassConstantValue = AZ_CRC_CE("ClassConstantValue"); ///< Indicates the property is backed by a constant value
static constexpr AZ::Crc32 Ignore = AZ_CRC_CE("ScriptIgnore"); ///< Don't use the element in the script reflection
static constexpr AZ::Crc32 ClassNameOverride = AZ_CRC_CE("ScriptClassNameOverride"); ///< Provide a custom name for script reflection, that doesn't match the behavior Context name
static constexpr AZ::Crc32 MethodOverride = AZ_CRC_CE("ScriptFunctionOverride"); ///< Use a custom function in the attribute instead of the function
static constexpr AZ::Crc32 ConstructorOverride = AZ_CRC_CE("ConstructorOverride"); ///< You can provide a custom constructor to be called when created from Lua script
static constexpr AZ::Crc32 EventHandlerCreationFunction = AZ_CRC_CE("EventHandlerCreationFunction"); ///< helps create a handler for any script target so that script functions can be used for AZ::Event signals
static constexpr AZ::Crc32 GenericConstructorOverride = AZ_CRC_CE("GenericConstructorOverride"); ///< You can provide a custom constructor to be called when creating a script
static constexpr AZ::Crc32 ReaderWriterOverride = AZ_CRC_CE("ReaderWriterOverride"); ///< paired with \ref ScriptContext::CustomReaderWriter allows you to customize read/write to Lua VM
static constexpr AZ::Crc32 ConstructibleFromNil = AZ_CRC_CE("ConstructibleFromNil"); ///< Applied to classes. Value (bool) specifies if the class be default constructed when nil is provided.
static constexpr AZ::Crc32 ToolTip = AZ_CRC_CE("ToolTip"); ///< Add a tooltip for a method/event/property
static constexpr AZ::Crc32 Category = AZ_CRC_CE("Category"); ///< Provide a category to allow for partitioning/sorting/ordering of the element
static constexpr AZ::Crc32 Deprecated = AZ_CRC_CE("Deprecated"); ///< Marks a reflected class, method, EBus or property as deprecated.
static constexpr AZ::Crc32 DisallowBroadcast = AZ_CRC_CE("DisallowBroadcast"); ///< Marks a reflected EBus as not allowing Broadcasts, only Events.
static constexpr AZ::Crc32 ClassConstantValue = AZ_CRC_CE("ClassConstantValue"); ///< Indicates the property is backed by a constant value
static constexpr AZ::Crc32 UseClassIndexAllowNil = AZ_CRC_CE("UseClassIndexAllowNil"); ///< Use the Class__IndexAllowNil method, which will not report an error on accessing undeclared values (allows for nil)
//! Attribute which stores BehaviorAzEventDescription structure which contains
//! the script name of an AZ::Event and the name of it's parameter arguments
@@ -39,11 +40,11 @@ namespace AZ
static constexpr AZ::Crc32 EventParameterTypes = AZ_CRC_CE("EventParameterTypes");
///< Recommends that the Lua runtime look up the member function in the meta table of the first argument, rather than in the original table
const static AZ::Crc32 TreatAsMemberFunction = AZ_CRC("TreatAsMemberFunction", 0x64be831a);
static constexpr AZ::Crc32 TreatAsMemberFunction = AZ_CRC_CE("TreatAsMemberFunction");
///< This attribute can be attached to the EditContext Attribute of a reflected class, the BehaviorContext Attribute of a reflected class, method, ebus or property.
///< ExcludeFlags can be used to prevent elements from appearing in List, Documentation, etc...
const static AZ::Crc32 ExcludeFrom = AZ_CRC("ExcludeFrom", 0xa98972fe);
static constexpr AZ::Crc32 ExcludeFrom = AZ_CRC_CE("ExcludeFrom");
enum ExcludeFlags : AZ::u64
{
List = 1 << 0, //< The reflected item will be excluded from any list (e.g. node palette)
@@ -54,7 +55,7 @@ namespace AZ
};
//! Used to specify the usage of a Behavior Context element (e.g. Class or EBus) designed for automation scripts
const static AZ::Crc32 Scope = AZ_CRC("Scope", 0x00af55d3);
static constexpr AZ::Crc32 Scope = AZ_CRC_CE("Scope");
enum class ScopeFlags : AZ::u64
{
Launcher = 1 << 0, //< a type meant for game run-time Launcher client (default value)
@@ -63,15 +64,15 @@ namespace AZ
};
//! Provide a partition hierarchy in a string dotted notation to namespace a script element
const static AZ::Crc32 Module = AZ_CRC("Module", 0x0c242628);
static constexpr AZ::Crc32 Module = AZ_CRC_CE("Module");
//! Provide an alternate name for script elements such as helpful PEP8 Python methods and property aliases
const static AZ::Crc32 Alias = AZ_CRC("Alias", 0xe16c6b94);
static constexpr AZ::Crc32 Alias = AZ_CRC_CE("Alias");
const static AZ::Crc32 EnableAsScriptEventParamType = AZ_CRC("ScriptEventParam", 0xa41e4cb0);
const static AZ::Crc32 EnableAsScriptEventReturnType = AZ_CRC("ScriptEventReturn", 0xf89b5337);
static constexpr AZ::Crc32 EnableAsScriptEventParamType = AZ_CRC_CE("ScriptEventParam");
static constexpr AZ::Crc32 EnableAsScriptEventReturnType = AZ_CRC_CE("ScriptEventReturn");
const static AZ::Crc32 Storage = AZ_CRC("ScriptStorage", 0xcd95b44d);
static constexpr AZ::Crc32 Storage = AZ_CRC_CE("ScriptStorage");
enum class StorageType
{
ScriptOwn, // default, Host allocated memory, Lua will destruct object, Lua will free host-memory via host-supplied function
@@ -79,7 +80,7 @@ namespace AZ
Value, // Object is Lua allocated memory, Lua will destruct object, Lua will free Lua-memory
};
const static AZ::Crc32 Operator = AZ_CRC("ScriptOperator", 0xfee681b6);
static constexpr AZ::Crc32 Operator = AZ_CRC_CE("ScriptOperator");
enum class OperatorType
{
// note storage policy can be T*,T (only if we store raw pointers), shared_ptr<T>, intrusive pointer<T>
@@ -100,7 +101,7 @@ namespace AZ
IndexWrite, // given a key/index and a value, you can store it in the class
};
const static AZ::Crc32 AssetType = AZ_CRC("AssetType", 0xabbf8d5f); ///< Provide an asset type for a generic AssetId method
static constexpr AZ::Crc32 AssetType = AZ_CRC_CE("AssetType"); ///< Provide an asset type for a generic AssetId method
} // Attributes
} // Script
@@ -24,7 +24,6 @@ namespace AZ
//=========================================================================
AZStd::string ExtractUserMessage(const ScriptDataContext& dc)
{
AZStd::string userMessage = "Condition failed";
const int argCount = dc.GetNumArguments();
if (argCount > 0 && dc.IsString(argCount - 1))
{
@@ -33,12 +32,12 @@ namespace AZ
{
if (value)
{
userMessage = value;
return value;
}
}
}
return userMessage;
return "ExtractUserMessage from print/Debug.Log/Warn/Error/Assert failed. Consider wrapping your argument in tostring().";
}
//=========================================================================
@@ -90,6 +90,15 @@ namespace AzFramework
*/
virtual void DestroyGameEntity(const AZ::EntityId& /*id*/) = 0;
/**
* Destroys an entity only in slice mode (when prefabs are disabled). This request is only added as a stop-gap solution
* to prevent the editor from crashing when prefabs are enabled and must only be called through the BehaviorContext binding
* for 'DestroyGameEntity'. No code should be written to directly call this method. This will be removed soon.
*
* @param id The ID of the entity to destroy.
*/
virtual void DestroyGameEntityOnlyInSliceMode(const AZ::EntityId& /*id*/) = 0;
/**
* Destroys an entity and all of its descendants.
* The entity and its descendants are immediately deactivated and will be
@@ -98,6 +107,15 @@ namespace AzFramework
*/
virtual void DestroyGameEntityAndDescendants(const AZ::EntityId& /*id*/) = 0;
/**
* Destroys an entity and its descendants only in slice mode (when prefabs are disabled). This request is only added as a stop-gap
* solution to prevent the editor from crashing when prefabs are enabled and must only be called through the BehaviorContext
* binding for 'DestroyGameEntityAndDescendants'.No code should be written to directly call this method. This will be removed soon.
*
* @param id The ID of the entity to destroy.
*/
virtual void DestroyGameEntityAndDescendantsOnlyInSliceMode(const AZ::EntityId& /*id*/) = 0;
/**
* Activates the game entity.
* @param id The ID of the entity to activate.
@@ -46,8 +46,9 @@ namespace AzFramework
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Event("CreateGameEntity", &GameEntityContextRequestBus::Events::CreateGameEntityForBehaviorContext)
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
->Event("DestroyGameEntity", &GameEntityContextRequestBus::Events::DestroyGameEntity)
->Event("DestroyGameEntityAndDescendants", &GameEntityContextRequestBus::Events::DestroyGameEntityAndDescendants)
->Event("DestroyGameEntity", &GameEntityContextRequestBus::Events::DestroyGameEntityOnlyInSliceMode)
->Event(
"DestroyGameEntityAndDescendants", &GameEntityContextRequestBus::Events::DestroyGameEntityAndDescendantsOnlyInSliceMode)
->Event("ActivateGameEntity", &GameEntityContextRequestBus::Events::ActivateGameEntity)
->Event("DeactivateGameEntity", &GameEntityContextRequestBus::Events::DeactivateGameEntity)
->Attribute(AZ::ScriptCanvasAttributes::DeactivatesInputEntity, true)
@@ -247,6 +248,23 @@ namespace AzFramework
DestroyGameEntityInternal(id, false);
}
void GameEntityContextComponent::DestroyGameEntityOnlyInSliceMode(const AZ::EntityId& id)
{
bool isPrefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(
isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
if (!isPrefabSystemEnabled)
{
DestroyGameEntityInternal(id, false);
}
else
{
AZ_Error(
"GameEntityContextComponent", false,
"Destroying a game entity is temporarily disabled until the Spawnable system can support this.");
}
}
//=========================================================================
// GameEntityContextComponent::DestroyGameEntityAndDescendantsById
//=========================================================================
@@ -255,6 +273,24 @@ namespace AzFramework
DestroyGameEntityInternal(id, true);
}
void GameEntityContextComponent::DestroyGameEntityAndDescendantsOnlyInSliceMode(const AZ::EntityId& id)
{
bool isPrefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(
isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
if (!isPrefabSystemEnabled)
{
DestroyGameEntityInternal(id, true);
}
else
{
AZ_Error(
"GameEntityContextComponent", false,
"Destroying a game entity and its descendants is temporarily disabled until the Spawnable system can support this.");
}
}
//=========================================================================
// GameEntityContextComponent::DestroyGameEntityInternal
//=========================================================================
@@ -89,6 +89,12 @@ namespace AzFramework
}
private:
//////////////////////////////////////////////////////////////////////////
// GameEntityContextRequestBus
void DestroyGameEntityOnlyInSliceMode(const AZ::EntityId&) override;
void DestroyGameEntityAndDescendantsOnlyInSliceMode(const AZ::EntityId&) override;
/////////////////////////////////////////////////////////////////////////
AzFramework::EntityVisibilityBoundsUnionSystem m_entityVisibilityBoundsUnionSystem;
};
} // namespace AzFramework
@@ -188,7 +188,7 @@ namespace AzPhysics
AZ::Transform m_start = AZ::Transform::CreateIdentity(); //!< World space start position. Assumes only rotation + translation (no scaling).
AZ::Vector3 m_direction = AZ::Vector3::CreateZero(); //!< World space direction (Should be normalized)
AZStd::shared_ptr<Physics::ShapeConfiguration> m_shapeConfiguration; //!< Shape information.
SceneQuery::HitFlags m_hitFlags = SceneQuery::HitFlags::Default; //!< Query behavior flags
SceneQuery::HitFlags m_hitFlags = SceneQuery::HitFlags::Default | SceneQuery::HitFlags::MTD; //!< Query behavior flags. MTD Is On by default to correctly report objects that are initially in contact with the start pose.
SceneQuery::FilterCallback m_filterCallback = nullptr; //!< Hit filtering function
bool m_reportMultipleHits = false; //!< flag to have the cast stop after the first hit or return all hits along the query.
};
@@ -135,7 +135,6 @@ namespace AzQtComponents
SearchTypeSelector::SearchTypeSelector(QWidget* parent /* = nullptr */)
: QMenu(parent)
, m_unfilteredData(nullptr)
{
Q_ASSERT(parent != nullptr);
@@ -196,7 +195,17 @@ namespace AzQtComponents
itemLayout->addWidget(m_tree);
m_model = new QStandardItemModel(this);
m_tree->setModel(m_model);
m_filterModel = new SearchTypeSelectorFilterModel(this);
m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
m_filterModel->setRecursiveFilteringEnabled(true);
m_filterModel->setSourceModel(m_model);
// make sure all entries enter the view expanded
connect(m_filterModel, &QAbstractItemModel::rowsInserted, this, [this]()
{
m_tree->expandAll();
});
m_tree->setModel(m_filterModel);
m_tree->setHeaderHidden(true);
connect(m_model, &QStandardItemModel::itemChanged, this, [this](QStandardItem* item)
@@ -205,11 +214,6 @@ namespace AzQtComponents
if (!m_settingUp)
{
int index = item->data().toInt();
if (index < m_filteredItemIndices.size())
{
index = m_filteredItemIndices[item->data().toInt()];
}
bool enabled = item->checkState() == Qt::Checked;
emit TypeToggled(index, enabled);
}
@@ -228,169 +232,116 @@ namespace AzQtComponents
QMenu::showEvent(e);
}
void SearchTypeSelector::resetData()
{
m_estimatedTableHeight = 0;
m_estimatedTableWidth = 0;
m_filteredItemIndices.clear();
m_model->clear();
}
void SearchTypeSelector::initItem(QStandardItem* item, const SearchTypeFilter& filter, int unfilteredDataIndex)
{
Q_UNUSED(filter);
Q_UNUSED(unfilteredDataIndex);
item->setData(unfilteredDataIndex);
item->setEditable(false);
item->setCheckable(true);
item->setCheckState(filter.enabled ? Qt::Checked : Qt::Unchecked);
}
bool SearchTypeSelector::filterItemOut(int unfilteredDataIndex, bool itemMatchesFilter, bool categoryMatchesFilter)
int SearchTypeSelector::getUnfilteredDataIndex(QStandardItem* item)
{
Q_UNUSED(unfilteredDataIndex);
return !itemMatchesFilter && !categoryMatchesFilter;
const QVariant itemData = item->data();
if (itemData.isValid())
{
return item->data().toInt();
}
return -1;
}
void SearchTypeSelector::RepopulateDataModel()
void SearchTypeSelector::RepopulateDataModel(const SearchTypeFilterList& unfilteredData)
{
resetData();
if (!m_unfilteredData)
{
return;
}
bool amFiltering = !m_filterString.isEmpty();
m_estimatedTableHeight = 0;
m_estimatedTableWidth = 0;
m_model->clear();
m_filterModel->setNoResultsMessageRow(-1); // reset the index for the "no results" message
QScopedValueRollback<bool> setupGuard(m_settingUp, true);
QMap<QString, QStandardItem*> categories;
QStandardItem* firstCategory = nullptr;
QStandardItem* firstItem = nullptr;
int numCategories = 0;
int numItems = 0;
int numItemsAdded = 0;
QVector<QString> categoriesInOrder; // categories in originally specified order
QMap<QString, QList<QStandardItem*>> categoryToEntryItems; // category name to sub-items that will be added
for (int unfilteredDataIndex = 0, length = m_unfilteredData->length(); unfilteredDataIndex < length; ++unfilteredDataIndex)
const int numItems = unfilteredData.length();
for (int unfilteredDataIndex = 0; unfilteredDataIndex < numItems; ++unfilteredDataIndex)
{
const SearchTypeFilter& filter = m_unfilteredData->at(unfilteredDataIndex);
bool addItem = true;
bool itemMatchesFilter = true;
bool categoryMatchesFilter = true;
if (amFiltering)
{
itemMatchesFilter = filter.displayName.contains(m_filterString, Qt::CaseSensitivity::CaseInsensitive);
categoryMatchesFilter = filter.category.contains(m_filterString, Qt::CaseSensitivity::CaseInsensitive);
}
if (filterItemOut(unfilteredDataIndex, itemMatchesFilter, categoryMatchesFilter))
{
addItem = false;
}
QStandardItem* categoryItem = nullptr;
if (categories.contains(filter.category))
{
categoryItem = categories[filter.category];
}
else
{
if (categoryMatchesFilter || addItem)
{
categoryItem = new QStandardItem(filter.category);
categories[filter.category] = categoryItem;
m_model->appendRow(categoryItem);
categoryItem->setEditable(false);
numCategories++;
if (!firstCategory)
{
firstCategory = firstCategory ? firstCategory : categoryItem;
}
}
}
// count the item even if we filter it out, so that the estimated height includes what it could be if the filter changes
numItems++;
if (!addItem)
{
continue;
}
numItemsAdded++;
m_filteredItemIndices.append(unfilteredDataIndex);
const SearchTypeFilter& filter = unfilteredData.at(unfilteredDataIndex);
// create each item, but don't add them yet, as we don't know if we will be adding to the category items,
// or to the model directly
QStandardItem* item = new QStandardItem(filter.displayName);
item->setData(unfilteredDataIndex);
item->setEditable(false);
initItem(item, filter, unfilteredDataIndex);
if (categoryItem)
categoryToEntryItems[filter.category].push_back(item);
if (categoriesInOrder.indexOf(filter.category) == -1)
{
categoryItem->appendRow(item);
}
else
{
m_model->appendRow(item);
// need to add these category items as they are first encountered so
// that the original category ordering is maintained
categoriesInOrder.push_back(filter.category);
}
int textWidth = fontMetrics().horizontalAdvance(filter.displayName);
if (textWidth > m_estimatedTableWidth)
{
m_estimatedTableWidth = textWidth;
m_estimatedTableWidth = textWidth;
}
}
const int numCategories = categoriesInOrder.size();
if (!firstItem)
// If there is only one category and its name is empty, discard it,
// and add its children directly to the model as one big column of N rows
if (numCategories == 1 && categoriesInOrder[0].isEmpty())
{
auto& entryItems = categoryToEntryItems.begin().value();
m_model->appendColumn(entryItems);
}
else
{
for (int categoryIndex = 0; categoryIndex < numCategories; ++categoryIndex)
{
firstItem = item;
const QString& currCategory = categoriesInOrder[categoryIndex];
QStandardItem* categoryItem = new QStandardItem(currCategory);
auto& entryItems = categoryToEntryItems[currCategory];
categoryItem->appendColumn(entryItems);
m_model->appendRow(categoryItem); // add the parent last, so the model just gets one row add per category
}
}
if (numItemsAdded == GetNumFixedItems())
{
QStandardItem* item = new QStandardItem(QObject::tr("<i>No result found.</i>"));
m_model->appendRow(item);
item->setEditable(false);
++numItems;
}
// add a special row that indicates that no categories (other than the fixed ones) match the filter
// this row itself will be filtered out when there are other matching categories
m_filterModel->setNoResultsMessageRow(m_model->rowCount());
QStandardItem* noResultsMessage = new QStandardItem(QObject::tr("<i>No result found.</i>"));
noResultsMessage->setEditable(false);
m_model->appendRow(new QStandardItem(QObject::tr("<i>No result found.</i>")));
// If there is only one category and its name is empty, let put everything at root.
if (categories.count() == 1 && categories.begin().key().isEmpty())
{
m_tree->setRootIndex(categories.begin().value()->index());
numCategories = 0;
}
estimateTableHeight(firstCategory, numCategories, firstItem, numItems);
estimateTableHeight(numCategories, numItems);
}
void SearchTypeSelector::estimateTableHeight(QStandardItem* firstCategory, int numCategories, QStandardItem* firstItem, int numItems)
void SearchTypeSelector::estimateTableHeight(int numCategories, int numItems)
{
m_tree->expandAll();
int totalCategoryHeight = 0;
int totalItemHeight = 0;
if (firstItem)
auto* theModel = m_tree->model();
QModelIndex firstIndex(theModel->index(0, 0));
QModelIndex firstChild(theModel->index(0, 0, firstIndex));
if (firstIndex.isValid())
{
QModelIndex index = m_model->indexFromItem(firstItem);
int itemHeight = m_tree->fetchRowHeight(index);
int itemHeight = m_tree->fetchRowHeight(firstIndex);
totalItemHeight += (itemHeight * numItems);
}
if (firstCategory)
if (firstChild.isValid())
{
QModelIndex index = m_model->indexFromItem(firstCategory);
int categoryHeight = m_tree->fetchRowHeight(index);
int categoryHeight = m_tree->fetchRowHeight(firstChild);
totalCategoryHeight += (categoryHeight * numCategories);
}
@@ -504,10 +455,7 @@ namespace AzQtComponents
void SearchTypeSelector::Setup(const SearchTypeFilterList& searchTypes)
{
m_unfilteredData = &searchTypes;
RepopulateDataModel();
RepopulateDataModel(searchTypes);
setFixedWidth(m_estimatedTableWidth + FilterWindowWidthPadding);
}
@@ -578,8 +526,75 @@ namespace AzQtComponents
void SearchTypeSelector::FilterTextChanged(const QString& newFilter)
{
m_filterString = newFilter;
m_filterModel->setFilterWildcard(m_filterString);
}
RepopulateDataModel();
SearchTypeSelectorFilterModel::SearchTypeSelectorFilterModel(SearchTypeSelector* searchTypeSelector)
: QSortFilterProxyModel(searchTypeSelector), m_searchTypeSelector(searchTypeSelector)
{
// use queued connections so that the normal sort/filter operations get a chance to finish the index remapping before we act
connect(this, &QAbstractItemModel::rowsInserted, this, &SearchTypeSelectorFilterModel::onRowCountChanged, Qt::QueuedConnection);
connect(this, &QAbstractItemModel::rowsRemoved, this, &SearchTypeSelectorFilterModel::onRowCountChanged, Qt::QueuedConnection);
}
void SearchTypeSelectorFilterModel::setNoResultsMessageRow(int row)
{
m_noResultsRow = row;
invalidateFilter();
}
void SearchTypeSelectorFilterModel::onRowCountChanged()
{
// see if we need to hide or show the "no results" message item
const int numLeafNodes = getNumLeafNodes();
// check if we're down to the (never filtered) fixed items, and should show the "no results" message,
// or if we were already showing that message, check if we have more than the fixed items plus the message itself
const bool hasResultsChanged = (m_showingNoResultsMessage ? numLeafNodes > m_searchTypeSelector->GetNumFixedItems() + 1
: numLeafNodes <= m_searchTypeSelector->GetNumFixedItems());
if (hasResultsChanged)
{
m_showingNoResultsMessage = !m_showingNoResultsMessage;
QModelIndex noResultsMessageIndex = sourceModel()->index(m_noResultsRow, 0);
// The no results row is in the source model, so trigger dataChanged to allow us to re-filter it
emit sourceModel()->dataChanged(noResultsMessageIndex, noResultsMessageIndex);
}
}
bool SearchTypeSelectorFilterModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
{
// if we're considering the "no results" item, accept it only if we're m_showingNoResultsMessage
if (!source_parent.isValid() && source_row == m_noResultsRow)
{
return m_showingNoResultsMessage;
}
const bool filteredByBase = ! QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
// allow searchTypeSelector to make the final decision whether to filter out this item
return !(m_searchTypeSelector->filterItemOut(m_searchTypeSelector->m_model->index(source_row, 0, source_parent), filteredByBase));
}
int SearchTypeSelectorFilterModel::getNumLeafNodes(const QModelIndex& theIndex)
{
// count the number of leaf nodes descending from this index, not including itself
int numLeafNodes = 0;
for (int childRow = 0, numChildRows = rowCount(theIndex); childRow < numChildRows; ++childRow)
{
QModelIndex childIndex = index(childRow, 0, theIndex);
if (rowCount(childIndex) == 0)
{
++numLeafNodes;
}
else
{
numLeafNodes += getNumLeafNodes(childIndex);
}
}
return numLeafNodes;
}
FilteredSearchWidget::Config FilteredSearchWidget::loadConfig(QSettings& settings)
@@ -929,7 +944,7 @@ namespace AzQtComponents
{
{
QSignalBlocker blocker(this);
ConfigHelpers::GroupGuard(&settings, widgetName);
ConfigHelpers::GroupGuard guard(&settings, widgetName);
const auto textFilter = settings.value(g_textFilterKey);
if (textFilter.isValid())
{
@@ -953,7 +968,7 @@ namespace AzQtComponents
void FilteredSearchWidget::writeSettings(QSettings& settings, const QString& widgetName)
{
ConfigHelpers::GroupGuard(&settings, widgetName);
ConfigHelpers::GroupGuard guard(&settings, widgetName);
settings.setValue(g_textFilterKey, textFilter());
const int size = m_typeFilters.size();
@@ -17,6 +17,8 @@
#include <QVariant>
#include <QMenu>
#include <QTimer>
#include <QSortFilterProxyModel>
#include <QStandardItem>
#include <AzCore/std/chrono/chrono.h>
#endif
@@ -28,9 +30,7 @@ namespace Ui
class FlowLayout;
class QTreeView;
class QSortFilterProxyModel;
class QStandardItemModel;
class QStandardItem;
class QSettings;
class QLineEdit;
class QToolButton;
@@ -43,6 +43,7 @@ namespace AzQtComponents
{
class Style;
class FilteredSearchItemDelegate;
class SearchTypeSelectorFilterModel;
class AZ_QT_COMPONENTS_API FilterCriteriaButton
: public QFrame
@@ -160,28 +161,27 @@ namespace AzQtComponents
void FilterTextChanged(const QString& newFilter);
protected:
void estimateTableHeight(QStandardItem* firstCategory, int numCategories, QStandardItem* firstItem, int numItems);
void resetData();
void estimateTableHeight(int numCategories, int numItems);
// can be used to override the logic when adding items in RepopulateDataModel
virtual bool filterItemOut(int index, bool itemMatchesFilter, bool categoryMatchesFilter);
// allows child classes to override the logic of accepting filter categories
virtual bool filterItemOut(const QModelIndex& sourceIndex, bool filteredByBase) { Q_UNUSED(sourceIndex); return filteredByBase; }
virtual void initItem(QStandardItem* item, const SearchTypeFilter& filter, int unfilteredDataIndex);
int getUnfilteredDataIndex(QStandardItem* item); // get the original filter index from the item itself
// Returns the number of items that always appear in the list, regardless of the filtering.
virtual int GetNumFixedItems() { return 0; }
void showEvent(QShowEvent* e) override;
virtual void RepopulateDataModel();
void RepopulateDataModel(const SearchTypeFilterList& unfilteredData);
void maximizeGeometryToFitScreen();
SearchTypeSelectorTreeView* m_tree;
QStandardItemModel* m_model;
const SearchTypeFilterList* m_unfilteredData;
AZ_PUSH_DISABLE_WARNING(4127 4251, "-Wunknown-warning-option") // conditional expression is constant, needs to have dll-interface to be used by clients of class 'AzQtComponents::SearchTypeSelector'
QVector<int> m_filteredItemIndices;
AZ_POP_DISABLE_WARNING
QString m_filterString;
friend class SearchTypeSelectorFilterModel;
SearchTypeSelectorFilterModel* m_filterModel;
QString m_filterString;
bool m_settingUp = false;
int m_fixedWidth = 256;
QLineEdit* m_searchField = nullptr;
@@ -193,6 +193,26 @@ namespace AzQtComponents
bool m_lineEditSearchVisible = true;
};
class SearchTypeSelectorFilterModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
SearchTypeSelectorFilterModel(SearchTypeSelector* searchTypeSelector);
void setNoResultsMessageRow(int row); // row of specialized "no results" message in the source model
protected slots:
void onRowCountChanged();
protected:
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;
int getNumLeafNodes(const QModelIndex& theIndex = QModelIndex()); // gets the number of leaf node descendants of current index. Current index is *not* considered
SearchTypeSelector* m_searchTypeSelector = nullptr;
int m_noResultsRow = -1; // row of specialized "no results" message in the source model
bool m_showingNoResultsMessage = false;
};
class AZ_QT_COMPONENTS_API FilteredSearchWidget
: public QFrame
{
@@ -109,13 +109,13 @@ namespace AzQtComponents
void ReadColorGridConfig(QSettings& settings, const QString& name, ColorPicker::ColorGridConfig& colorGrid)
{
ConfigHelpers::GroupGuard(&settings, name);
ConfigHelpers::GroupGuard guard(&settings, name);
ConfigHelpers::read<QSize>(settings, QStringLiteral("MinimumSize"), colorGrid.minimumSize);
}
void ReadDialoButtonsConfig(QSettings& settings, const QString& name, ColorPicker::DialogButtonsConfig& dialogButtons)
{
ConfigHelpers::GroupGuard(&settings, name);
ConfigHelpers::GroupGuard guard(&settings, name);
ConfigHelpers::read<int>(settings, QStringLiteral("TopPadding"), dialogButtons.topPadding);
}
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 60.1 (88133) - https://sketch.com -->
<title>Outliner / vis &amp; lock / lock / Default</title>
<desc>Created with Sketch.</desc>
<g id="Outliner-/-vis-&amp;-lock-/-lock-/-Default" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.35">
<circle id="Oval-3" fill="#FFFFFF" cx="8" cy="8" r="2.5"></circle>
</g>
</svg>

After

Width:  |  Height:  |  Size: 579 B

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 60.1 (88133) - https://sketch.com -->
<title>Outliner / vis &amp; lock / lock / Default - hover</title>
<desc>Created with Sketch.</desc>
<g id="Outliner-/-vis-&amp;-lock-/-lock-/-Default---hover" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M7.62646385,1.48235749 C9.42626113,1.48235749 10.8852851,2.94138146 10.8852851,4.74117875 L10.8843498,7.34735749 L12.8405779,7.34823575 L12.8405779,14.5176425 L2.41234985,14.5176425 L2.41234985,7.34823575 L9.58134985,7.34735749 L9.5817566,4.74117875 C9.5817566,3.66130038 8.70634222,2.78588599 7.62646385,2.78588599 C7.21874475,2.78588599 6.62971236,2.90054702 6.14480925,3.34844343 C6.01584142,3.46756874 5.88452781,3.71832946 5.75086844,4.10072562 L4.38428828,4.10072562 C4.43323512,3.87757947 4.47506118,3.7202004 4.50976646,3.62858842 C4.59003595,3.41669999 4.80061604,3.0404071 4.86756375,2.94801197 C5.78155489,1.68660458 6.73091609,1.48235749 7.62646385,1.48235749 Z M11.5370494,8.65176425 L3.71587835,8.65176425 L3.71587835,13.214114 L11.5370494,13.214114 L11.5370494,8.65176425 Z M8.2782281,9.95529275 L8.2782281,11.9105855 L6.9746996,11.9105855 L6.9746996,9.95529275 L8.2782281,9.95529275 Z" id="Combined-Shape-Copy-4" fill="#94D2FF"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 60.1 (88133) - https://sketch.com -->
<title>Outliner / vis &amp; lock / lock / Default</title>
<desc>Created with Sketch.</desc>
<g id="Outliner-/-vis-&amp;-lock-/-lock-/-Default" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.1">
<circle id="Oval-3" fill="#FFFFFF" cx="8" cy="8" r="2.5"></circle>
</g>
</svg>

After

Width:  |  Height:  |  Size: 578 B

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 60.1 (88133) - https://sketch.com -->
<title>Outliner / vis &amp; lock / lock / on</title>
<desc>Created with Sketch.</desc>
<g id="Outliner-/-vis-&amp;-lock-/-lock-/-on" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M8,1.53182564 C9.78613703,1.53182564 11.2340872,2.97977579 11.2340872,4.76591282 L11.2340872,7.35318256 L13.1745395,7.35318256 L13.1745395,14.4681744 L2.82546052,14.4681744 L2.82546052,7.35318256 L4.76591282,7.35318256 L4.76591282,4.76591282 C4.76591282,2.97977579 6.21386297,1.53182564 8,1.53182564 Z M8.64681744,9.94045231 L7.35318256,9.94045231 L7.35318256,11.8809046 L8.64681744,11.8809046 L8.64681744,9.94045231 Z M8,2.82546052 C6.92831778,2.82546052 6.05954769,3.69423061 6.05954769,4.76591282 L6.05954769,4.76591282 L6.05954769,7.35318256 L9.94045231,7.35318256 L9.94045231,4.76591282 C9.94045231,3.69423061 9.07168222,2.82546052 8,2.82546052 Z" id="Combined-Shape-Copy" fill="#E9E9E9"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 60.1 (88133) - https://sketch.com -->
<title>Outliner / vis &amp; lock /lock / on - hover</title>
<desc>Created with Sketch.</desc>
<g id="Outliner-/-vis-&amp;-lock-/lock-/-on---hover" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M8,1.53182564 C9.78613703,1.53182564 11.2340872,2.97977579 11.2340872,4.76591282 L11.2340872,7.35318256 L13.1745395,7.35318256 L13.1745395,14.4681744 L2.82546052,14.4681744 L2.82546052,7.35318256 L4.76591282,7.35318256 L4.76591282,4.76591282 C4.76591282,2.97977579 6.21386297,1.53182564 8,1.53182564 Z M8.64681744,9.94045231 L7.35318256,9.94045231 L7.35318256,11.8809046 L8.64681744,11.8809046 L8.64681744,9.94045231 Z M8,2.82546052 C6.92831778,2.82546052 6.05954769,3.69423061 6.05954769,4.76591282 L6.05954769,4.76591282 L6.05954769,7.35318256 L9.94045231,7.35318256 L9.94045231,4.76591282 C9.94045231,3.69423061 9.07168222,2.82546052 8,2.82546052 Z" id="Combined-Shape" fill="#94D2FF"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 60.1 (88133) - https://sketch.com -->
<title>Outliner / vis &amp; lock / lock / on</title>
<desc>Created with Sketch.</desc>
<g id="Outliner-/-vis-&amp;-lock-/-lock-/-on" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.2">
<path d="M8,1.53182564 C9.78613703,1.53182564 11.2340872,2.97977579 11.2340872,4.76591282 L11.2340872,7.35318256 L13.1745395,7.35318256 L13.1745395,14.4681744 L2.82546052,14.4681744 L2.82546052,7.35318256 L4.76591282,7.35318256 L4.76591282,4.76591282 C4.76591282,2.97977579 6.21386297,1.53182564 8,1.53182564 Z M8.64681744,9.94045231 L7.35318256,9.94045231 L7.35318256,11.8809046 L8.64681744,11.8809046 L8.64681744,9.94045231 Z M8,2.82546052 C6.92831778,2.82546052 6.05954769,3.69423061 6.05954769,4.76591282 L6.05954769,4.76591282 L6.05954769,7.35318256 L9.94045231,7.35318256 L9.94045231,4.76591282 C9.94045231,3.69423061 9.07168222,2.82546052 8,2.82546052 Z" id="Combined-Shape-Copy" fill="#E9E9E9"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="12px" height="10px" viewBox="0 0 12 10" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 61 (89581) - https://sketch.com -->
<title>a to z sort</title>
<desc>Created with Sketch.</desc>
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Menu-/-Outliner-/-menu" transform="translate(-186.000000, -32.000000)" fill="#FFFFFF">
<g id="Group-14">
<g id="icon-/-outliner-/-menu-/-sort-A-to-Z" transform="translate(184.000000, 29.000000)">
<g id="Group" transform="translate(2.000000, 3.000000)">
<path d="M6.48182562,2.90763871 C6.48182562,3.11168285 6.48182562,4.18637111 6.48182562,4.32322247 C6.48182562,4.46007383 6.3017789,4.6288924 6.11455497,4.43691302 C5.98973902,4.30892676 5.44321422,3.77841492 4.47498059,2.84537751 C4.47498059,7.17586292 4.47498059,9.42262347 4.47498059,9.58565917 C4.47498059,9.83021273 4.33443054,10 4.11176088,10 C3.88909121,10 3.58218839,10 3.30773713,10 C3.03328587,10 2.92923833,9.76271172 2.92923833,9.58565917 C2.92923833,9.46762414 2.92923833,7.22086359 2.92923833,2.84537751 C1.96975238,3.80404153 1.43442638,4.33455337 1.32326034,4.43691302 C1.15651127,4.59045249 0.963651247,4.53541253 0.963651247,4.32322247 C0.963651247,4.11103242 0.963651247,3.19983486 0.963651247,2.90763871 C0.963651247,2.61544257 1.02930291,2.55216863 1.14422635,2.41197084 C1.25914979,2.27177305 3.13689309,0.413447847 3.37510604,0.178801486 C3.61331899,-0.0558448745 3.8068395,-0.0645632043 4.04157392,0.178801486 C4.27630835,0.422166177 6.07430975,2.17371386 6.24960102,2.34970964 C6.42489229,2.52570542 6.48182562,2.70359457 6.48182562,2.90763871 Z" id="Path-6-Copy" transform="translate(3.722738, 4.999766) rotate(-180.000000) translate(-3.722738, -4.999766) "></path>
<path d="M10.8281874,4.68625528 L10.4759248,3.61770952 L8.77212367,3.61770952 L8.43423907,4.68625528 L7.30556071,4.68625528 L9.05968504,-0.000467562775 L10.2458757,-0.000467562775 L12,4.68625528 L10.8281874,4.68625528 Z M9.6204297,0.926056289 L9.00217276,2.88731116 L10.2530647,2.88731116 L9.6204297,0.926056289 Z" id="A"></path>
<polygon id="Z" points="7.83462135 10 7.83462135 9.29224882 10.3215285 6.21877381 7.96001163 6.21877381 7.96001163 5.45859663 11.450041 5.45859663 11.450041 6.1663478 8.97706609 9.23982281 11.4709394 9.23982281 11.4709394 10"></polygon>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="13px" height="12px" viewBox="0 0 13 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 61 (89581) - https://sketch.com -->
<title>sort manually</title>
<desc>Created with Sketch.</desc>
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Menu-/-Outliner-/-menu" transform="translate(-186.000000, -6.000000)" fill-rule="nonzero">
<g id="Group-14">
<g id="sort-manually" transform="translate(184.000000, 4.000000)">
<rect id="Rectangle-2" fill-opacity="0" fill="#D8D8D8" x="0" y="0" width="16" height="16"></rect>
<g id="manual-sort" transform="translate(1.000000, 2.000000)" fill="#FFFFFF">
<g id="Group-3" transform="translate(0.863227, 0.500000)">
<path d="M3.78314642,0.285229 L3.99871527,0.501168483 C4.54521539,1.04243432 5.84355982,2.30793018 5.99117352,2.45613715 C6.16646479,2.63213293 6.22339812,2.81002208 6.22339812,3.01406623 L6.22339812,4.42964999 L6.22339812,4.42964999 C6.22339812,4.56650134 6.0433514,4.73531991 5.85612747,4.54334053 C5.7331288,4.41721771 5.20061175,3.90020525 4.25857636,2.99230315 L4.25781117,8.41304244 L4.25781117,8.41304244 L4.7527864,7.9189506 C5.4031325,7.27048871 5.77346675,6.90467415 5.86378917,6.82150693 C6.03053823,6.66796746 6.22339825,6.72300742 6.22339825,6.93519747 L6.22339825,8.35078124 L6.22339825,8.35078124 C6.22339825,8.64297738 6.15774659,8.70625132 6.04282315,8.84644911 C5.92789971,8.98664689 4.05015641,10.8449721 3.81194346,11.0796185 C3.57373051,11.3142648 3.38021,11.3229832 3.14547558,11.0796185 L2.92990673,10.863679 C2.38340661,10.3224131 1.08506218,9.05691728 0.93744848,8.90871031 C0.76215721,8.73271453 0.70522388,8.55482538 0.70522388,8.35078124 L0.70522388,6.93519747 L0.70522388,6.93519747 C0.70522388,6.79834612 0.8852706,6.62952755 1.07249453,6.82150693 C1.1954932,6.94762975 1.72801025,7.46464221 2.67004564,8.37254431 L2.67081083,2.95180502 L2.67081083,2.95180502 L2.3308861,3.29123439 C1.58412088,4.03640712 1.16210312,4.45377584 1.06483283,4.54334053 C0.89808377,4.69688 0.705223747,4.64184004 0.705223747,4.42964999 L0.705223747,3.01406623 L0.705223747,3.01406623 C0.705223747,2.72187008 0.770875412,2.65859614 0.88579885,2.51839835 C1.00072229,2.37820057 2.87846559,0.519875361 3.11667854,0.285229 C3.35489149,0.0505826389 3.548412,0.0418643091 3.78314642,0.285229 Z M12.8441776,7.75 L12.8441776,9.25 L7.32600318,9.25 L7.32600318,7.75 L12.8441776,7.75 Z M12.8441776,5 L12.8441776,6.5 L7.32600318,6.5 L7.32600318,5 L12.8441776,5 Z M12.8441776,2.25 L12.8441776,3.75 L7.32600318,3.75 L7.32600318,2.25 L12.8441776,2.25 Z" id="Combined-Shape"></path>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="12px" height="11px" viewBox="0 0 12 11" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 61 (89581) - https://sketch.com -->
<title>z to A sort</title>
<desc>Created with Sketch.</desc>
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Menu-/-Outliner-/-menu" transform="translate(-186.000000, -55.000000)" fill="#FFFFFF">
<g id="Group-14">
<g id="icon-/-outliner-/-menu-/-sort-Z-to-A" transform="translate(184.000000, 52.000000)">
<g id="Group-Copy" transform="translate(1.500000, 2.000000)">
<path d="M6.48182562,3.90763871 C6.48182562,4.11168285 6.48182562,5.18637111 6.48182562,5.32322247 C6.48182562,5.46007383 6.3017789,5.6288924 6.11455497,5.43691302 C5.98973902,5.30892676 5.44321422,4.77841492 4.47498059,3.84537751 C4.47498059,8.17586292 4.47498059,10.4226235 4.47498059,10.5856592 C4.47498059,10.8302127 4.33443054,11 4.11176088,11 C3.88909121,11 3.58218839,11 3.30773713,11 C3.03328587,11 2.92923833,10.7627117 2.92923833,10.5856592 C2.92923833,10.4676241 2.92923833,8.22086359 2.92923833,3.84537751 C1.96975238,4.80404153 1.43442638,5.33455337 1.32326034,5.43691302 C1.15651127,5.59045249 0.963651247,5.53541253 0.963651247,5.32322247 C0.963651247,5.11103242 0.963651247,4.19983486 0.963651247,3.90763871 C0.963651247,3.61544257 1.02930291,3.55216863 1.14422635,3.41197084 C1.25914979,3.27177305 3.13689309,1.41344785 3.37510604,1.17880149 C3.61331899,0.944155126 3.8068395,0.935436796 4.04157392,1.17880149 C4.27630835,1.42216618 6.07430975,3.17371386 6.24960102,3.34970964 C6.42489229,3.52570542 6.48182562,3.70359457 6.48182562,3.90763871 Z" id="Path-6-Copy" transform="translate(3.722738, 5.999766) rotate(-1.000000) translate(-3.722738, -5.999766) "></path>
<path d="M10.8281874,11.1453195 L10.4759248,10.0767737 L8.77212367,10.0767737 L8.43423907,11.1453195 L7.30556071,11.1453195 L9.05968504,6.45859663 L10.2458757,6.45859663 L12,11.1453195 L10.8281874,11.1453195 Z M9.6204297,7.38512048 L9.00217276,9.34637535 L10.2530647,9.34637535 L9.6204297,7.38512048 Z" id="A"></path>
<polygon id="Z" points="7.83462135 5.54093581 7.83462135 4.83318464 10.3215285 1.75970963 7.96001163 1.75970963 7.96001163 0.999532437 11.450041 0.999532437 11.450041 1.70728361 8.97706609 4.78075862 11.4709394 4.78075862 11.4709394 5.54093581"></polygon>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 60.1 (88133) - https://sketch.com -->
<title>Outliner / vis &amp; lock / visible / Default</title>
<desc>Created with Sketch.</desc>
<g id="Outliner-/-vis-&amp;-lock-/-visible-/-Default" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.35">
<circle id="Oval-3" fill="#FFFFFF" cx="8" cy="8" r="2.5"></circle>
</g>
</svg>

After

Width:  |  Height:  |  Size: 585 B

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 60.1 (88133) - https://sketch.com -->
<title>Outliner / vis &amp; lock /visible / Default - hover</title>
<desc>Created with Sketch.</desc>
<g id="Outliner-/-vis-&amp;-lock-/visible-/-Default---hover" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group-9" transform="translate(0.500000, 3.500000)" fill="#94D2FF">
<path d="M7.31366902,0.423140577 C8.81176272,0.423140577 11.0671071,1.77422153 14.0797023,4.47638343 C11.0671071,7.17854533 8.81176272,8.52962629 7.31366902,8.52962629 C5.81557532,8.52962629 3.56731657,7.17854533 0.568892758,4.47638343 C3.56731657,1.77422153 5.81557532,0.423140577 7.31366902,0.423140577 Z M7.32429752,1.43645129 C5.64538935,1.43645129 4.28436537,2.79747527 4.28436537,4.47638343 C4.28436537,6.15529159 5.64538935,7.51631557 7.32429752,7.51631557 C9.00320568,7.51631557 10.3642297,6.15529159 10.3642297,4.47638343 C10.3642297,2.79747527 9.00320568,1.43645129 7.32429752,1.43645129 Z M7.32429752,2.449762 C8.44356962,2.449762 9.35091894,3.35711132 9.35091894,4.47638343 C9.35091894,5.59565554 8.44356962,6.50300486 7.32429752,6.50300486 C6.20502541,6.50300486 5.29767609,5.59565554 5.29767609,4.47638343 C5.29767609,3.35711132 6.20502541,2.449762 7.32429752,2.449762 Z" id="Combined-Shape-Copy-2"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 60.1 (88133) - https://sketch.com -->
<title>Outliner / vis &amp; lock / visible / Default</title>
<desc>Created with Sketch.</desc>
<g id="Outliner-/-vis-&amp;-lock-/-visible-/-Default" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.1">
<circle id="Oval-3" fill="#FFFFFF" cx="8" cy="8" r="2.5"></circle>
</g>
</svg>

After

Width:  |  Height:  |  Size: 584 B

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 60.1 (88133) - https://sketch.com -->
<title>Outliner / vis &amp; lock /visible / on</title>
<desc>Created with Sketch.</desc>
<g id="Outliner-/-vis-&amp;-lock-/visible-/-on" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Icons-/-System-/--View---hidden" fill="#FFFFFF">
<path d="M14.6666667,8 L14.1911055,8.42074507 C11.4552099,10.806915 9.38801174,12 7.98951112,12 C7.51648635,12 6.96767553,11.8635059 6.34307866,11.5905178 L7.07749705,10.8554933 C7.36812933,10.9493157 7.67814569,11 8,11 C9.65685425,11 11,9.65685425 11,8 C11,7.67814569 10.9493157,7.36812933 10.8554933,7.07749705 L12.0655037,5.86660728 C12.8575187,6.44385359 13.724573,7.15498449 14.6666667,8 Z M7.98951112,4 C8.76671422,4 9.75044269,4.368481 10.9406965,5.10544299 L10.1451174,5.90274502 C9.60045101,5.34572695 8.84059993,5 8,5 C6.34314575,5 5,6.34314575 5,8 C5,8.84059993 5.34572695,9.60045101 5.90274502,10.1451174 L5.11176964,10.9363144 C4.02594566,10.270303 2.76646689,9.29153153 1.33333333,8 L1.80668794,7.57925493 C4.53006944,5.19308498 6.5910105,4 7.98951112,4 Z M10.0102404,8 C10.0102404,9.1045695 9.1125175,10 8.00512019,10 L7.93466667,9.99733333 L10.0088484,7.92477962 L10.0102404,8 L10.0102404,8 Z M8.00512019,6 C8.56870632,6 9.07798504,6.23192392 9.44226005,6.60530708 L6.61080237,9.43728937 C6.23415224,9.07368931 6,8.56411942 6,8 C6,6.8954305 6.89772289,6 8.00512019,6 Z" id="Shape"></path>
<polygon id="Rectangle-25" transform="translate(7.522750, 7.541445) rotate(45.000000) translate(-7.522750, -7.541445) " points="6.80375237 0.92856205 8.2417471 0.925883489 8.2197393 14.1570058 6.80375237 14.1278886"></polygon>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 60.1 (88133) - https://sketch.com -->
<title>Outliner / vis &amp; lock / visible / on - hover</title>
<desc>Created with Sketch.</desc>
<g id="Outliner-/-vis-&amp;-lock-/-visible-/-on---hover" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Sky-Icon-/-System-/-View" fill="#94D2FF">
<path d="M12.0662207,5.86712992 C12.858042,6.44428281 13.7248573,7.1552395 14.6666667,8 C11.6936446,10.6666667 9.46792606,12 7.98951112,12 C7.51688042,12 6.96858989,11.8637332 6.34463953,11.5911997 L7.07876759,10.8559032 C7.36903278,10.9494633 7.67861466,11 8,11 C9.65685425,11 11,9.65685425 11,8 C11,7.67861466 10.9494633,7.36903278 10.8559032,7.07876759 Z M7.98951112,4 C8.76679076,4 9.75063645,4.36855358 10.9410482,5.10566074 L10.1454186,5.90305312 C9.60073119,5.34585444 8.84075491,5 8,5 C6.34314575,5 5,6.34314575 5,8 C5,8.84036125 5.34553064,9.60001949 5.90227058,10.1446534 L5.11233104,10.9366587 C4.02637979,10.2706404 2.76671388,9.29175412 1.33333333,8 C4.29237025,5.33333333 6.51109618,4 7.98951112,4 Z M10.0073333,7.926 L10.0102404,8 C10.0102404,9.1045695 9.1125175,10 8.00512019,10 C7.98181012,10 7.95859295,9.99960325 7.9354751,9.99881616 L10.0073333,7.926 Z M8.00512019,6 C8.5686887,6 9.07795318,6.23190942 9.44222587,6.60527205 L6.6105304,9.43702678 C6.23403952,9.07344399 6,8.56398363 6,8 C6,6.8954305 6.89772289,6 8.00512019,6 Z" id="Combined-Shape"></path>
<polygon id="Rectangle-25" transform="translate(7.522750, 7.541445) rotate(45.000000) translate(-7.522750, -7.541445) " points="6.80375237 0.92856205 8.2417471 0.925883489 8.2197393 14.1570058 6.80375237 14.1278886"></polygon>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 60.1 (88133) - https://sketch.com -->
<title>Outliner / vis &amp; lock /visible / on</title>
<desc>Created with Sketch.</desc>
<g id="Outliner-/-vis-&amp;-lock-/visible-/-on" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Icons-/-System-/--View---hidden" fill="#FFFFFF" fill-opacity="0.2">
<path d="M14.6666667,8 L14.1911055,8.42074507 C11.4552099,10.806915 9.38801174,12 7.98951112,12 C7.51648635,12 6.96767553,11.8635059 6.34307866,11.5905178 L7.07749705,10.8554933 C7.36812933,10.9493157 7.67814569,11 8,11 C9.65685425,11 11,9.65685425 11,8 C11,7.67814569 10.9493157,7.36812933 10.8554933,7.07749705 L12.0655037,5.86660728 C12.8575187,6.44385359 13.724573,7.15498449 14.6666667,8 Z M7.98951112,4 C8.76671422,4 9.75044269,4.368481 10.9406965,5.10544299 L10.1451174,5.90274502 C9.60045101,5.34572695 8.84059993,5 8,5 C6.34314575,5 5,6.34314575 5,8 C5,8.84059993 5.34572695,9.60045101 5.90274502,10.1451174 L5.11176964,10.9363144 C4.02594566,10.270303 2.76646689,9.29153153 1.33333333,8 L1.80668794,7.57925493 C4.53006944,5.19308498 6.5910105,4 7.98951112,4 Z M10.0102404,8 C10.0102404,9.1045695 9.1125175,10 8.00512019,10 L7.93466667,9.99733333 L10.0088484,7.92477962 L10.0102404,8 L10.0102404,8 Z M8.00512019,6 C8.56870632,6 9.07798504,6.23192392 9.44226005,6.60530708 L6.61080237,9.43728937 C6.23415224,9.07368931 6,8.56411942 6,8 C6,6.8954305 6.89772289,6 8.00512019,6 Z" id="Shape"></path>
<polygon id="Rectangle-25" transform="translate(7.522750, 7.541445) rotate(45.000000) translate(-7.522750, -7.541445) " points="6.80375237 0.92856205 8.2417471 0.925883489 8.2197393 14.1570058 6.80375237 14.1278886"></polygon>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@@ -10,11 +10,6 @@
<qresource prefix="/Level">
<file alias="level.svg">Level/level.svg</file>
</qresource>
<qresource prefix="/Notifications">
<file alias="checkmark.svg">Notifications/checkmark.svg</file>
<file alias="download.svg">Notifications/download.svg</file>
<file alias="link.svg">Notifications/link.svg</file>
</qresource>
<qresource prefix="/Menu">
<file alias="resolution.svg">Menu/resolution.svg</file>
<file alias="debug.svg">Menu/debug.svg</file>
@@ -31,4 +26,26 @@
<file alias="menu.svg">Menu/menu.svg</file>
<file alias="helpers.svg">Menu/helpers.svg</file>
</qresource>
<qresource prefix="/Notifications">
<file alias="checkmark.svg">Notifications/checkmark.svg</file>
<file alias="download.svg">Notifications/download.svg</file>
<file alias="link.svg">Notifications/link.svg</file>
</qresource>
<qresource prefix="/Outliner">
<file alias="sort_a_to_z.svg">Outliner/sort_a_to_z.svg</file>
<file alias="sort_manually.svg">Outliner/sort_manually.svg</file>
<file alias="sort_z_to_a.svg">Outliner/sort_z_to_a.svg</file>
<file alias="visibility_default.svg">Outliner/visibility_default.svg</file>
<file alias="visibility_default_hover.svg">Outliner/visibility_default_hover.svg</file>
<file alias="visibility_default_transparent.svg">Outliner/visibility_default_transparent.svg</file>
<file alias="visibility_on.svg">Outliner/visibility_on.svg</file>
<file alias="visibility_on_hover.svg">Outliner/visibility_on_hover.svg</file>
<file alias="visibility_on_transparent.svg">Outliner/visibility_on_transparent.svg</file>
<file alias="lock_default.svg">Outliner/lock_default.svg</file>
<file alias="lock_default_hover.svg">Outliner/lock_default_hover.svg</file>
<file alias="lock_default_transparent.svg">Outliner/lock_default_transparent.svg</file>
<file alias="lock_on.svg">Outliner/lock_on.svg</file>
<file alias="lock_on_hover.svg">Outliner/lock_on_hover.svg</file>
<file alias="lock_on_transparent.svg">Outliner/lock_on_transparent.svg</file>
</qresource>
</RCC>
@@ -1,145 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "ConditionGroupWidget.h"
#include "ConditionWidget.h"
#include <QGridLayout>
#include <QToolButton>
#include <QWidgetItem>
#include <QLayoutItem>
#include <QPaintEvent>
#include <QPainter>
#include <QStyleOptionToolButton>
enum Action {
ActionAdd,
ActionRemove
};
class ActionButton : public QToolButton
{
public:
explicit ActionButton(QWidget *parent = nullptr)
: QToolButton(parent)
{
setAttribute(Qt::WA_Hover);
}
void paintEvent(QPaintEvent *)
{
QStyleOptionToolButton opt;
initStyleOption(&opt);
auto state = (opt.state & QStyle::State_Sunken) ? QIcon::Active
: ((opt.state & QStyle::State_MouseOver) ? QIcon::Selected
: QIcon::Normal);
QPixmap pix = icon().pixmap(QSize(16, 16), state);
QPainter p(this);
QRect pixRect = pix.rect();
pixRect.moveCenter(rect().center());
pixRect.adjust(-2, 1, -2, 1);
p.drawPixmap(pixRect , pix);
}
};
ConditionGroupWidget::ConditionGroupWidget(QWidget *parent)
: QWidget(parent)
, m_layout(new QGridLayout(this))
{
m_addIcon.addPixmap(QPixmap(":/stylesheet/img/condition_add.png"), QIcon::Normal);
m_addIcon.addPixmap(QPixmap(":/stylesheet/img/condition_add_hover.png"), QIcon::Selected);
m_addIcon.addPixmap(QPixmap(":/stylesheet/img/condition_add_pressed.png"), QIcon::Active);
m_delIcon.addPixmap(QPixmap(":/stylesheet/img/condition_remove.png"), QIcon::Normal);
m_delIcon.addPixmap(QPixmap(":/stylesheet/img/condition_remove_hover.png"), QIcon::Selected);
m_delIcon.addPixmap(QPixmap(":/stylesheet/img/condition_remove_pressed.png"), QIcon::Active);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
m_layout->setHorizontalSpacing(0);
// Lets have at least one condition
appendCondition();
}
void ConditionGroupWidget::appendCondition()
{
auto cond = new ConditionWidget();
connect(cond, SIGNAL(geometryChanged()), this, SLOT(update()));
m_layout->addWidget(cond, count(), 0);
m_layout->addWidget(new ActionButton(), count() - 1, 1);
updateButtons();
}
void ConditionGroupWidget::removeCondition(int n)
{
if (n >= 0 && n < count() && count() > 1) {
m_layout->removeItem(m_layout->itemAtPosition(n, 0));
m_layout->removeItem(m_layout->itemAtPosition(n, 1));
updateButtons();
}
}
int ConditionGroupWidget::count() const
{
return m_layout->rowCount();
}
void ConditionGroupWidget::paintEvent(QPaintEvent *)
{
const int c = count();
for (int i = 0; i < c - 1; ++i) {
ConditionWidget *cond1 = conditionAt(i);
ConditionWidget *cond2 = conditionAt(i + 1);
if (!cond1 || !cond2)
continue; // defensive, doesn't happen
const int separatorHeight = 3;
const int y = ((cond1->geometry().bottom() + cond2->y()) / 2) - (separatorHeight / 2);
QPainter p(this);
p.setPen(QColor(50, 52, 53));
p.setBrush(QColor(94, 96, 96));
p.drawRoundedRect(QRect(0, y, width() - 1, separatorHeight), 1, 1);
}
}
ConditionWidget *ConditionGroupWidget::conditionAt(int row) const
{
if (row < 0 || row >= count())
return nullptr;
if (auto item = m_layout->itemAtPosition(row, 0))
return qobject_cast<ConditionWidget*>(item->widget());
return nullptr;
}
void ConditionGroupWidget::updateButtons()
{
update();
const int n = count();
for (int i = 0; i < n; ++i) {
if (auto item = m_layout->itemAtPosition(i, 1)) {
if (auto button = qobject_cast<QToolButton*>(item->widget())) {
bool isLast = i == n - 1;
button->setCheckable(true);
button->setChecked(true);
button->setIcon(isLast ? m_addIcon : m_delIcon);
button->disconnect();
if (isLast) {
connect(button, &QToolButton::clicked, this, &ConditionGroupWidget::appendCondition);
} else {
connect(button, &QToolButton::clicked, this, [this, i] {
removeCondition(i);
});
}
}
}
}
}
#include "StyleGallery/moc_ConditionGroupWidget.cpp"
@@ -1,36 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef CONDITIONGROUPWIDGET_H
#define CONDITIONGROUPWIDGET_H
#if !defined(Q_MOC_RUN)
#include <QWidget>
#include <QIcon>
#endif
class QGridLayout;
class ConditionWidget;
class ConditionGroupWidget : public QWidget
{
Q_OBJECT
public:
explicit ConditionGroupWidget(QWidget *parent = nullptr);
void appendCondition();
void removeCondition(int n);
int count() const;
void paintEvent(QPaintEvent *) override;
private:
ConditionWidget* conditionAt(int row) const;
void updateButtons();
QGridLayout *const m_layout;
QIcon m_addIcon;
QIcon m_delIcon;
};
#endif
@@ -1,51 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "ConditionWidget.h"
#include <QHBoxLayout>
#include <QComboBox>
#include <QCheckBox>
#include <QLineEdit>
ConditionWidget::ConditionWidget(QWidget *parent)
: QWidget(parent)
{
auto layout = new QHBoxLayout(this);
auto checkbox = new QCheckBox();
auto combo1 = new QComboBox();
combo1->addItem(QStringLiteral("Asset Type"));
combo1->addItem(QStringLiteral("Asset Name"));
combo1->setProperty("class", "condition");
auto combo2 = new QComboBox();
combo2->setFixedWidth(88);
combo2->setProperty("class", "condition");
combo2->addItem(QStringLiteral("is"));
combo2->addItem(QStringLiteral("is not"));
auto lineedit = new QLineEdit();
layout->addWidget(checkbox);
layout->addWidget(combo1);
layout->addWidget(combo2);
layout->addWidget(lineedit);
layout->setSpacing(5);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
}
void ConditionWidget::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
emit geometryChanged();
}
void ConditionWidget::moveEvent(QMoveEvent *event)
{
QWidget::moveEvent(event);
emit geometryChanged();
}
#include "StyleGallery/moc_ConditionWidget.cpp"
@@ -1,30 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef CONDITIONWIDGET_H
#define CONDITIONWIDGET_H
#if !defined(Q_MOC_RUN)
#include <QWidget>
#endif
class ConditionWidget : public QWidget
{
Q_OBJECT
public:
explicit ConditionWidget(QWidget *parent = nullptr);
signals:
void geometryChanged();
protected:
void resizeEvent(QResizeEvent *event) override;
void moveEvent(QMoveEvent *event) override;
};
#endif
@@ -1,57 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "DeploymentsWidget.h"
#include <AzQtComponents/Components/StyledDockWidget.h>
#include <QPainter>
#include <QInputDialog>
using namespace AzQtComponents;
DeploymentsWidget::DeploymentsWidget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::DeploymentsWidget())
{
setFixedSize(263, 238);
ui->setupUi(this);
ui->titlebar->setWindowTitleOverride(tr("Deployments"));
//ui->titlebar->setFrameHackEnabled(true);
ui->titlebar->setForceInactive(true);
ui->deploymentOk->setProperty("class", "Primary");
ui->contents->setAttribute(Qt::WA_TranslucentBackground);
ui->blueLabel->setProperty("class", "addDeployment"); // Should this label style be more generic ?
ui->blueLabel->installEventFilter(this);
ui->blueLabel->setCursor(Qt::PointingHandCursor);
}
void DeploymentsWidget::paintEvent(QPaintEvent *)
{
QPainter p(this);
StyledDockWidget::drawFrame(p, rect(), false);
p.setPen(QColor(35, 36, 37));
p.drawLine(1, height()-51, width() - 2, height() - 51);
p.setPen(QColor(66, 67, 68));
p.drawLine(1, height()-50, width() - 2, height() - 50);
}
bool DeploymentsWidget::eventFilter(QObject *watched, QEvent *event)
{
if (event->type() == QEvent::MouseButtonRelease) {
addDeployment();
return true;
}
return QWidget::eventFilter(watched, event);
}
void DeploymentsWidget::addDeployment()
{
QInputDialog::getText(this, tr("Enter deployment name"), QString());
}
#include "StyleGallery/moc_DeploymentsWidget.cpp"
@@ -1,30 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef DEPLOYMENTSWIDGET_H
#define DEPLOYMENTSWIDGET_H
#if !defined(Q_MOC_RUN)
#include <AzQtComponents/StyleGallery/ui_deploymentswidget.h>
#include <QWidget>
#include <QScopedPointer>
#endif
class DeploymentsWidget : public QWidget
{
Q_OBJECT
public:
explicit DeploymentsWidget(QWidget *parent = 0);
void paintEvent(QPaintEvent *event) override;
bool eventFilter(QObject *watched, QEvent *event) override;
void addDeployment();
private:
QScopedPointer<Ui::DeploymentsWidget> ui;
};
#endif
@@ -1,15 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "MyCombo.h"
MyComboBox::MyComboBox(QWidget *parent)
: QComboBox(parent)
{
}
#include "StyleGallery/moc_MyCombo.cpp"
@@ -1,22 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef MY_COMBO_H
#define MY_COMBO_H
#if !defined(Q_MOC_RUN)
#include <QComboBox>
#endif
class MyComboBox : public QComboBox
{
Q_OBJECT
public:
explicit MyComboBox(QWidget *parent = nullptr);
};
#endif
@@ -1,69 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
// Description : CViewportTitleDlg implementation file
#include "ViewportTitleDlg.h"
#include <AzQtComponents/StyleGallery/ui_ViewportTitleDlg.h>
#include <QAction>
ViewportTitleDlg::ViewportTitleDlg(QWidget* pParent)
: QWidget(pParent),
m_ui(new Ui::ViewportTitleDlg)
{
m_ui->setupUi(this);
OnInitDialog();
m_ui->m_viewportSearch->setIcon(QIcon(":/stylesheet/img/16x16/Search.png"));
auto clearAction = new QAction(this);
clearAction->setIcon(QIcon(":/stylesheet/img/16x16/lineedit-clear.png"));
m_ui->m_viewportSearch->setFixedWidth(190);
}
ViewportTitleDlg::~ViewportTitleDlg()
{
}
void ViewportTitleDlg::OnInitDialog()
{
m_ui->m_titleBtn->setText(m_title);
m_ui->m_sizeStaticCtrl->setText(QString());
connect(m_ui->m_maxBtn, &QToolButton::clicked, this, &ViewportTitleDlg::OnMaximize);
connect(m_ui->m_toggleHelpersBtn, &QToolButton::clicked, this, &ViewportTitleDlg::OnToggleHelpers);
connect(m_ui->m_toggleDisplayInfoBtn, &QToolButton::clicked, this, &ViewportTitleDlg::OnToggleDisplayInfo);
m_ui->m_maxBtn->setProperty("class", "big");
m_ui->m_toggleHelpersBtn->setProperty("class", "big");
m_ui->m_toggleDisplayInfoBtn->setProperty("class", "big");
}
void ViewportTitleDlg::SetTitle( const QString &title )
{
m_title = title;
m_ui->m_titleBtn->setText(m_title);
m_ui->m_viewportSearch->setVisible(title == QLatin1String("Perspective"));
}
void ViewportTitleDlg::OnMaximize()
{
}
void ViewportTitleDlg::OnToggleHelpers()
{
}
void ViewportTitleDlg::OnToggleDisplayInfo()
{
}
#include "StyleGallery/moc_ViewportTitleDlg.cpp"
@@ -1,36 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <QWidget>
#endif
namespace Ui
{
class ViewportTitleDlg;
}
class ViewportTitleDlg : public QWidget
{
Q_OBJECT
public:
ViewportTitleDlg(QWidget* pParent = nullptr);
virtual ~ViewportTitleDlg();
protected slots:
void OnMaximize();
void OnToggleHelpers();
void OnToggleDisplayInfo();
private:
void OnInitDialog();
void SetTitle(const QString &title);
QString m_title = QLatin1String("Perspective");
QScopedPointer<Ui::ViewportTitleDlg> m_ui;
};
@@ -1,225 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ViewportTitleDlg</class>
<widget class="QWidget" name="ViewportTitleDlg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>574</width>
<height>29</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,2,0,0,0,0,0,0,0,0,0,0,0">
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="m_titleBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Static</string>
</property>
</widget>
</item>
<item>
<widget class="AzQtComponents::ToolButtonLineEdit" name="m_viewportSearch">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>147</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>147</width>
<height>22</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>FOV:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_fovStaticCtrl">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>120°</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Ratio:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_ratioStaticCtrl">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>000:000</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_sizeStaticCtrl">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>0000 x 0000</string>
</property>
</widget>
</item>
<item>
<widget class="AzQtComponents::ButtonDivider" name="divider1" native="true"/>
</item>
<item>
<widget class="QToolButton" name="m_toggleDisplayInfoBtn">
<property name="toolTip">
<string>Toggle display info</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/stylesheet/img/UI20/Info.svg</normaloff>:/stylesheet/img/UI20/Info.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="m_toggleHelpersBtn">
<property name="toolTip">
<string>Toggle display helpers</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/stylesheet/img/UI20/Helpers.svg</normaloff>:/stylesheet/img/UI20/Helpers.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="AzQtComponents::ButtonDivider" name="divider2" native="true"/>
</item>
<item>
<widget class="QToolButton" name="m_maxBtn">
<property name="icon">
<iconset>
<normaloff>:/stylesheet/img/16x16/Maximize.png</normaloff>:/stylesheet/img/16x16/Maximize.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="rightSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>AzQtComponents::ToolButtonLineEdit</class>
<extends>QLineEdit</extends>
<header>AzQtComponents/Components/ToolButtonLineEdit.h</header>
</customwidget>
<customwidget>
<class>AzQtComponents::ButtonDivider</class>
<extends>QWidget</extends>
<header>AzQtComponents/Components/ButtonDivider.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -1,179 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="4.0527225mm"
height="4.0527225mm"
viewBox="0 0 14.36004 14.36004"
id="svg3348"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="assets.svg">
<defs
id="defs3350">
<linearGradient
inkscape:collect="always"
id="linearGradient4232">
<stop
style="stop-color:#7b7b7b;stop-opacity:1"
offset="0"
id="stop4234" />
<stop
style="stop-color:#666666;stop-opacity:1"
offset="1"
id="stop4236" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4232"
id="linearGradient4238"
x1="13.081557"
y1="1055.9957"
x2="13.081557"
y2="1070.327"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="25.755391"
inkscape:cx="19.18662"
inkscape:cy="25.784244"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1016"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata3353">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-0.31998014,-1037.6822)">
<ellipse
style="opacity:0;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#4e413a;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path3356"
cx="27.955313"
cy="1029.9979"
rx="18.015646"
ry="19.879333" />
<ellipse
style="opacity:0;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#4e413a;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path3358"
cx="26.091625"
cy="1032.4829"
rx="27.334084"
ry="23.606709" />
<ellipse
style="opacity:0;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#4e413a;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path3360"
cx="6.2122917"
cy="1006.3912"
rx="41.001125"
ry="44.7285" />
<ellipse
style="opacity:0;fill:#417176;fill-opacity:0.44148937;fill-rule:evenodd;stroke:#4e413a;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4162"
cx="24.849167"
cy="1026.8918"
rx="16.773188"
ry="41.622353" />
<circle
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#3675dd;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4164"
cx="-4.3371701"
cy="1029.7621"
r="6.6800199"
inkscape:export-xdpi="94.010872"
inkscape:export-ydpi="94.010872"
inkscape:export-filename="/data/secured/home/serj/kdab/amazon-style/img/radio-hover.png" />
<ellipse
style="opacity:1;fill:#3675dd;fill-opacity:1;fill-rule:evenodd;stroke:#3675dd;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4164-1"
cx="24.819975"
cy="1043.5323"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
inkscape:export-filename="/data/secured/home/serj/kdab/amazon-style/img/radio-selected.png"
rx="7.4999924"
ry="7.4999919" />
<circle
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#3675dd;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4164-5"
cx="26.94738"
cy="1025.5796"
r="7.4999933"
inkscape:export-xdpi="90.000015"
inkscape:export-ydpi="90.000015"
inkscape:export-filename="/data/secured/home/serj/kdab/amazon-style/img/radio-unselected.png" />
<circle
style="opacity:1;fill:url(#linearGradient4238);fill-opacity:1;fill-rule:evenodd;stroke:#3675dd;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4164-5-7"
cx="12.839327"
cy="1063.1339"
r="7.4999924"
inkscape:export-xdpi="90.000015"
inkscape:export-ydpi="90.000015"
inkscape:export-filename="/data/secured/home/serj/kdab/amazon-style/img/radio-disabled.png" />
<ellipse
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#3675dd;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4259"
cx="24.819977"
cy="1043.6315"
rx="2.9999933"
ry="3.139528"
inkscape:export-filename="/data/secured/home/serj/kdab/amazon-style/img/radio-selected.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<rect
style="fill:#4285f4;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4263"
width="10.999988"
height="10.999988"
x="7.7876616"
y="1014.0333"
rx="2.1999974"
inkscape:export-filename="/data/secured/home/serj/kdab/amazon-style/img/combo-checked.png"
inkscape:export-xdpi="90.000015"
inkscape:export-ydpi="90.000015" />
<path
style="fill:none;fill-rule:evenodd;stroke:#eeeeee;stroke-width:1.09999859;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 9.6716909,1020.2265 2.4883481,2.5829 c 4.574398,-6.5447 4.574398,-6.5447 4.574398,-6.5447"
id="path4269"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc"
inkscape:export-filename="/data/secured/home/serj/kdab/amazon-style/img/combo-checked.png"
inkscape:export-xdpi="90.000015"
inkscape:export-ydpi="90.000015" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 7.3 KiB

@@ -1,176 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DeploymentsWidget</class>
<widget class="QWidget" name="DeploymentsWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>263</width>
<height>238</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>263</width>
<height>238</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>263</width>
<height>238</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<item>
<widget class="AzQtComponents::TitleBar" name="titlebar" native="true"/>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="contents" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>10</number>
</property>
<property name="leftMargin">
<number>12</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>You must select a default deployment where
you would like to add these resurces.</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="blueLabel">
<property name="text">
<string>Add a deployment</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton">
<property name="text">
<string>New deployment name 3</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_2">
<property name="text">
<string>Deployment name 2</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_3">
<property name="text">
<string>Deployment name 1</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<item>
<widget class="QPushButton" name="deploymentO2">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="deploymentOk">
<property name="text">
<string>Ok</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>AzQtComponents::TitleBar</class>
<extends>QWidget</extends>
<header>AzQtComponents/Components/Titlebar.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -1,300 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "mainwidget.h"
#include <AzCore/Component/ComponentApplication.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzQtComponents/Components/StyledDockWidget.h>
#include <AzQtComponents/Components/ToolButtonComboBox.h>
#include <AzQtComponents/Components/ToolButtonLineEdit.h>
#include <AzQtComponents/Components/WindowDecorationWrapper.h>
#include <AzQtComponents/Components/O3DEStylesheet.h>
#include "MyCombo.h"
#include <QPushButton>
#include <QDebug>
#include <QApplication>
#include <QStyleFactory>
#include <QMainWindow>
#include <QAction>
#include <QMenuBar>
#include <QToolBar>
#include <QDockWidget>
#include <QTextEdit>
#include <QComboBox>
#include <QToolButton>
#include <QVBoxLayout>
#include <QSettings>
#include <QDialog>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <AzQtComponents/Components/StyledDetailsTableView.h>
#include <AzQtComponents/Components/StyledDetailsTableModel.h>
using namespace AzQtComponents;
QToolBar * toolBar()
{
auto t = new QToolBar(QString());
QAction *a = nullptr;
QMenu *menu = nullptr;
auto but = new QToolButton();
menu = new QMenu();
but->setMenu(menu);
but->setCheckable(true);
but->setPopupMode(QToolButton::MenuButtonPopup);
but->setDefaultAction(new QAction(QStringLiteral("Test"), but));
but->setIcon(QIcon(":/stylesheet/img/undo.png"));
t->addWidget(but);
a = t->addAction(QIcon(":/stylesheet/img/select.png"), QString());
a->setCheckable(true);
t->addSeparator();
auto tbcb = new AzQtComponents::ToolButtonComboBox();
tbcb->setIcon(QIcon(":/stylesheet/img/angle.png"));
tbcb->comboBox()->addItem("1");
tbcb->comboBox()->addItem("2");
tbcb->comboBox()->addItem("3");
tbcb->comboBox()->addItem("4");
t->addWidget(tbcb);
auto tble = new AzQtComponents::ToolButtonLineEdit();
tble->setFixedWidth(130);
tble->setIcon(QIcon(":/stylesheet/img/16x16/Search.png"));
t->addWidget(tble);
auto combo = new QComboBox();
combo->addItem("Test1");
combo->addItem("Test3");
combo->addItem("Selection,Area");
t->addWidget(combo);
const QStringList iconNames = {
"Align_object_to_surface",
"Align_to_grid",
"Align_to_Object",
"Angle",
"Asset_Browser",
"Audio",
"Database_view",
"Delete_named_selection",
"Follow_terrain",
"Freeze",
"Gepetto",
"Get_physics_state",
"Grid",
"layer_editor",
"layers",
"LIghting",
"lineedit-clear",
"LOD_generator",
"LUA",
"Material",
"Maximize",
"Measure",
"Move",
"Object_follow_terrain",
"Object_list",
"Redo",
"Reset_physics_state",
"Scale",
"select_object",
"Select",
"Select_terrain",
"Simulate_Physics_on_selected_objects",
"Substance",
"Terrain",
"Terrain_Texture",
"Texture_browser",
"Time_of_Day",
"Trackview",
"Translate",
"UI_editor",
"undo",
"Unfreeze_all",
"Vertex_snapping" };
for (auto name : iconNames) {
auto a2 = t->addAction(QIcon(QString(":/stylesheet/img/16x16/%1.png").arg(name)), nullptr);
a2->setToolTip(name);
a2->setDisabled(name == "Audio");
}
combo = new MyComboBox();
combo->addItem("Test1");
combo->addItem("Test3");
combo->addItem("Selection,Area");
t->addWidget(combo);
return t;
}
class MainWindow : public QMainWindow
{
public:
explicit MainWindow(QWidget *parent = nullptr)
: QMainWindow(parent)
, m_settings("org", "app")
{
setAttribute(Qt::WA_DeleteOnClose);
QVariant geoV = m_settings.value("geo");
if (geoV.isValid()) {
restoreGeometry(geoV.toByteArray());
}
}
~MainWindow()
{
qDebug() << "Deleted mainwindow";
auto geo = saveGeometry();
m_settings.setValue("geo", geo);
}
private:
QSettings m_settings;
};
static void addMenu(QMainWindow *w, const QString &name)
{
auto action = w->menuBar()->addAction(name);
auto menu = new QMenu();
action->setMenu(menu);
menu->addAction("Item 1");
menu->addAction("Item 2");
menu->addAction("Item 3");
menu->addAction("Longer item 4");
menu->addAction("Longer item 5");
}
int main(int argc, char **argv)
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
QApplication app(argc, argv);
AzQtComponents::O3DEStylesheet stylesheet(&app);
AZ::IO::FixedMaxPath engineRootPath;
{
AZ::ComponentApplication componentApplication(argc, argv);
auto settingsRegistry = AZ::SettingsRegistry::Get();
settingsRegistry->Get(engineRootPath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder);
}
stylesheet.initialize(&app, engineRootPath);
auto wrapper = new AzQtComponents::WindowDecorationWrapper();
QMainWindow *w = new MainWindow();
w->setWindowTitle("Component Gallery");
auto widget = new MainWidget(w);
w->resize(550, 900);
w->setMinimumWidth(500);
wrapper->setGuest(w);
wrapper->enableSaveRestoreGeometry("app", "org", "windowGeometry");
w->setCentralWidget(widget);
w->setWindowFlags(w->windowFlags() | Qt::WindowStaysOnTopHint);
w->show();
auto action = w->menuBar()->addAction("Menu 1");
auto fileMenu = new QMenu();
action->setMenu(fileMenu);
auto openDock = fileMenu->addAction("Open dockwidget");
QObject::connect(openDock, &QAction::triggered, w, [&w] {
auto dock = new AzQtComponents::StyledDockWidget(QLatin1String("O3DE"), w);
auto button = new QPushButton("Click to dock");
auto wid = new QWidget();
auto widLayout = new QVBoxLayout(wid);
widLayout->addWidget(button);
wid->resize(300, 200);
QObject::connect(button, &QPushButton::clicked, dock, [dock]{
dock->setFloating(!dock->isFloating());
});
w->addDockWidget(Qt::BottomDockWidgetArea, dock);
dock->setWidget(wid);
dock->resize(300, 200);
dock->setFloating(true);
dock->show();
});
QAction* newAction = fileMenu->addAction("Test StyledDetailsTableView");
newAction->setShortcut(QKeySequence::Delete);
QObject::connect(newAction, &QAction::triggered, w, [w]() {
QDialog temp(w);
temp.setWindowTitle("StyleTableWidget Test");
QVBoxLayout* layout = new QVBoxLayout(&temp);
AzQtComponents::StyledDetailsTableModel* tableModel = new AzQtComponents::StyledDetailsTableModel();
tableModel->AddColumn("Status", AzQtComponents::StyledDetailsTableModel::StatusIcon);
tableModel->AddColumn("Platform");
tableModel->AddColumn("Message");
tableModel->AddColumnAlias("message", "Message");
tableModel->AddPrioritizedKey("Data3");
tableModel->AddDeprioritizedKey("Data1");
auto table = new AzQtComponents::StyledDetailsTableView();
table->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
table->setModel(tableModel);
{
AzQtComponents::StyledDetailsTableModel::TableEntry entry;
entry.Add("Message", "A very very long first message. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus et maximus tortor, ac commodo ante. Maecenas porta posuere mauris, vel consectetur arcu ornare interdum. Praesent rhoncus consequat neque, non volutpat mauris cursus a. Proin a nisl quis dui consectetur malesuada a et diam. Integer finibus luctus nibh nec cursus.");
entry.Add("Platform", "PC");
entry.Add("Status", AzQtComponents::StyledDetailsTableModel::StatusSuccess);
tableModel->AddEntry(entry);
}
{
AzQtComponents::StyledDetailsTableModel::TableEntry entry;
entry.Add("Message", "Second message. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus et maximus tortor, ac commodo ante. Maecenas porta posuere mauris, vel consectetur arcu ornare interdum. Praesent rhoncus consequat neque, non volutpat mauris cursus a. Proin a nisl quis dui consectetur malesuada a et diam. Integer finibus luctus nibh nec cursus.");
entry.Add("Platform", "PC");
entry.Add("Status", AzQtComponents::StyledDetailsTableModel::StatusError);
entry.Add("Data1", "Deprioritized item.");
entry.Add("Data3", "Prioritized item.");
tableModel->AddEntry(entry);
}
for (int i = 0; i < 4; i++)
{
AzQtComponents::StyledDetailsTableModel::TableEntry entry;
entry.Add("message", "Third message");
entry.Add("Status", AzQtComponents::StyledDetailsTableModel::StatusWarning);
entry.Add("Platform", "PC");
entry.Add("Index1", "A smaller detail.");
entry.Add("Index2", "Another small detail.");
entry.Add("Index3", "A final small detail.");
tableModel->AddEntry(entry);
}
layout->addWidget(table);
temp.exec();
});
QAction* refreshAction = fileMenu->addAction("Refresh Stylesheet");
QObject::connect(refreshAction, &QAction::triggered, refreshAction, [&stylesheet]() {
stylesheet.Refresh();
});
addMenu(w, "Menu 2");
addMenu(w, "Menu 3");
addMenu(w, "Menu 4");
w->addToolBar(toolBar());
QObject::connect(widget, &MainWidget::reloadCSS, widget, [] {
qDebug() << "Reloading CSS";
qApp->setStyleSheet(QString());
qApp->setStyleSheet("file:///style.qss");
});
return app.exec();
}
@@ -1,275 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "mainwidget.h"
#include <AzQtComponents/StyleGallery/ui_mainwidget.h>
#include <AzQtComponents/Components/ButtonStripe.h>
#include <AzQtComponents/Components/DockBarButton.h>
#include <QButtonGroup>
#include <QMenu>
#include <QMouseEvent>
#include <QStringList>
#include <QStandardItemModel>
#include <QMainWindow>
#include <QMenuBar>
#include <QDebug>
using namespace AzQtComponents;
MainWidget::MainWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::MainWidget)
{
ui->setupUi(this);
QStringList stripeButtonsNames = QStringList();
stripeButtonsNames << "Controls" << "ItemViews" << "Styles" << "Layouts";
ui->buttonStripe->addButtons(stripeButtonsNames, ui->stackedWidget->currentIndex());
connect(ui->buttonStripe, &AzQtComponents::ButtonStripe::buttonClicked,
ui->stackedWidget, &QStackedWidget::setCurrentIndex);
initializeControls();
initializeItemViews();
connect(ui->button1, &QPushButton::clicked, this, []{
auto mainwindow = new QMainWindow();
auto menu = new QMenu("File");
auto mb = new QMenuBar();
menu->addAction("Action1");
menu->addAction("Action2");
menu->addAction("Action3");
mb->addMenu(menu);
mb->addAction("Edit");
mb->addMenu("Create");
mb->addMenu("Select");
mb->addMenu("Modify");
mb->addMenu("Display");
mainwindow->setMenuBar(mb);
mainwindow->resize(400, 400);
mainwindow->show();
mainwindow->raise();
});
}
MainWidget::~MainWidget()
{
delete ui;
qDebug() << "Deleted main widget";
}
void MainWidget::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::MiddleButton) {
emit reloadCSS();
}
}
void MainWidget::initializeControls()
{
auto menu = new QMenu();
menu->addAction("Test 1");
menu->addAction("Test 2");
ui->button3->setMenu(menu);
auto menu2 = new QMenu();
menu2->addAction("Test 1");
menu2->addAction("Test 2");
ui->disabledButton3->setMenu(menu2);
ui->selectedCheckBox->setCheckState(Qt::Checked);
ui->enabledCheckBox->setCheckState(Qt::Unchecked);
ui->tristateCheckBox->setCheckState(Qt::PartiallyChecked);
// TODO: Move these into subclass, can't be done from .css
// Nicolas: or do it in the proxy style
// Sergio: css doesn't work well with proxy style , says Qt's docs.
ui->progressBar->setFormat(QString());
ui->progressBar->setMaximumHeight(8);
ui->progressBarFull->setFormat(QString());
ui->progressBarFull->setMaximumHeight(8);
ui->button2->setProperty("class", "Primary");
ui->disabledButton1->setProperty("class", "Primary");
ui->invalidLineEdit->setFlavor(AzQtComponents::StyledLineEdit::Invalid);
ui->validLineEdit->setFlavor(AzQtComponents::StyledLineEdit::Valid);
ui->questionLineEdit->setFlavor(AzQtComponents::StyledLineEdit::Question);
ui->infoLineEdit->setFlavor(AzQtComponents::StyledLineEdit::Information);
// In order to try out validator impact on flavor
ui->invalidLineEdit->setPlaceholderText("Enter 4 digits");
ui->invalidLineEdit->setValidator(new QRegExpValidator(QRegExp("[1-9]\\d{3,3}")));
ui->disabledVectorEdit->setColors(qRgb(84, 190, 93), qRgb(226, 82, 67), qRgb(66, 133, 244));
ui->vectorEdit->setColors(qRgb(84, 190, 93), qRgb(226, 82, 67), qRgb(66, 133, 244));
ui->unknownVectorEdit->setColors(qRgb(84, 190, 93), qRgb(226, 82, 67), qRgb(66, 133, 244));
ui->warningVectorEdit->setColors(qRgb(84, 190, 93), qRgb(226, 82, 67), qRgb(66, 133, 244));
ui->warningVectorEdit->setFlavor(AzQtComponents::VectorEditElement::Invalid);
QStringList rpy = {tr("R"), tr("P"), tr("Y")};
ui->disabledRPYVectorEdit->setLabels(rpy);
ui->rPYVectorEdit->setLabels(rpy);
ui->unknownRPYVectorEdit->setLabels(rpy);
ui->warningRPYVectorEdit->setLabels(rpy);
ui->filterNameLineEdit->setClearButtonEnabled(true);
ui->comboBox_4->setEnabled(false);
for (int i = 0; i < 10; ++i) {
ui->comboBox->addItem(QStringLiteral("combo 0: Item %1").arg(i));
ui->comboBox_2->addItem(QStringLiteral("combo 2: Item %1").arg(i));
ui->comboBox_3->addItem(QStringLiteral("combo 3: Item %1").arg(i));
ui->comboBox_4->addItem(QStringLiteral("combo 4: Item %1").arg(i));
ui->comboBox_5->addItem(QStringLiteral("combo 5: Item %1").arg(i));
ui->comboBox_6->addItem(QStringLiteral("combo 6: Item %1").arg(i));
}
ui->allCombo->setProperty("class", "condition");
ui->allCombo->setFixedWidth(37);
ui->allCombo->setFixedHeight(21);
ui->allCombo->addItem("all");
ui->allCombo->addItem("any");
// Construct the available tag list.
const int numAvailableTags = 128;
QVector<QString> availableTags;
availableTags.reserve(numAvailableTags+8);
availableTags.push_back("Healthy");
availableTags.push_back("Tired");
availableTags.push_back("Laughing");
availableTags.push_back("Happy");
availableTags.push_back("Smiling");
availableTags.push_back("Weapon Left");
availableTags.push_back("Weapon Right");
availableTags.push_back("Loooooooooooooooooong Tag");
for (const QString& tag : availableTags)
{
ui->searchWidget->AddTypeFilter("Foo", tag);
}
for (int i = 0; i < numAvailableTags; ++i)
{
QString tagName = "tag" + QString::number(i + 1);
availableTags.push_back(tagName);
if (i < 10)
{
ui->searchWidget->AddTypeFilter("Bar", tagName);
}
}
ui->tagSelector->Reinit(availableTags);
// Pre-select some of the tags.
ui->tagSelector->SelectTag("Healthy");
ui->tagSelector->SelectTag("Laughing");
ui->tagSelector->SelectTag("Smiling");
ui->tagSelector->SelectTag("Happy");
ui->tagSelector->SelectTag("Weapon Left");
ui->toolButton->setProperty("class", "QToolBar");
ui->toolButton_2->setProperty("class", "QToolBar");
ui->toolButton_3->setProperty("class", "QToolBar");
ui->toolButton_4->setProperty("class", "QToolBar");
ui->toolButton_5->setProperty("class", "QToolBar");
ui->toolButton_6->setProperty("class", "QToolBar");
ui->toolButton_7->setProperty("class", "QToolBar");
ui->toolButton_8->setProperty("class", "QToolBar");
ui->toolButton_9->setProperty("class", "QToolBar");
ui->toolButton_10->setProperty("class", "QToolBar");
ui->toolButton_11->setProperty("class", "QToolBar");
ui->toolButton_12->setProperty("class", "QToolBar");
ui->conditionGroup->appendCondition();
// place the viewportTitle menu into the place holder we prepared in the ui file
/*ViewportTitleDlg* viewPortTitleDlg = new ViewportTitleDlg(ui->ViewportTitle);
auto viewPortTitleLayout = new QHBoxLayout();
viewPortTitleLayout->addWidget(viewPortTitleDlg);
ui->ViewportTitle->setLayout(viewPortTitleLayout);*/
QStringList fontSizeMockup = {"8pt", "9pt", "10pt", "11pt", "12pt", "14pt", "16pt", "18pt", "24pt", "30pt",};
QStringList viewZoomMockup = {"20", "32", "40", "80", "160", "240"};
const auto tbcbList = ui->toolButtonsComboBoxWidget->findChildren<AzQtComponents::ToolButtonComboBox*>();
foreach (auto tbcb, tbcbList) {
if (tbcb->objectName().contains("1")) {
tbcb->setIcon(QIcon(QStringLiteral(":/stylesheet/img/16x16/Font_text.png")));
tbcb->comboBox()->addItems(fontSizeMockup);
} else if (tbcb->objectName().contains("2")) {
tbcb->setIcon(QIcon(QStringLiteral(":/stylesheet/img/16x16/Picture_view.png")));
tbcb->comboBox()->addItems(viewZoomMockup);
} else if (tbcb->objectName().contains("3")) {
tbcb->setIcon(QIcon(QStringLiteral(":/stylesheet/img/16x16/List_view.png")));
tbcb->comboBox()->addItems(fontSizeMockup);
}
}
ui->WidgetHeader1->setForceInactive(true);
ui->WidgetHeader1->setButtons({ AzQtComponents::DockBarButton::DividerButton, AzQtComponents::DockBarButton::MaximizeButton,
AzQtComponents::DockBarButton::DividerButton, AzQtComponents::DockBarButton::CloseButton });
ui->WidgetHeader1->setWindowTitleOverride("Widget Header");
ui->WidgetHeader2->setButtons({AzQtComponents::DockBarButton::DividerButton, AzQtComponents::DockBarButton::MaximizeButton,
AzQtComponents::DockBarButton::DividerButton, AzQtComponents::DockBarButton::CloseButton});
ui->WidgetHeader2->setWindowTitleOverride("Widget Header");
ui->NonDockableWidget1->setForceInactive(true);
ui->NonDockableWidget1->setWindowTitleOverride("Non-Dockable Widget");
ui->NonDockableWidget1->setButtons({ AzQtComponents::DockBarButton::CloseButton });
ui->NonDockableWidget1->setTearEnabled(false);
ui->NonDockableWidget1->setDragEnabled(false);
ui->NonDockableWidget2->setWindowTitleOverride("Non-Dockable Widget");
ui->NonDockableWidget2->setButtons({ AzQtComponents::DockBarButton::CloseButton });
ui->NonDockableWidget2->setTearEnabled(false);
ui->NonDockableWidget2->setDragEnabled(false);
const auto rpbList = ui->RoundedButtonWidget->findChildren<QPushButton*>();
foreach (auto rpb, rpbList) {
if (rpb->objectName().contains("Small"))
rpb->setProperty("class", "smallRounded");
else
rpb->setProperty("class", "rounded");
}
ui->buttonOrange1->setProperty("class", "Primary");
ui->buttonOrange2->setProperty("class", "Primary");
ui->tabWidget->tabBar()->setTabsClosable(true);
connect(ui->tabWidget->tabBar(), &QTabBar::tabCloseRequested, this, [this](int index) {
ui->tabWidget->removeTab(index);
});
}
void MainWidget::initializeItemViews()
{
auto model = new QStandardItemModel(this);
model->setHorizontalHeaderLabels({QString(), tr("Priority"), tr("State"), tr("ID"), tr("Completed"), tr("Platform")});
for (int i = 0; i < 20; ++i) {
auto col0Item = new QStandardItem();
col0Item->setCheckState(Qt::Checked);
col0Item->setData(QVariant(QSize(10, 20)), Qt::SizeHintRole);
col0Item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
auto col1Item = new QStandardItem((i < 10) ? tr("Top"): "");
model->appendRow({
col0Item,
col1Item,
new QStandardItem(i == 0 ? tr("Running") : (i < 10 ? tr("Failed") : tr("Waiting"))),
new QStandardItem("Environnment/Sky/Cloud/Cloudy-cloud"),
new QStandardItem(QString::number(i)),
new QStandardItem(i % 2 ? tr("Android") : tr("iPhone"))
});
}
ui->treeView->setModel(model);
ui->treeView->setSortingEnabled(true);
ui->treeView->setColumnWidth(0, 50);
}
#include "StyleGallery/moc_mainwidget.cpp"
@@ -1,40 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef MAINWIDGET_H
#define MAINWIDGET_H
#if !defined(Q_MOC_RUN)
#include <QWidget>
#endif
namespace Ui {
class MainWidget;
}
class MainWidget : public QWidget
{
Q_OBJECT
public:
explicit MainWidget(QWidget *parent = 0);
~MainWidget();
protected:
void mouseReleaseEvent(QMouseEvent *event) override;
private:
void initializeControls();
void initializeItemViews();
signals:
void reloadCSS();
private:
Ui::MainWidget *ui;
};
#endif // MAINWIDGET_H
File diff suppressed because it is too large Load Diff
@@ -1,138 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="297mm"
viewBox="0 0 744.09448819 1052.3622047"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="triangles.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="31.678384"
inkscape:cx="175.07984"
inkscape:cy="551.37808"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="-8"
inkscape:window-y="58"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
sodipodi:type="star"
style="fill:#cccccc;fill-rule:evenodd;stroke:#9d9e9f;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1;opacity:1"
id="path3344"
sodipodi:sides="3"
sodipodi:cx="380"
sodipodi:cy="403.79077"
sodipodi:r1="243.10912"
sodipodi:r2="121.55456"
sodipodi:arg1="0.51623067"
sodipodi:arg2="1.5634282"
inkscape:flatsided="false"
inkscape:rounded="0"
inkscape:randomized="0"
d="M 591.42857,523.79077 380.89562,525.34203 170.36266,526.89329 274.28571,343.79077 378.20876,160.68825 484.81867,342.23951 Z"
inkscape:transform-center-x="0.016954397"
inkscape:transform-center-y="0.65189465"
transform="matrix(-0.01892764,0,0,-0.01086489,180.59057,495.21492)"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
sodipodi:type="star"
style="opacity:1;fill:#737475;fill-opacity:1;fill-rule:evenodd;stroke:#575859;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="path3344-5"
sodipodi:sides="3"
sodipodi:cx="380"
sodipodi:cy="403.79077"
sodipodi:r1="243.10912"
sodipodi:r2="121.55456"
sodipodi:arg1="0.51623067"
sodipodi:arg2="1.5634282"
inkscape:flatsided="false"
inkscape:rounded="0"
inkscape:randomized="0"
d="M 591.42857,523.79077 380.89562,525.34203 170.36266,526.89329 274.28571,343.79077 378.20876,160.68825 484.81867,342.23951 Z"
inkscape:transform-center-x="0.016954397"
inkscape:transform-center-y="0.65189465"
transform="matrix(-0.01892764,0,0,-0.01086489,185.09108,503.38349)"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
<path
sodipodi:type="star"
style="opacity:1;fill:#323334;fill-opacity:1;fill-rule:evenodd;stroke:#959595;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="path3344-5-8"
sodipodi:sides="3"
sodipodi:cx="380"
sodipodi:cy="403.79077"
sodipodi:r1="243.10912"
sodipodi:r2="121.55456"
sodipodi:arg1="0.51623067"
sodipodi:arg2="1.5634282"
inkscape:flatsided="false"
inkscape:rounded="0"
inkscape:randomized="0"
d="M 591.42857,523.79077 380.89562,525.34203 170.36266,526.89329 274.28571,343.79077 378.20876,160.68825 484.81867,342.23951 Z"
inkscape:transform-center-x="0.016954397"
inkscape:transform-center-y="0.65189465"
transform="matrix(-0.01892764,0,0,-0.01086489,170.507,509.8342)"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
inkscape:export-filename="C:\d\projects\amazon-style\img\triangle3.png" />
<path
sodipodi:type="star"
style="opacity:1;fill:#323334;fill-opacity:1;fill-rule:evenodd;stroke:#959595;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="path3344-5-1"
sodipodi:sides="3"
sodipodi:cx="380"
sodipodi:cy="403.79077"
sodipodi:r1="243.10912"
sodipodi:r2="121.55456"
sodipodi:arg1="0.51623067"
sodipodi:arg2="1.5634282"
inkscape:flatsided="false"
inkscape:rounded="0"
inkscape:randomized="0"
d="M 591.42857,523.79077 380.89562,525.34203 170.36266,526.89329 274.28571,343.79077 378.20876,160.68825 484.81867,342.23951 Z"
inkscape:transform-center-x="-0.0169559"
inkscape:transform-center-y="-0.65188753"
transform="matrix(0.01892764,0,0,0.01086489,156.12199,496.40855)"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
inkscape:export-filename="C:\d\projects\amazon-style\img\double_triangles.png" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 5.2 KiB

@@ -1,25 +0,0 @@
#
# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
set(FILES
StyleGallery/ConditionGroupWidget.cpp
StyleGallery/ConditionGroupWidget.h
StyleGallery/ConditionWidget.cpp
StyleGallery/ConditionWidget.h
StyleGallery/DeploymentsWidget.cpp
StyleGallery/DeploymentsWidget.h
StyleGallery/deploymentswidget.ui
StyleGallery/main.cpp
StyleGallery/mainwidget.cpp
StyleGallery/mainwidget.h
StyleGallery/mainwidget.ui
StyleGallery/MyCombo.cpp
StyleGallery/MyCombo.h
StyleGallery/ViewportTitleDlg.cpp
StyleGallery/ViewportTitleDlg.h
StyleGallery/ViewportTitleDlg.ui
)
+1 -19
View File
@@ -40,26 +40,8 @@ ly_add_target(
AZ::AzCore
)
# DEPRECATED: this target was marked as deprecated in the VS filter
ly_add_target(
NAME AmazonStyle APPLICATION
NAMESPACE AZ
AUTOMOC
AUTOUIC
FILES_CMAKE
AzQtComponents/azqtcomponents_style_files.cmake
INCLUDE_DIRECTORIES
PRIVATE
.
AzQtComponents
BUILD_DEPENDENCIES
PRIVATE
3rdParty::Qt::Widgets
AZ::AzQtComponents
)
ly_add_target(
NAME AmazonQtControlGallery APPLICATION
NAME O3DEQtControlGallery APPLICATION
NAMESPACE AZ
AUTOMOC
AUTOUIC
@@ -45,6 +45,7 @@
#include <AzToolsFramework/UI/UICore/QTreeViewStateSaver.hxx>
#include <AzToolsFramework/UI/UICore/QWidgetSavedState.h>
#include <AzToolsFramework/UI/UICore/ProgressShield.hxx>
#include <AzToolsFramework/UI/UICore/WidgetHelpers.h>
#include <AzToolsFramework/Slice/SliceUtilities.h>
#include <AzToolsFramework/ToolsComponents/EditorInspectorComponent.h>
#include <AzToolsFramework/API/ComponentEntityObjectBus.h>
@@ -1589,7 +1590,13 @@ namespace AzToolsFramework
// Multiple changes to the same entity are just split between different undo nodes.
for (AZ::EntityId entityId : m_dirtyEntities)
{
prefabPublicInterface->GenerateUndoNodesForEntityChangeAndUpdateCache(entityId, m_currentBatchUndo);
auto outcome = prefabPublicInterface->GenerateUndoNodesForEntityChangeAndUpdateCache(entityId, m_currentBatchUndo);
if (!outcome.IsSuccess())
{
QMessageBox::warning(
AzToolsFramework::GetActiveWindow(), QString("Error"), QString(outcome.GetError().c_str()), QMessageBox::Ok, QMessageBox::Ok);
}
}
}
}
@@ -587,21 +587,21 @@ namespace AzToolsFramework
return AZ::Success(entityId);
}
void PrefabPublicHandler::GenerateUndoNodesForEntityChangeAndUpdateCache(
PrefabOperationResult PrefabPublicHandler::GenerateUndoNodesForEntityChangeAndUpdateCache(
AZ::EntityId entityId, UndoSystem::URSequencePoint* parentUndoBatch)
{
// Create Undo node on entities if they belong to an instance
InstanceOptionalReference owningInstance = m_instanceEntityMapperInterface->FindOwningInstance(entityId);
if (!owningInstance.has_value())
{
return;
return AZ::Success();
}
AZ::Entity* entity = GetEntityById(entityId);
if (!entity)
{
m_prefabUndoCache.PurgeCache(entityId);
return;
return AZ::Success();
}
PrefabDom beforeState;
@@ -633,6 +633,41 @@ namespace AzToolsFramework
(&beforeOwningInstance->get() != &afterOwningInstance->get()))
{
isNewParentOwnedByDifferentInstance = true;
// Detect loops. Assert if an instance has been reparented in such a way to generate circular dependencies.
AZStd::vector<Instance*> instancesInvolved;
if (isInstanceContainerEntity)
{
instancesInvolved.push_back(&owningInstance->get());
}
else
{
// Retrieve all nested instances that are part of the subtree under the current entity.
EntityList entities;
RetrieveAndSortPrefabEntitiesAndInstances({ entity }, beforeOwningInstance->get(), entities, instancesInvolved);
}
for (Instance* instance : instancesInvolved)
{
const PrefabDom& templateDom =
m_prefabSystemComponentInterface->FindTemplateDom(instance->GetTemplateId());
AZStd::unordered_set<AZ::IO::Path> templatePaths;
PrefabDomUtils::GetTemplateSourcePaths(templateDom, templatePaths);
if (IsCyclicalDependencyFound(afterOwningInstance->get(), templatePaths))
{
// Cancel the operation by restoring the previous parent
AZ::TransformBus::Event(entityId, &AZ::TransformBus::Events::SetParent, beforeParentId);
m_prefabUndoCache.UpdateCache(entityId);
// Skip the creation of an undo node
return AZ::Failure(AZStd::string::format(
"Reparent Prefab operation aborted - Cyclical dependency detected\n(%s depends on %s).",
instance->GetTemplateSourcePath().Native().c_str(),
afterOwningInstance->get().GetTemplateSourcePath().Native().c_str()));
}
}
}
}
@@ -673,6 +708,8 @@ namespace AzToolsFramework
}
m_prefabUndoCache.UpdateCache(entityId);
return AZ::Success();
}
void PrefabPublicHandler::Internal_HandleContainerOverride(
@@ -46,7 +46,7 @@ namespace AzToolsFramework
PrefabOperationResult SavePrefab(AZ::IO::Path filePath) override;
PrefabEntityResult CreateEntity(AZ::EntityId parentId, const AZ::Vector3& position) override;
void GenerateUndoNodesForEntityChangeAndUpdateCache(AZ::EntityId entityId, UndoSystem::URSequencePoint* parentUndoBatch) override;
PrefabOperationResult GenerateUndoNodesForEntityChangeAndUpdateCache(AZ::EntityId entityId, UndoSystem::URSequencePoint* parentUndoBatch) override;
bool IsInstanceContainerEntity(AZ::EntityId entityId) const override;
bool IsLevelInstanceContainerEntity(AZ::EntityId entityId) const override;
@@ -79,8 +79,9 @@ namespace AzToolsFramework
*
* @param entityId The entity to patch.
* @param parentUndoBatch The undo batch the undo nodes should be parented to.
* @return Returns Success if the node was generated correctly, or an error message otherwise.
*/
virtual void GenerateUndoNodesForEntityChangeAndUpdateCache(
virtual PrefabOperationResult GenerateUndoNodesForEntityChangeAndUpdateCache(
AZ::EntityId entityId, UndoSystem::URSequencePoint* parentUndoBatch) = 0;
/**
@@ -46,10 +46,11 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
}
}
template<typename EntityPtr>
void OrganizeEntitiesForSorting(
AzFramework::Spawnable::EntityList& entities,
AZStd::vector<EntityPtr>& entities,
AZStd::unordered_set<AZ::EntityId>& existingEntityIds,
AZStd::unordered_map<AZ::EntityId, AzFramework::Spawnable::EntityList>& parentIdToChildren,
AZStd::unordered_map<AZ::EntityId, AZStd::vector<EntityPtr>>& parentIdToChildren,
AZStd::vector<AZ::EntityId>& candidateIds,
size_t& removedEntitiesCount)
{
@@ -90,7 +91,7 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
// entities with no transform component will be treated like entities with no parent.
AZ::EntityId parentId;
if (AZ::TransformInterface* transformInterface =
AZ::EntityUtils::FindFirstDerivedComponent<AZ::TransformInterface>(entity.get()))
AZ::EntityUtils::FindFirstDerivedComponent<AZ::TransformInterface>(&(*entity)))
{
parentId = transformInterface->GetParentId();
if (parentId == entityId)
@@ -104,8 +105,7 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
}
auto& children = parentIdToChildren[parentId];
children.emplace_back(nullptr);
children.back().swap(entity);
children.emplace_back(AZStd::move(entity));
}
// clear 'entities', we'll refill it in sorted order.
@@ -125,9 +125,10 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
}
template<typename EntityPtr>
void TraceParentingLoop(
const AZ::EntityId& parentFromLoopId,
const AZStd::unordered_map<AZ::EntityId, AzFramework::Spawnable::EntityList>& parentIdToChildren)
const AZStd::unordered_map<AZ::EntityId, AZStd::vector<EntityPtr>>& parentIdToChildren)
{
// Find name to use in warning message
@@ -153,16 +154,22 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
parentFromLoopId.ToString().c_str());
}
void SortEntitiesByTransformHierarchy(AzFramework::Spawnable& spawnable)
{
auto& entities = spawnable.GetEntities();
SortEntitiesByTransformHierarchy(spawnable.GetEntities());
}
template<typename EntityPtr>
void SortEntitiesByTransformHierarchy(AZStd::vector<EntityPtr>& entities)
{
const size_t originalEntityCount = entities.size();
// IDs of those present in 'entities'. Does not include parent ID if parent not found in 'entities'
AZStd::unordered_set<AZ::EntityId> existingEntityIds;
// map children by their parent ID (even if parent not found in 'entities')
AZStd::unordered_map<AZ::EntityId, AzFramework::Spawnable::EntityList> parentIdToChildren;
AZStd::unordered_map<AZ::EntityId, AZStd::vector<EntityPtr>> parentIdToChildren;
// use 'candidateIds' to track the parent IDs we're going to process next.
AZStd::vector<AZ::EntityId> candidateIds;
@@ -199,8 +206,7 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
for (auto& child : foundChildren->second)
{
candidateIds.push_back(child->GetId());
entities.emplace_back(nullptr);
entities.back().swap(child);
entities.emplace_back(AZStd::move(child));
}
parentIdToChildren.erase(foundChildren);
@@ -217,4 +223,7 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
}
// Explicit specializations of SortEntitiesByTransformHierarchy (have to be in cpp due to clang errors)
template void SortEntitiesByTransformHierarchy(AZStd::vector<AZ::Entity*>& entities);
template void SortEntitiesByTransformHierarchy(AZStd::vector<AZStd::unique_ptr<AZ::Entity>>& entities);
} // namespace AzToolsFramework::Prefab::SpawnableUtils
@@ -16,4 +16,8 @@ namespace AzToolsFramework::Prefab::SpawnableUtils
bool CreateSpawnable(AzFramework::Spawnable& spawnable, const PrefabDom& prefabDom, AZStd::vector<AZ::Data::Asset<AZ::Data::AssetData>>& referencedAssets);
void SortEntitiesByTransformHierarchy(AzFramework::Spawnable& spawnable);
template <typename EntityPtr>
void SortEntitiesByTransformHierarchy(AZStd::vector<EntityPtr>& entities);
} // namespace AzToolsFramework::Prefab::SpawnableUtils
@@ -87,24 +87,24 @@ AzToolsFramework--EntityOutlinerCheckBox#VisibilityMixed::indicator:checked
AzToolsFramework--EntityOutlinerCheckBox#Visibility::indicator:checked
, AzToolsFramework--EntityOutlinerCheckBox#VisibilityMixed::indicator:checked
{
image: url(:/visibility_default.svg);
image: url(:/Outliner/visibility_default.svg);
}
AzToolsFramework--EntityOutlinerCheckBox#Visibility::indicator:unchecked
, AzToolsFramework--EntityOutlinerCheckBox#VisibilityMixed::indicator:unchecked
{
image: url(:/visibility_on.svg);
image: url(:/Outliner/visibility_on.svg);
margin-top: 3px;
}
AzToolsFramework--EntityOutlinerCheckBox#VisibilityOverridden::indicator:checked
{
image: url(:/visibility_default_transparent.svg);
image: url(:/Outliner/visibility_default_transparent.svg);
}
AzToolsFramework--EntityOutlinerCheckBox#VisibilityOverridden::indicator:unchecked
{
image: url(:/visibility_on_transparent.svg);
image: url(:/Outliner/visibility_on_transparent.svg);
margin-top: 3px;
}
@@ -112,7 +112,7 @@ AzToolsFramework--EntityOutlinerCheckBox#VisibilityHover::indicator:checked
, AzToolsFramework--EntityOutlinerCheckBox#VisibilityMixedHover::indicator:checked
, AzToolsFramework--EntityOutlinerCheckBox#VisibilityOverriddenHover::indicator:checked
{
image: url(:/visibility_default_hover.svg);
image: url(:/Outliner/visibility_default_hover.svg);
margin-top: 3px;
}
@@ -120,7 +120,7 @@ AzToolsFramework--EntityOutlinerCheckBox#VisibilityHover::indicator:unchecked
, AzToolsFramework--EntityOutlinerCheckBox#VisibilityMixedHover::indicator:unchecked
, AzToolsFramework--EntityOutlinerCheckBox#VisibilityOverriddenHover::indicator:unchecked
{
image: url(:/visibility_on_hover.svg);
image: url(:/Outliner/visibility_on_hover.svg);
margin-top: 3px;
}
@@ -130,24 +130,24 @@ AzToolsFramework--EntityOutlinerCheckBox#VisibilityHover::indicator:unchecked
AzToolsFramework--EntityOutlinerCheckBox#Lock::indicator:checked
, AzToolsFramework--EntityOutlinerCheckBox#LockMixed::indicator:checked
{
image: url(:/lock_on.svg);
image: url(:/Outliner/lock_on.svg);
margin-top: 1px;
}
AzToolsFramework--EntityOutlinerCheckBox#Lock::indicator:unchecked
, AzToolsFramework--EntityOutlinerCheckBox#LockMixed::indicator:unchecked
{
image: url(:/lock_default.svg);
image: url(:/Outliner/lock_default.svg);
}
AzToolsFramework--EntityOutlinerCheckBox#LockOverridden::indicator:checked
{
image: url(:/lock_on_transparent.svg);
image: url(:/Outliner/lock_on_transparent.svg);
}
AzToolsFramework--EntityOutlinerCheckBox#LockOverridden::indicator:unchecked
{
image: url(:/lock_default_transparent.svg);
image: url(:/Outliner/lock_default_transparent.svg);
margin-top: 1px;
}
@@ -155,7 +155,7 @@ AzToolsFramework--EntityOutlinerCheckBox#LockHover::indicator:checked
, AzToolsFramework--EntityOutlinerCheckBox#LockMixedHover::indicator:checked
, AzToolsFramework--EntityOutlinerCheckBox#LockOverriddenHover::indicator:checked
{
image: url(:/lock_on_hover.svg);
image: url(:/Outliner/lock_on_hover.svg);
margin-top: 1px;
}
@@ -163,6 +163,6 @@ AzToolsFramework--EntityOutlinerCheckBox#LockHover::indicator:unchecked
, AzToolsFramework--EntityOutlinerCheckBox#LockMixedHover::indicator:unchecked
, AzToolsFramework--EntityOutlinerCheckBox#LockOverriddenHover::indicator:unchecked
{
image: url(:/lock_default_hover.svg);
image: url(:/Outliner/lock_default_hover.svg);
margin-top: 1px;
}
@@ -17,15 +17,15 @@ namespace AzToolsFramework
DisplayOptionsMenu::DisplayOptionsMenu(QWidget* parent)
: QMenu(parent)
{
auto sortManually = addAction(QIcon(QStringLiteral(":/sort_manually.svg")), tr("Sort: Manually"));
auto sortManually = addAction(QIcon(QStringLiteral(":/Outliner/sort_manually.svg")), tr("Sort: Manually"));
sortManually->setData(static_cast<int>(DisplaySortMode::Manually));
sortManually->setCheckable(true);
auto sortAtoZ = addAction(QIcon(QStringLiteral(":/sort_a_to_z.svg")), tr("Sort: A to Z"));
auto sortAtoZ = addAction(QIcon(QStringLiteral(":/Outliner/sort_a_to_z.svg")), tr("Sort: A to Z"));
sortAtoZ->setData(static_cast<int>(DisplaySortMode::AtoZ));
sortAtoZ->setCheckable(true);
auto sortZtoA = addAction(QIcon(QStringLiteral(":/sort_z_to_a.svg")), tr("Sort: Z to A"));
auto sortZtoA = addAction(QIcon(QStringLiteral(":/Outliner/sort_z_to_a.svg")), tr("Sort: Z to A"));
sortZtoA->setData(static_cast<int>(DisplaySortMode::ZtoA));
sortZtoA->setCheckable(true);
@@ -36,18 +36,29 @@ namespace AzToolsFramework
{
}
bool EntityOutlinerSearchTypeSelector::filterItemOut(int unfilteredDataIndex, bool itemMatchesFilter, bool categoryMatchesFilter)
bool EntityOutlinerSearchTypeSelector::filterItemOut(const QModelIndex& sourceIndex, bool filteredByBase)
{
bool unfilteredIndexInvalid = (unfilteredDataIndex >= aznumeric_cast<int>(EntityOutlinerSearchWidget::GlobalSearchCriteria::FirstRealFilter));
return SearchTypeSelector::filterItemOut(unfilteredDataIndex, itemMatchesFilter, categoryMatchesFilter) && unfilteredIndexInvalid;
auto* currItem = m_model->itemFromIndex(sourceIndex);
if (currItem != nullptr)
{
int unfilteredIndex = getUnfilteredDataIndex(currItem);
if (unfilteredIndex >= 0 && unfilteredIndex < aznumeric_cast<int>(EntityOutlinerSearchWidget::GlobalSearchCriteria::FirstRealFilter))
{
// never filter out the categories before FirstRealFilter (unlocked/locked, visible/hidden, etc.)
return false;
}
}
// no special case, return the result of the base filter
return filteredByBase;
}
void EntityOutlinerSearchTypeSelector::initItem(QStandardItem* item, const AzQtComponents::SearchTypeFilter& filter, int unfilteredDataIndex)
{
if (filter.displayName != "--------")
SearchTypeSelector::initItem(item, filter, unfilteredDataIndex);
if (filter.displayName == "--------")
{
item->setCheckable(true);
item->setCheckState(filter.enabled ? Qt::Checked : Qt::Unchecked);
SearchTypeSelector::initItem(item, filter, unfilteredDataIndex);
item->setCheckable(false);
}
if (unfilteredDataIndex < aznumeric_cast<int>(EntityOutlinerSearchWidget::GlobalSearchCriteria::FirstRealFilter))
@@ -39,8 +39,8 @@ namespace AzToolsFramework
EntityOutlinerSearchTypeSelector(QWidget* parent = nullptr);
protected:
// can be used to override the logic when adding items in RepopulateDataModel
bool filterItemOut(int unfilteredDataIndex, bool itemMatchesFilter, bool categoryMatchesFilter) override;
// override the logic of accepting filter categories
bool filterItemOut(const QModelIndex& sourceIndex, bool filteredByBase) override;
void initItem(QStandardItem* item, const AzQtComponents::SearchTypeFilter& filter, int unfilteredDataIndex) override;
int GetNumFixedItems() override;
};
@@ -48,6 +48,12 @@
#include <AzToolsFramework/UI/Outliner/ui_EntityOutlinerWidget.h>
// This has to live outside of any namespaces due to issues on Linux with calls to Q_INIT_RESOURCE if they are inside a namespace
void initEntityOutlinerWidgetResources()
{
Q_INIT_RESOURCE(resources);
}
namespace
{
const int queuedChangeDelay = 16; // milliseconds
@@ -143,6 +149,8 @@ namespace AzToolsFramework
, m_sortContentQueued(false)
, m_dropOperationInProgress(false)
{
initEntityOutlinerWidgetResources();
m_gui = new Ui::EntityOutlinerWidgetUI();
m_gui->setupUi(this);