PDA

View Full Version : Setting Backgroung Image to VerticalHeaderItem of QTableWidget



abhiabcl
19th January 2011, 12:49
Hi,
I'm trying to set background image to VerticalHeaderItem of QTableWidget. Its working fine on windows. but same code not showing image on ubuntu10.10. I'm using qt4 with qt creater 2.0. Here is my code sample:
************************************************** **********************
QTableWidgetItem* channelLogoItm = new QTableWidgetItem();
channelLogoItm->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter );
QPixmap pixmap(ImgArrayPath[i]);

QBrush brush(pixmap);
brush.setStyle(Qt::SolidPattern);
channelLogoItm->setBackground(brush);

tblChannels->setVerticalHeaderItem(i,channelLogoItm);
************************************************** ***************************

even i try to set background and foreground of QTableWidgetItem, but its also not working with verticalHeaderItem but same code is working fine when i try with TableItem:

************************************************** ***********************************
channelLogoItm->setBackgroundColor(Qt::black);
channelLogoItm->setForeground(Qt::red);
channelLogoItm->setText("test...");
************************************************** ***********************************


Please if any one help me. please do...

Thanks
AV