How to alter perimeter around a QTableWidget cell?
-
If I want to add a bottom border line, or a left, right, or top border line, is that possible with a cell in a QTableWidget?
-
Hi
Well using a delegate , you can draw the text your self and also
extra lines, however, you have to also control the editing as for it to not break
when going into edit mode.https://forum.qt.io/topic/117896/conditional-borders-on-qtablewidget-cells
-
If I want to add a bottom border line, or a left, right, or top border line, is that possible with a cell in a QTableWidget?
@Publicnamer
I don't know what @mrjj thinks, and whether this would avoid the editing issue, but you could also do it from stylesheet viaQTableView::item { border-top/right/bottom/left: 1px solid red; }
But this is easiest if you want to change all cells' borders, not so much if you want to be selective.
-
@Publicnamer
I don't know what @mrjj thinks, and whether this would avoid the editing issue, but you could also do it from stylesheet viaQTableView::item { border-top/right/bottom/left: 1px solid red; }
But this is easiest if you want to change all cells' borders, not so much if you want to be selective.
@JonB It seems like a lot of processing to have an interpreter parse a style sheet. Isn't there a more native, C++ way to set the borders?
-
@JonB It seems like a lot of processing to have an interpreter parse a style sheet. Isn't there a more native, C++ way to set the borders?
@Publicnamer said in How to alter perimeter around a QTableWidget cell?:
It seems like a lot of processing to have an interpreter parse a style sheet.
Seriously? Qt widgets has stylesheets, with its interpreter, used in hundreds/thousands(?) of applications. It's what I would use for choice rather than writing code. But entirely up to you. If you do want to write some C++ code to do the job you have @mrjj's suggestion to pursue.
-
@Publicnamer said in How to alter perimeter around a QTableWidget cell?:
It seems like a lot of processing to have an interpreter parse a style sheet.
Seriously? Qt widgets has stylesheets, with its interpreter, used in hundreds/thousands(?) of applications. It's what I would use for choice rather than writing code. But entirely up to you. If you do want to write some C++ code to do the job you have @mrjj's suggestion to pursue.
@JonB Yes seriously. Of course seriously. A good engineer always designs code to run well on slow computers. Interpreters are frequently bulky memory hogs that cause computers to slow down.
-
@JonB Yes seriously. Of course seriously. A good engineer always designs code to run well on slow computers. Interpreters are frequently bulky memory hogs that cause computers to slow down.
Hi
Premature optimization is also a topic you should consider.Stylesheets are not inherently slow but if overused can become heavy.
They are parsed on load and values are set to internal structures used by QStyle.
So its not Interpretered over and over.