Icons are created white/gray scale and tinted when using our own CryIcon. The required format for all icons is .ico and multiple resolutions should be provided within the same file. All icons are embedded into the executable using qt resource files (.qrc). Our main QRC file can be found at Code/Sandbox/Plugins/EditorCommon/EditorCommon.qrc. When using this resource file or creating a new one, please follow the following steps:
For more info on the Qt Resource System, please refer here.
Styling in the editor is achieved through QSS style sheets. There is a single file that controls the style of the whole editor. It can be found in Editor/Styles/stylesheet.qss. The use of QPalette for styling is prohibited since it conflicts with the use of style sheets. Palette colors are defined in QSS and can be accessed through EditorStyleHelper.
For a full list of objects and properties that can be styled, please look at the Qss Reference.
If this happens then it means you must override the paintEvent on your widget, it should look something like this:
1 2 3 4 5 6 | void MyCustomWidget::paintEvent(QPaintEvent* pEvent) { QStyleOption opt; opt.init( this ); QPainter p( this ); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this ); } |
Yes, you would need to reference the widget like this:
MyCustomWidget TargetWidget { color : red ; background-color : yellow; } |
Yes, you can reference direct children by doing the following:
MyCustomWidget > TargetWidget { color : red ; background-color : yellow; } |
If you have something like the following:
1 2 3 4 5 6 7 8 9 | class MyWidget : public QWidget { Q_OBJECT public : class MyOtherWidget : public QWidget { ... }; ... }; |
You would access my other widget properties in QSS by doing the following:
MyWidget--MyOtherWidget { color : red ; background-color : yellow }
|
Here's how you can do this:
1 2 3 4 5 6 7 8 9 10 | class MyCustomWidget : public QWidget { Q_PROPERTY( float awesomeness READ GetAwesomeness WRITE SetAwesomeness DESIGNABLE true ) public : ... float GetAwesomeness() { return awesomeness; } void SetAwesomeness( float newValue) { awesomeness = newValue; } ... private : float awesomeness; } |
And designers can then access that property through QSS by doing this:
MyCustomWidget { qproperty-awesomeness: 0 ; } |
1 2 3 4 | QLineEdit[readOnly= "true" ] { color : yellow; background-color : red ; } |