How to add application logo to QMenuBar



  • Hi Professionals,

    I wonder if i can add a small logo picture to QMenuBar, like in the picture.
    !http://dl.dropbox.com/u/7750653/QMenuBar_Logo.bmp(MySql Workbench Oracle Logo)!

    I tried to set icons for QMenu & QAction, but the logo picture looks very very small, like in the picture.
    !http://dl.dropbox.com/u/7750653/QMenuBar_Logo_Icon.bmp(QMenu QAction Icons)!

    Thanks.



  • Easiest way, I think, is to simply subclass QMenuBar, and reimplement the paint() method. First let the baseclass do the hard work, and then render the image over the bar on the right-hand side. Of course, you will need to take care that it does not overlap the menu items themselves, but perhaps you can use the stylesheet padding-right property to ensure there is space left over for the image.



  • You have to cut your text with opacity, after this, probably your pic will be shown in a right way.



  • bq. You have to cut your text with opacity, after this, probably your pic will be shown in a right way.

    Can you give more details on how to achieve this.

    Thanks Andre, i will try with your solutions and post back.



  • [quote author="Anas Al-Taji" date="1347288686"]Hi Professionals,

    I wonder if i can add a small logo picture to QMenuBar, like in the picture.
    !http://dl.dropbox.com/u/7750653/QMenuBar_Logo.bmp(MySql Workbench Oracle Logo)!

    I tried to set icons for QMenu & QAction, but the logo picture looks very very small, like in the picture.
    !http://dl.dropbox.com/u/7750653/QMenuBar_Logo_Icon.bmp(QMenu QAction Icons)!
    [/quote]

    But it seems, the logo is in a tab bar and the menu bar is part of the tab widget, right?



  • [quote author="Anas Al-Taji" date="1347346824"]bq. You have to cut your text with opacity, after this, probably your pic will be shown in a right way.

    Can you give more details on how to achieve this.
    [/quote]

    Use GIMP or Photoshop. Save your pic in png format. Png can be made as transparent.



  • bq. Use GIMP or Photoshop. Save your pic in png format. Png can be made as transparent.

    Unfortunately i used Gimp and PNG format with transparent with no luck. i think the problem is the default icon size for QMenu and QAction, but what if we can add QLabel to QMenuBar in some way.!!

    bq. But it seems, the logo is in a tab bar and the menu bar is part of the tab widget, right?

    You are right Gerolf, it seems like tab bar, but what if we want to do it with QMenuBar?

    Gerolf, i learned too much from you already, but this is the first time i talk to you directly, so please accept my regards.


Log in to reply
 

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