change color/focus in qtablewidget
I try to explain my doubt.
I have six tables (6 qtablewidget) and a button.
When I push the button, it executes some code and I would like that the focus of the six tables goes to a determinate row,col and the color of the row change.
Is that possible? Could you give some help?
Many thanks and sorry for my english!
Re: change color/focus in qtablewidget
You will need to subclass the QTAbleWdget and add some variable for the row/col you want to change the color of.
Then use delegate to change the color of the row/col
When you click the button, perform your actions and then update the variable
Re: change color/focus in qtablewidget
Re: change color/focus in qtablewidget
Thanks
I try:
Code:
tabla->setVerticalHeaderItem(3, hitem); // item is placed on the header of row r
tabla->setHorizontalHeaderItem(1, hitem);
tabla->setItem(1,1,hitem);
If I do this, the verticalheader and the horizontalHeader changes the color but the cell (1,1) doesnt change.
Any help?
EDIT
--------------------
Well, I do it.
tabla->item(estara-1,0)->setBackground(QBrush(hola.fromHsv(0,75,255,255) ))
The other question.
The tablewidget is short, so when my program finds the appropiate cell I would like to the table moves automatically to this cell. This is possible?
Many thanks and sorry for my english!
Re: change color/focus in qtablewidget
Re: change color/focus in qtablewidget
Or even use a style sheet.
Code:
tableview.setStyleSheet("background-color: wathevercolor")
Re: change color/focus in qtablewidget
To set the background color of selected text or item:
Code:
mytableWidget.setStyleSheet(selection-background-color : acolor")
Re: change color/focus in qtablewidget
Quote:
Originally Posted by
toutarrive
To set the background color of selected text or item:
Code:
mytableWidget.setStyleSheet(selection-background-color : acolor")
if i want to change the row's background which i selected with a image? how should i do?