Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can I do something to titlebar style, except standard stuff
Forum Updated to NodeBB v4.3 + New Features

Can I do something to titlebar style, except standard stuff

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vyivrain
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      billconan
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Vyivrain
        wrote on last edited by
        #3

        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?

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          zeljko
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • V Offline
            V Offline
            Vyivrain
            wrote on last edited by
            #5

            Sounds more understandable, thx.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved