Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.12.3, 5.12.4, 5.12.5, 5.13.0
-
None
Description
In my application I postponed index widgets creation for QTableView. In the next example left margin (from stylesheet) will be applied after resize the view or after reset qss after insertion index widgets by:
v->style()->unpolish(v); v->style()->polish(v);
Example:
#include <QApplication> #include <QTableView> #include <QLabel> #include <QStringListModel> #include <QStringList> int main(int argc, char *argv[]) { QApplication a(argc, argv); QTableView* v = new QTableView(); v->setStyleSheet("QTableView::item\ {\ border: none;\ padding: 0px;\ margin: 0px 30px;\ }"); v->show(); QStringListModel* m= new QStringListModel();; QStringList list; for (int i=0; i<10; ++i) list.append(""); m->setStringList(list); v->setModel(m); a.processEvents();
*/mandatory too call two times at least/*
a.processEvents(); for (int i=0; i<m->rowCount(); ++i){ v->setIndexWidget(m->index(i,0), new QLabel("uuid", v)); } return a.exec(); }
before resize:
after resize: