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);
prepareTableView();
prepareTreeView();
auto tm = new TreeModel();
tm->showSelectedLog(nullptr);
ui->treeView->setModel(tm);
@ -40,3 +41,9 @@ void MainWindow::prepareTableView()
QHeaderView::ResizeMode::ResizeToContents);
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:
void prepareTableView();
void prepareTreeView();
Ui::MainWindow* ui;
};

Loading…
Cancel
Save