Can I do something to titlebar style, except standard stuff



  • Hello. I have a question about library QStyle. As I can't find libraries such as QWindowStyle( although my OS is a Window ). F.e. I found some enums about setIcon in QStyle QStyle::SP_TitleBarMinButton and others in the same place. And there's an somewhat an example on stackoverflow:
    @class MyProxyStyle : public QProxyStyle
    {
    Q_OBJECT

    public:
    MyProxyStyle(QStyle *style = 0) : QProxyStyle(style) { }

    public slots:
    QIcon standardIconImplementation(StandardPixmap standardIcon,
    const QStyleOption *option = 0,
    const QWidget *widget = 0) const
    {
    // check the standardIcon parameter for the icon type
    if (standardIcon==QStyle::SP_DesktopIcon)
    {
    // return your new icon here
    standardIcon = QStyle::SP_DirIcon;
    }
    return QProxyStyle::standardIconImplementation(standardIcon, option, widget);
    }
    };
    // set new style for your widget
    setStyle(new MyProxyStyle(style()));
    // return different icon for QStyle::SP_DesktopIcon
    action0->setIcon(style()->standardIcon(QStyle::SP_DesktopIcon));
    @
    I don't think, I need to extend QProxyStyle, but the main question, is that I want to change something in titlebar( color, pixmap, add some new pixmap ), because I heard somewhere, that you can't do anything directly to titlebar. Too little information on this topic on the internet.



  • I don't think you can style the titlebar easily. it's provided by the operating system.

    I usually create a frameless window and create fake titlebar instead.



  • Ok, I tried to do like that, but how can you connect 2 windows, so it displays as one and I had stuck into a problem , that some functionality just didn't work, using the mechanics of slots and signals between two window instances?



  • Why 2 windows ? You should create one window and add widget (eg. QFrame) to top of it with fixed height and then draw title bar on it.



  • Sounds more understandable, thx.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.