[Qt-interest] about 64bit qt's stylesheet & Q_PROPERTY

iptton iptton at gmail.com
Mon Apr 20 16:10:22 CEST 2009


Done...

the problem's qt4.3.4 doesn't support css namespace selector like this:
(fxgui is namespace.)

fxgui--FxWidget{

 xxxx

}

after setting the every widget I need an objectname of the widget the
problem's disappeared.

#mainWindow{

xxxx

}

2009/4/20 iptton <iptton at gmail.com>

> After mark a break point . I found the function setBackground never been
> called...
>
> 2009/4/20 iptton <iptton at gmail.com>
>
>> hi all.
>>
>>   When I use QT's stylesheet:   qproperty-<object name> to set the
>> widget's background:
>>
>> It works on 32bit system drawing
>>
>> But in 64bit qt4.3.4,it seems that backgroundPixmap never been initialed.
>>
>> code like below:
>>
>> CSS file:
>>
>> #mainWindow{
>>
>> qproperty-backgroundImage:url("./skin1/mainpanel.bmp");
>>
>> }
>>
>> C++:
>>
>> void FxWidget::resizeEvent(QResizeEvent *event){
>>  QWidget::resizeEvent(event);
>>  if( !backgroundPixmap.isNull() )
>>   setBackground(backgroundPixmap);
>> }
>> void FxWidget::setBackground(QPixmap pix){
>>  QPalette palette;
>>   backgroundPixmap = pix;
>>   QImage image =
>> pix.toImage();//("./skin1/mainpanel_window_windowbkg.bmp");
>>   int left=65,right=130,bottom=58,top=135;
>>   QPixmap bgTop(width(),height());
>>   QPainter painter(&bgTop);
>>
>> // balabala
>>
>>    // scale the image to 9 pixel
>>
>>   palette.setBrush(this->backgroundRole(),QBrush(bgTop));
>>   this->setPalette(palette);
>>
>> }
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090420/3f620832/attachment.html 


More information about the Qt-interest-old mailing list