-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoolsbar.cpp
38 lines (29 loc) · 1.06 KB
/
toolsbar.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "toolsbar.h"
#include <QPushButton>
ToolsBar::ToolsBar(QWidget *parent) : QWidget(parent)
{
mainGridLayout = new QGridLayout(this);
QPushButton *deleteButton = new QPushButton(this);
deleteButton->setIcon(QIcon(":/images/delete.png"));
connect(deleteButton, &QPushButton::clicked, this, &ToolsBar::onDeleteButtonClicked);
mainGridLayout->setColumnStretch(0, 1);
mainGridLayout->setColumnStretch(1, 1);
mainGridLayout->setColumnStretch(2, 1);
mainGridLayout->setSpacing(0);
mainGridLayout->setContentsMargins(10, 0, 10, 0);
mainGridLayout->addWidget(deleteButton, 0, 2, Qt::AlignRight | Qt::AlignVCenter);
this->setLayout(mainGridLayout);
this->setContentsMargins(0, 0, 0, 0);
}
void ToolsBar::addLeftWidget(QWidget *leftWidget)
{
mainGridLayout->addWidget(leftWidget, 0, 0, Qt::AlignLeft | Qt::AlignVCenter);
}
void ToolsBar::addCenterWidget(QWidget *centerWidget)
{
mainGridLayout->addWidget(centerWidget, 0, 1, Qt::AlignCenter);
}
void ToolsBar::onDeleteButtonClicked()
{
emit deleteButtonClicked();
}