PDA

View Full Version : show the backgroundpixmap of QMenuBar??-Qt-3.3.6



bigbigmoon
3rd April 2007, 08:00
hello,everyone!
I have a problem between Qt-3.3.5 and Qt-3.3.6 .
the codes like these:


QPixmap app_Normal;
app_Normal.convertFromImage(app_normal);
menuwgt=new QFrame(this) ;
menu1=new DMenuBar(menuwgt) ;
menu1->setPaletteBackgroundPixmap(app_Normal);

it runs well when it's under FC5 ,but doesn't show the backgroundPixmap when in FC6,
I don't know what's the problem with it??????

it uses QT-3.3.5 in FC5 but QT-3.3.6 in FC6.

Thanks

high_flyer
3rd April 2007, 08:54
did you check if app_normal isNull()? (QImage)

bigbigmoon
3rd April 2007, 09:01
it runs well in Fedora5 ,(show the app_Normal)

high_flyer
3rd April 2007, 09:02
No, I meant with FC6

bigbigmoon
3rd April 2007, 09:46
I tried with other pixmap which is showing in other widget;

logoutbtn=new QLabel(this );
logoutbtn->setPaletteBackgroundPixmap(logoutbg);
the code works well,
so I tried to use the "logoutbg" ,but it didn't show the pixmap ,??

bigbigmoon
3rd April 2007, 09:55
I tried in FC6

high_flyer
3rd April 2007, 10:50
I have trouble understanding what you tried where.
Anyhow, it looks to me like you have a path problem.
Make sure the path to your image is correct.
What kind of image is it?
Are you sure Qt is configured to support that format on the system where you have the problem?
How do you load the image - directly or do use use an image collection?
Please use the code tags for code.

bigbigmoon
3rd April 2007, 12:49
I tried the codes in FC6 :
code:
.......
#include "../imagesource/app_hover.xpm"
........

QPixmap app_Normal;
app_Normal.convertFromImage(app_normal);
QFile debugFile("/root/debughuiqin.txt");
if( debugFile.open(IO_Append | IO_WriteOnly) )
{
QTextStream debugOut( &debugFile );
if(app_Normal.isNull())
debugOut<<"this is a null pixmap"<<endl;
else debugOut<<"this is not a null pixmap"<<endl;
debugFile.close();
}


menuwgt=new QFrame(this) ;
menu1=new QMenuBar(menuwgt) ;
menu1->setPaletteBackgroundPixmap(app_Normal);

the result is "this is not a null pixmap"


thank you for your reply

bigbigmoon
3rd April 2007, 12:52
I tried the codes in FC6 :
code:


.......
#include "../imagesource/app_hover.xpm"
........

QPixmap app_Normal;
app_Normal.convertFromImage(app_normal);
QFile debugFile("/root/debughuiqin.txt");
if( debugFile.open(IO_Append | IO_WriteOnly) )
{
QTextStream debugOut( &debugFile );
if(app_Normal.isNull())
debugOut<<"this is a null pixmap"<<endl;
else debugOut<<"this is not a null pixmap"<<endl;
debugFile.close();
}


menuwgt=new QFrame(this) ;
menu1=new QMenuBar(menuwgt) ;
menu1->setPaletteBackgroundPixmap(app_Normal);

the result is "this is not a null pixmap"


thank you for your reply

high_flyer
3rd April 2007, 13:01
What are you are trying to do?
I think you are complecating things too much.
Please post the code where you initilize your QImage, and the absolute paths of your project executable and of the image.

bigbigmoon
4th April 2007, 03:45
Sorry , I don't think it's wrong with the picture (app_Normal),which I want to show as the
background of the widget QMenuBar menu1.
What I tried is to prove this .

And I tried to test whether the function setPaletteBackground(QPixmap) works ,too. The result is that it works well.

Thank you for your reply!