-
Notifications
You must be signed in to change notification settings - Fork 0
/
boxwidget.h
47 lines (39 loc) · 1.12 KB
/
boxwidget.h
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
#ifndef BOWWIDGET_H
#define BOWWIDGET_H
#include <QWidget>
#include <QDomDocument>
template <typename T>
void packTabs(T *stacked) {
for(int i=0; i<stacked->count(); i++) {
stacked->widget(i)->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
}
QWidget *widget=stacked->currentWidget();
widget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
widget->resize(widget->minimumSizeHint());
widget->adjustSize();
stacked->resize(stacked->minimumSizeHint());
stacked->adjustSize();
}
class boxWidget : public QWidget
{
Q_OBJECT
public:
explicit boxWidget(QWidget *parent = nullptr);
QString getId() { return id; }
virtual void buildXml(QDomDocument& doc) = 0;
private:
bool mouseInWidget = false;
protected:
QString id;
bool checkId(QString newId);
void sendToPort(QString str);
private slots:
void labelMoveClicked(Qt::MouseButton b);
void labelDelClicked(Qt::MouseButton b);
void enterEvent(QEvent * event);
void leaveEvent(QEvent * event);
// void mouseMoveEvent(QMouseEvent * event);
signals:
public slots:
};
#endif // BOWWIDGET_H