PDA

View Full Version : problems with setbackgroundcolor of tablewidgetItem



cfalcioni
3rd May 2012, 14:04
Hi all,

I create an application with qt4.7
I'm using a QTableWidget (tableData) and I define his property runtime.

Here I define a header


void AnaResults::SetHeaderRow(int row, QString dato)
{
QTableWidgetItem *newItem = new QTableWidgetItem();
newItem->setData(0,dato);
const QColor color(76,123,200);
newItem->setBackgroundColor(color);
newItem->setSizeHint(QSize(280,20));
ui->tableData->setVerticalHeaderItem(row,newItem);

}


all it's ok!

But when I install the application on another pc, the color of the alls headers is wrong!!!
Do I missing some .dll on installation package???? I didn't find it!!!!

thans for help or suggestions!!

Claudia

Spitfire
9th May 2012, 12:51
On what OS you're developing and on what OS you're installing your app?
Maybe the target OS is taking over styling of the table headers?

Aslo, what you mean "all headers is wrong"? Is the color there but not the one you've set?
You could show screenshot of how it is and how it should be for us to better understand your problem.

cfalcioni
15th May 2012, 12:05
Hi..

I tested my app in a differrent PC but in same OS of the developing (XP), the result is the same, the table is wrong.

I show you the different tables:

Here the RIGHT table in my developing pc (XP) (release version):

7721

Here the WRONG table in a different PC (XP without qt application) (release version) --PC2--:

7722


I tried to save in the PC2 different qt dlls in the path of my application .. without to resolve the problem. Now I don't What I have do!!

THANKS

Spitfire
15th May 2012, 13:05
Hmmm odd.

Try using stylesheets:


tableWidget->setStyleSheet(
"QHeaderView:section{ background-color: rgb(108, 82, 255); }\n"
"QTableCornerButton::section{ background-color: rgb(108, 82, 255); }"
);


For more information on what and how you can style take a look here (http://qt-project.org/doc/qt-4.8/stylesheet-examples.html#customizing-qheaderview) and here (http://qt-project.org/doc/qt-4.8/stylesheet-examples.html#customizing-qtableview).

cfalcioni
24th May 2012, 13:54
Hi,
I solved my question with stlylesheets..

thanks