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