Solved How to hide cellWidget of QTableWidget?
-
How can I hide a cellWidget of (row,column) in QTableWidget?
this->cellWidget(0, 6)->hide();
this->cellWidget(0, 6)->setVisible(false);I called these two methods both no use.
-
Hi. This seems to be a bug, still unresolved.
For a possible workaround, have a look at
https://stackoverflow.com/questions/33492837/qtablecellwidget-is-not-hiding -
Thanks, could you pls give the sample code snippet of the solution ?
-
If it is really a bug you can check on JIRA using the same account as here in the forum. JIRA is the only place where bugs have to be reported to.
Neither the forum here nor any other place is monitored for potential bugs. If it is not reported, it can't be fixed. -
@koahnig said in How to hide cellWidget of QTableWidget?:
If it is not reported, it can't be fixed.
This is a long-standing bug which has been reported several times already (some of which have been closed as duplicates, like this one: https://bugreports.qt.io/browse/QTBUG-22490.).
-
@brucezcg said in How to hide cellWidget of QTableWidget?:
could you pls give the sample code snippet of the solution ?
The proposed solution is in the link I provided. Apparently, you must subclass
QTableWidget
and override thepaintEvent()
method to hide the cells every time after the actual painting is done.DerivedQTableWidget::paintEvent(QPaintEvent * e) { QTableWidget::paintEvent(e); // do the hiding here }
I have not tested this though...
-