-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelementbutton.cpp
52 lines (42 loc) · 1.54 KB
/
elementbutton.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "elementbutton.h"
#include "mainwindow.h"
#include <QDebug>
ElementButton::ElementButton(QWidget *parent) : QWidget(parent)
{
qDebug() << "element button constructor";
p_central_widget = new QPushButton;
p_central_layout = new QVBoxLayout;
setLayout(p_central_layout);
p_central_layout->addWidget(p_central_widget);
p_central_layout->setMargin(0);
p_central_layout->setSpacing(0);
p_central_widget->setFixedWidth(190);
p_central_widget->setFixedHeight(MainWindow::element_buttons_height);
setFixedHeight(MainWindow::element_buttons_height);
p_central_widget->setCursor(Qt::OpenHandCursor);
p_central_layout->setAlignment(Qt::AlignCenter);
p_central_widget->setStyleSheet("border : 1px solid black; border-radius : 15px; background-color: rgba(255, 255, 255, 0);");
connect(p_central_widget, SIGNAL(clicked(bool)), SLOT(elementButtonClicked()));
}
void ElementButton::setPairWidget(ElementInfoWidget *pair)
{
qDebug() << "button set pair widget " << pair->objectName();
p_pair_widget = pair;
}
void ElementButton::elementButtonClicked()
{
qDebug("element button clicked");
qDebug() << p_pair_widget->objectName();
emit sendPairWidget(p_pair_widget);
}
void ElementButton::setText(QString text)
{
qDebug() << "button set text " << text;
p_central_widget->setText(text);
button_text = text;
}
bool element_buttons_compare(ElementButton* b1, ElementButton* b2)
{
qDebug() << "element buttons compare";
return b1->button_text < b2->button_text ? true : false;
}