Let’s continue our previous blog post regarding preferences window. Of course it looks great and native look-and-feel on Mac, but what about having styles for both platforms to make user feel comfortably. I tried to apply Firefox-like style of preferences window, you can see screenshot above.

Code:

#ifdef Q_WS_MAC
setUnifiedTitleAndToolBarOnMac(true);
toolBar->setIconSize(QSize(32,32));
toolBar->setStyleSheet("\
    QToolBar { margin: 0px; padding: 0px; spacing 3px; border: 0px;}\
    QToolButton { border: 0px; } \
    QToolButton:checked {\
        background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,\
        stop: 0 #bbbbbb, stop: 0.5 #808080, stop: 1 #959595);\
    }");
#else
toolBar->setIconSize(QSize(32,32));
toolBar->setStyleSheet("\
    QToolBar { background-color: #f8f8f8; \
        margin: 0px; padding: 0px; spacing: 10px; \
        border: 1px solid #808080; \
        border-top: 0px; \
        border-left: 0px; \
        border-right: 0px; \
    } \
    QToolButton { \
        min-width: 40px; \
        border: 1px solid #808080; \
        border-top: 0px; \
        border-left: 0px; \
        border-right: 0px; \
    } \
    QToolButton:checked {\
        background-color: #c0d0e8;\
    }");
#endif