Re: [Issue N14793] Unexpected behavior in QButton::setPixmap

[email protected]
Newsgroups gmane.comp.kde.devel.atlantik
Message-ID <[email protected]>
Hi Rob,

On Tuesday, 21. Jan 2003 11:12 Rob Kaper wrote:

> Calling QButton::setPixmap() multiple times on the same object has
> some unexpected results. The button will show both images and gains
> height, instead of replacing the previous pixmap with the new one.
>
> Reproducable on several platforms and configurations. I can provide
> the specifics for mine later today (workstation is off-line at the
> moment, no wake-on-LAN).

I can't reproduce this problem here, can you try the following example
and see if it reproduces the problem for you?  Thanks.

#include <qapplication.h>
#include <qpushbutton.h>

const char *test1_xpm[] = {
    "12 8 2 1",
	". c None",
	"c c #ff0000",
	".........ccc",
	"........ccc.",
	".......ccc..",
	"ccc...ccc...",
	".ccc.ccc....",
	"..ccccc.....",
	"...ccc......",
	"....c.......",
};

const char *test2_xpm[] = {
    "12 8 2 1",
	". c None",
	"c c #ff0000",
	"ccc......ccc",
	".ccc....ccc.",
	"..ccc..ccc..",
	"....cc.cc...",
	".....ccc....",
	"....cc.cc...",
	"...ccc.ccc..",
	"..ccc...ccc.",
};

int main( int argc, char **argv )
{
    QApplication a( argc, argv );
    QPushButton testWidget( 0 );
    a.setMainWidget( &testWidget );
    testWidget.show();
    QPixmap p(test1_xpm);
    testWidget.setPixmap( p );
    QPixmap p2( test2_xpm );
    for ( int b = 0; b<5; b++ )
	testWidget.setPixmap( p2 );
    return a.exec();
}


If it doesn't reproduce your problem then can you modify the example so
it reproduces the problem for you?  Thanks.

Have a nice day!

Andy
--
Technicial Support Technician
Trolltech AS, Waldemar Thranes gate 98, NO-0175 Oslo, Norway
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.