Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using FreezeTableWidget in QTableWidget
Forum Updated to NodeBB v4.3 + New Features

Using FreezeTableWidget in QTableWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 221 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    IknowQT
    wrote on last edited by
    #1
    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved