Mercurial > minori
comparison src/gui/pages/anime_list.cpp @ 68:2417121d894e
*: normalize usage of layouts
before, I used them two ways, once was by setting the layout later
by using setLayout(QWidget), and the other was just using the constructor.
I find the constructor to be easier to read, so I chose that one.
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Mon, 02 Oct 2023 21:33:25 -0400 |
parents | 26721c28bf22 |
children | 27a19dd6cba1 |
comparison
equal
deleted
inserted
replaced
67:442065432549 | 68:2417121d894e |
---|---|
449 sort_models[i]->setSortRole(Qt::UserRole); | 449 sort_models[i]->setSortRole(Qt::UserRole); |
450 sort_models[i]->setSortCaseSensitivity(Qt::CaseInsensitive); | 450 sort_models[i]->setSortCaseSensitivity(Qt::CaseInsensitive); |
451 } | 451 } |
452 tree_view->setModel(sort_models[0]); | 452 tree_view->setModel(sort_models[0]); |
453 | 453 |
454 QHBoxLayout* layout = new QHBoxLayout; | 454 QHBoxLayout* layout = new QHBoxLayout(tree_widget); |
455 layout->addWidget(tree_view); | 455 layout->addWidget(tree_view); |
456 layout->setContentsMargins(0, 0, 0, 0); | 456 layout->setContentsMargins(0, 0, 0, 0); |
457 tree_widget->setLayout(layout); | |
458 | 457 |
459 /* Double click stuff */ | 458 /* Double click stuff */ |
460 connect(tree_view, &QAbstractItemView::doubleClicked, this, &AnimeListPage::ItemDoubleClicked); | 459 connect(tree_view, &QAbstractItemView::doubleClicked, this, &AnimeListPage::ItemDoubleClicked); |
461 connect(tree_view, &QWidget::customContextMenuRequested, this, &AnimeListPage::DisplayListMenu); | 460 connect(tree_view, &QWidget::customContextMenuRequested, this, &AnimeListPage::DisplayListMenu); |
462 | 461 |