QtCau
7th December 2015, 15:14
Hey,
I try to change the color behind the Headers in a QTableView.
I mean, when I expand the window and the table has more space than I need to display all rows/coloumns there is a white beam beside my last coloum/ under my last row, that doesn't fit to the rest of the colors.
Thank you in advance.
d_stranz
7th December 2015, 19:37
You could try setting the QHeaderView's QPalette entry for the Window ColorRole to match the Button ColorRole:
QHeaderView * pHV = myTableView->horizontalHeader();
QPalette pal = pHV->palette();
pal.setBrush( QPalette::Window, pal.brush( QPalette::Button ) );
pHV->setPalette( pal );
Untested, so no idea if it will work. You could also simply stretch the last column to use up the remaining space:
QHeaderView * pHV = myTableView->horizontalHeader();
pHV->setStretchLastSection( true );
QtCau
8th December 2015, 07:57
At the Moment my QTableView Stylesheet looks like this:
/**********TableView**********/
QTableView::enabled{
background-color:lightgrey;
border: 2px solid grey;
border-radius : 4px;
padding: 0 8px;
color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 black,
stop: 1 grey);
}
QTableView::!enabled{
background-color:lightgrey;
border: 2px solid grey;
border-radius : 4px;
padding: 0 8px;
color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0
lightgrey, stop: 1 grey);
}
QHeaderView::section:enabled{
background-color : qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 grey, stop: 1 black);
color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0
lightblue, stop: 1 rgb(93,191,212));
}
QHeaderView::section:!enabled{
background-color :qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 grey, stop: 1 white);
color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 black,
stop: 1 grey);
}
and I hoped that there is a possibility to include the ground behind the header in this stylesheet.
QtCau
19th January 2016, 13:35
I found the solution.
I just had to add
QWidget{
background-color: ???
}
and change these Objects to default, that had been changed automatically by changing QWidget. (Like Line-Edit Background)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.