Stylesheet with tableView
-
Hi! I'm new with stylesheet with QT design.
I don't know how to color the contour line of the tableview in the middle. I don't want to color the contour line header.
Actually, i have this:
But when i write this : border: 2px outset rgb(85, 170, 127) ; on the stylesheet of the tableview in the middle, I get this (which is not what I want):
I want to remove the color around the vertical and horitontal header.
I don't want to set 2px on the header also. -
Hi
"I want to remove the color around the vertical and horitontal header."
Like this ? so it flat ?
-
Hi
Directly on the table widget should be fine. -
Oh okay! I will figure out how to use Selectors. I got a last question. I actually have this:
I want to use this color to some cells of the tableview like this:
Of course, there is an error. I don't know how to put this particular color into some cell of my tableview. Thanks again!
-
Hi
Its explained here with selectors
https://doc.qt.io/qt-5/stylesheet-examples.html#complex-selector-example--
The syntax is a bit different for QLinearGradient when outside a stylesheet
https://doc.qt.io/qt-5/qlineargradient.html
You can use it via a brush
QLinearGradient linearGrad(QPointF(0, 0), QPointF(100, 100)); linearGrad.setColorAt(0, Qt::white); linearGrad.setColorAt(0.5, Qt::green); linearGrad.setColorAt(1, Qt::black); QBrush b(linearGrad); ui->tableWidget->item(0, 0)->setBackground(b);