Hi All,

I have made a QTableView with 200 rows and 4 columns.. but the column header are invisible and here is my code snippet.

toolform.cpp
Qt Code:
  1. ToolForm::ToolForm(QDialog *parent, Qt::WindowFlags f)
  2. : QDialog( parent, f)
  3. {
  4. setupUi(this);
  5. setupModel();
  6. setupViews();
  7. init();
  8. }
  9.  
  10. ToolForm::~ToolForm()
  11. {
  12. }
  13.  
  14. void ToolForm::init()
  15. {
  16.  
  17. }
  18. void ToolForm::setupModel()
  19. {
  20. model = new QStandardItemModel(200, 4, this);
  21. model->setHeaderData(0, Qt::Horizontal, tr("NUMBER"));
  22. model->setHeaderData(1, Qt::Horizontal, tr("DIAMETER"));
  23. model->setHeaderData(2, Qt::Horizontal, tr("LENGTH"));
  24. model->setHeaderData(3, Qt::Horizontal, tr("UNITS"));
  25. }
  26.  
  27. void ToolForm::setupViews()
  28. {
  29. QTableView *tooltableView = new QTableView;
  30. tooltableView->setModel(model);
  31. QItemSelectionModel *selectionModel = new QItemSelectionModel(model);
  32. tooltableView->setSelectionModel(selectionModel);
  33. }
To copy to clipboard, switch view to plain text mode 

toolform.h
Qt Code:
  1. #ifndef TOOLFORM_H
  2. #define TOOLFORM_H
  3.  
  4. #include <QVariant>
  5. #include <QDialog>
  6.  
  7. #include "ui_toolform.h"
  8.  
  9.  
  10.  
  11. class ToolForm : public QDialog, private Ui::ToolForm
  12. {
  13. Q_OBJECT
  14.  
  15. public:
  16. ToolForm( QDialog* parent = 0, Qt::WindowFlags f = Qt::FramelessWindowHint);
  17. ~ToolForm();
  18.  
  19. private:
  20.  
  21. void setupModel();
  22. void setupViews();
  23. void init();
  24.  
  25. QItemSelectionModel *selectionModel;
  26. };
  27.  
  28. #endif // TOOLFORM_H
To copy to clipboard, switch view to plain text mode 

How to resolve this issue.