[Qt-interest] Menu Bar - Drawing back ground

Santhosh Y santhosh at softjin.com
Tue Jun 30 09:35:22 CEST 2009


Hi

I want to set a  background-pix map to menu Bar.

I am doing the following:
class MenuBar : public QMenuBar
{
    Q_OBJECT
    public:
        // constructor
        MenuBar (QWidget* parent) : QMenuBar (parent)    {    }


    protected:
        void paintEvent (QPaintEvent* e)
        {
            QPainter painter(this);
            painter.drawPixmap(QRect(0,0, 1440,28), 
QPixmap(":/images/BG_Header.png"), QRect(0,0, 1440,28));

           // calling menu bar paintevent
            QMenuBar::paintEvent(e);  // commenting this only showing 
the above pixmap drawn
        }
};


The problem with the above code is that, pixmap is drawn in case default 
paintevent is commented; If it is commented all the menu bar actions are 
not being shown.

What is the solution for this.
Have to draw background for tool bar at the same time I need to shown 
background-image.

Please suggest a solution for this! OR  any different approach using 
style sheet.

-- 
----------------------------------------------------
Y Santhosh Kumar
Senior Software Engineer
SoftJin Technologies Private Limited
Unit No. 102, Mobius Tower,
I Floor, SJR I - Park,
EPIP, White Field,
Bangalore - 560066, India
U : www.softjin.com
E : santhosh at softjin.com
T : +91-80-41779999
M : +91-9740535265
----------------------------------------------------



Business Disclaimer
____________________________________________________________
This e-mail message and any files transmitted with it are intended solely
for  the use  of the  individual or entity  to which they  are  addressed. It
may  contain confidential,  proprietary or legally  privileged  information.
If  you  are  not  the  intended recipient please be advised that you have
received  this  message in error and any use is strictly prohibited. Please
immediately  delete it  and all copies of it from your system, destroy any
hard  copies  of  it and  notify  the  sender  by return mail. You must not,
directly or indirectly, use,  disclose,  distribute, print, or copy any part of
this message if you are not the intended recipient.
___________________________________________________________





More information about the Qt-interest-old mailing list