##// END OF EJS Templates
Fix hardcorded icon size for save and discard tool button
perrinel -
r1372:79bf37fd2aff
parent child
Show More
@@ -25,9 +25,6
25 25
26 26 Q_LOGGING_CATEGORY(LOG_CatalogueEventsWidget, "CatalogueEventsWidget")
27 27
28 /// Fixed size of the validation column
29 const auto VALIDATION_COLUMN_SIZE = 35;
30
31 28 /// Percentage added to the range of a event when it is displayed
32 29 const auto EVENT_RANGE_MARGE = 30; // in %
33 30
@@ -449,11 +446,9 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
449 446 ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::Tags,
450 447 QHeaderView::Stretch);
451 448 ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::Validation,
452 QHeaderView::Fixed);
449 QHeaderView::ResizeToContents);
453 450 ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::Name,
454 451 QHeaderView::Interactive);
455 ui->treeView->header()->resizeSection((int)CatalogueEventsModel::Column::Validation,
456 VALIDATION_COLUMN_SIZE);
457 452 ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::TStart,
458 453 QHeaderView::ResizeToContents);
459 454 ui->treeView->header()->setSectionResizeMode((int)CatalogueEventsModel::Column::TEnd,
@@ -515,6 +510,8 void CatalogueEventsWidget::setEventChanges(const std::shared_ptr<DBEvent> &even
515 510 emitSelection();
516 511 });
517 512 ui->treeView->setIndexWidget(validationIndex, widget);
513 ui->treeView->header()->resizeSection((int)CatalogueEventsModel::Column::Validation,
514 QHeaderView::ResizeToContents);
518 515 }
519 516 }
520 517 else {
@@ -3,7 +3,6
3 3 #include <QBoxLayout>
4 4 #include <QToolButton>
5 5
6 const auto VALIDATION_BUTTON_ICON_SIZE = 12;
7 6
8 7 QWidget *CatalogueExplorerHelper::buildValidationWidget(QWidget *parent, std::function<void()> save,
9 8 std::function<void()> discard)
@@ -11,22 +10,21 QWidget *CatalogueExplorerHelper::buildValidationWidget(QWidget *parent, std::fu
11 10 auto widget = new QWidget{parent};
12 11
13 12 auto layout = new QHBoxLayout{widget};
14 layout->setContentsMargins(0, 0, 0, 0);
15 layout->setSpacing(0);
16 13
17 14 auto btnValid = new QToolButton{widget};
18 15 btnValid->setIcon(QIcon{":/icones/save"});
19 btnValid->setIconSize(QSize{VALIDATION_BUTTON_ICON_SIZE, VALIDATION_BUTTON_ICON_SIZE});
20 16 btnValid->setAutoRaise(true);
21 17 QObject::connect(btnValid, &QToolButton::clicked, save);
22 18 layout->addWidget(btnValid);
23 19
24 20 auto btnDiscard = new QToolButton{widget};
25 21 btnDiscard->setIcon(QIcon{":/icones/discard"});
26 btnDiscard->setIconSize(QSize{VALIDATION_BUTTON_ICON_SIZE, VALIDATION_BUTTON_ICON_SIZE});
27 22 btnDiscard->setAutoRaise(true);
28 23 QObject::connect(btnDiscard, &QToolButton::clicked, discard);
29 24 layout->addWidget(btnDiscard);
30 25
26 layout->setContentsMargins(0, 0, 0, 0);
27 layout->setSpacing(0);
28
31 29 return widget;
32 30 }
@@ -111,7 +111,8 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent)
111 111
112 112 ui->treeView->header()->setStretchLastSection(false);
113 113 ui->treeView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
114 ui->treeView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
114 ui->treeView->header()->setSectionResizeMode((int)CatalogueTreeModel::Column::Name,
115 QHeaderView::Stretch);
115 116
116 117 connect(ui->treeView, &QTreeView::clicked, this, &CatalogueSideBarWidget::emitSelection);
117 118 connect(ui->treeView->selectionModel(), &QItemSelectionModel::currentChanged, this,
@@ -416,6 +417,8 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::setHasChanges(
416 417 }
417 418 });
418 419 sideBarWidget->ui->treeView->setIndexWidget(validationIndex, widget);
420 sideBarWidget->ui->treeView->header()->resizeSection(
421 (int)CatalogueTreeModel::Column::Validation, QHeaderView::ResizeToContents);
419 422 }
420 423 }
421 424 else {
General Comments 0
You need to be logged in to leave comments. Login now