Using FreezeTableWidget in QTableWidget
Unsolved
General and Desktop
-
class QCustomTableView : public QTableWidget { Q_OBJECT private: QHeaderView* m_pVertiHeaderview; QHeaderView* m_pHoriHeaderview; QCustomScrollBar* m_pVerticalScrollbar; Qt::Orientation m_Orientation; FreezeTableWidget* m_pTableView; public: QCustomTableView(QObject* parent); QCustomTableView(Qt::Orientation orientation, QObject *parent); ~QCustomTableView(); void Initialize(); void InitializeStylesheet(); void InitializeTableView(); void SetTableHeader(QStringList strlist); }; void QCustomTableView::InitializeTableView() { QStandardItemModel* Item = new QStandardItemModel(); QStringList list; list << "fix1"; Item->setHorizontalHeaderLabels(list); m_pTableView = new FreezeTableWidget(Item); //QTableView* a = new QTableView(this); this->viewport()->stackUnder(m_pTableView); //this->viewport()->stackUnder(a); this->setShowGrid(true); }
I want to use FreezeTableWidget in QTableWidget, but it doesn't work well. It looks like we're making another freeze table in the table widget, but I don't know why not.
-
Hi,
Are you trying to use the frozen column example as a base ?
On a side note:
@IknowQT said in Using FreezeTableWidget in QTableWidget:
class QCustomTableView : public QTableWidget
You should avoid using Q as your own class prefix as this is misleading in terms of where that class comes from.
Also, you are subclassing QTableWidget and not QTableView so your subclass is name is again misleading.