Skip to end of metadata
Go to start of metadata

Overview:

Icons:

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:

  • Make sure a top level prefix named "\icons" is defined for all icons.
  • Any icon file in the QRC should have an alias property that should be equivalent to the path but without the initial icon's folder.
  • When referencing a file in the QRC, the path should look like this: "icons:CategoryFolder/MyIcon.ico" and not "Icons/CategoryFolder/MyIcon.ico". Both will seem like they work but the first will allow our designers to work on the icons without needing to generate an executable of the editor every time they change an icon.

For more info on the Qt Resource System, please refer here.

Styling & Colors:

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.

Styling FAQ:

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
{
    colorred;
    background-color: yellow;
}

Yes, you can reference direct children by doing the following:

 

MyCustomWidget > TargetWidget
{
    colorred;
    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
{
    colorred;
    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-colorred;
}
Yes, our EditorStyleHelper class defines many common properties to be used all across editor and plugins. Feel free to expose properties here if you think they'll be useful to standardize across the editor as well.
  • No labels