Solved Zooming QTableView
-
Then you have to resize your header sizes accordingly.
-
yes but I want to ask something.
Is there any other way to do zooming instead of changing fonts? -
No, not that I'm aware of.
-
I am asking this, because Icons and pixmaps in the decoration role does not change with the change of the font. image sizes also should change with zooming
-
@DzCode
Hi
You could maybe subclass HeaderView and overwrite paintSection
do your own image and text scaling.Do you also need the actual cells to scale this way ?
You could add your own delegate and scale images and text too. -
I am resizing the images inside a proxymodel now.
However, there is one thing left to solve my all problems.
I am using checkstaterole of my model to make some columns checkable. There is problem about resizing them. I dont want to replace them with QCheckBox. I created checboxes with the help of the Qt::ItemIsUserCheckable flag. How can I resize them?
-
@DzCode
hi
Ok that sounds good too.I have never tried to style the "checkable" but I think you can control it with a delegate and
https://doc.qt.io/qt-5/qitemdelegate.html#drawCheckUpdate: nope, it wont care if given bigger or smaller rect.
bascially it boils down to
style->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck, &opt, painter, widget); -
-
@DzCode
Good work. So even using stylesheets it zooms fast enough ? -
@mrjj I didnt test it with chrono since I didnt have a time to, but for user perspective, there is no problem if you have less table