QT and Background Pixmaps

Richard Moore rich at ipso-facto.freeserve.co.uk
Sun Oct 17 19:24:25 BST 1999



Robert.M.Wheat at fara3.cs.uni-potsdam.de, "Jr." wrote:
> 
> Hello,
> 
> I am having a problem with QT and Background Pixmaps.
> 
> I have learned that I must first 'qInitImageIO()', include <qimageio.h>, and link to the proper
> libraries before I can use jpeg or png files for Pixmaps using QT.  No problem!  I can set the
> backgroung Pixmap for my main widget with no problem.  My problem is with the background pixmap on
> buttons (and perhaps other widgets).  The background pixmap that I set any button to appears for
> only the amount of time it takes to draw the entire widget (that the button is part of) and then
> goes back to the same old gray color.
> 
> Any ideas on what I'm doing wrong?

>From the QWidget docs:

void QWidget::setBackgroundMode ( BackgroundMode m ) [virtual]
Tells the window system which color to clear this widget to when sending a
paint event. 

In other words, this color is the color of the widget when paintEvent() is
called. To minimize flicker, this should be the most common color in the
widget. 

The fill functions of the colorgroup returns Brushes, which may be either a
plain color or a pixmap. 

If setBackgroundPixmap() or setBackgroundColor() is called, the mode will be
one of: 

FixedPixmap - the pixmap set by setBackgroundPixmap() 
FixedColor - the color set by setBackgroundColor() 

So, you need to call setBackgroundMode( FixedPixmap );

Cheers

Rich.

> 
> Thanx,
> --
> Robert M. Wheat, Jr.
> belran at worldnet.ibm.net

-- 
     Richard Moore		rich at ipso-facto.freeserve.co.uk
http://www.robocast.com/	richard at robocast.com
http://developer.kde.org/	rich at kde.org




More information about the KDevelop mailing list