Browse Source

Resize header of treeview to size of content

basic-view
Ali Hatami Tajik 5 months ago
parent
commit
a7f29123bf
  1. 7
      gui/view/MainWindow.cpp
  2. 2
      gui/view/MainWindow.h

7
gui/view/MainWindow.cpp

@ -11,6 +11,7 @@ MainWindow::MainWindow(QWidget* parent)
{ {
ui->setupUi(this); ui->setupUi(this);
prepareTableView(); prepareTableView();
prepareTreeView();
auto tm = new TreeModel(); auto tm = new TreeModel();
tm->showSelectedLog(nullptr); tm->showSelectedLog(nullptr);
ui->treeView->setModel(tm); ui->treeView->setModel(tm);
@ -40,3 +41,9 @@ void MainWindow::prepareTableView()
QHeaderView::ResizeMode::ResizeToContents); QHeaderView::ResizeMode::ResizeToContents);
ui->tableView->horizontalHeader()->setSectionsMovable(true); ui->tableView->horizontalHeader()->setSectionsMovable(true);
} }
/*************************************************************************************************/
void MainWindow::prepareTreeView()
{
ui->treeView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
}

2
gui/view/MainWindow.h

@ -20,6 +20,8 @@ public:
private: private:
void prepareTableView(); void prepareTableView();
void prepareTreeView();
Ui::MainWindow* ui; Ui::MainWindow* ui;
}; };

Loading…
Cancel
Save