@@ -37,9 +37,12 VisualizationGraphWidget::VisualizationGraphWidget(const QString &name, QWidget | |||||
37 | { |
|
37 | { | |
38 | ui->setupUi(this); |
|
38 | ui->setupUi(this); | |
39 |
|
39 | |||
40 | // qcpplot title |
|
40 | ui->graphNameLabel->setText(name); | |
41 | ui->widget->plotLayout()->insertRow(0); |
|
41 | ||
42 | ui->widget->plotLayout()->addElement(0, 0, new QCPTextElement{ui->widget, name}); |
|
42 | // 'Close' options : widget is deleted when closed | |
|
43 | setAttribute(Qt::WA_DeleteOnClose); | |||
|
44 | connect(ui->closeButton, &QToolButton::clicked, this, &VisualizationGraphWidget::close); | |||
|
45 | ui->closeButton->setIcon(sqpApp->style()->standardIcon(QStyle::SP_TitleBarCloseButton)); | |||
43 |
|
46 | |||
44 | // Set qcpplot properties : |
|
47 | // Set qcpplot properties : | |
45 | // - Drag (on x-axis) and zoom are enabled |
|
48 | // - Drag (on x-axis) and zoom are enabled | |
@@ -90,12 +93,7 bool VisualizationGraphWidget::canDrop(const Variable &variable) const | |||||
90 |
|
93 | |||
91 | QString VisualizationGraphWidget::name() const |
|
94 | QString VisualizationGraphWidget::name() const | |
92 | { |
|
95 | { | |
93 | if (auto title = dynamic_cast<QCPTextElement *>(ui->widget->plotLayout()->elementAt(0))) { |
|
96 | return ui->graphNameLabel->text(); | |
94 | return title->text(); |
|
|||
95 | } |
|
|||
96 | else { |
|
|||
97 | return QString{}; |
|
|||
98 | } |
|
|||
99 | } |
|
97 | } | |
100 |
|
98 | |||
101 | void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange &t2) |
|
99 | void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange &t2) |
@@ -15,7 +15,58 | |||||
15 | </property> |
|
15 | </property> | |
16 | <layout class="QVBoxLayout" name="verticalLayout"> |
|
16 | <layout class="QVBoxLayout" name="verticalLayout"> | |
17 | <item> |
|
17 | <item> | |
18 |
<widget class="Q |
|
18 | <widget class="QWidget" name="infobar" native="true"> | |
|
19 | <layout class="QHBoxLayout" name="horizontalLayout_2"> | |||
|
20 | <property name="leftMargin"> | |||
|
21 | <number>0</number> | |||
|
22 | </property> | |||
|
23 | <property name="topMargin"> | |||
|
24 | <number>0</number> | |||
|
25 | </property> | |||
|
26 | <property name="rightMargin"> | |||
|
27 | <number>0</number> | |||
|
28 | </property> | |||
|
29 | <property name="bottomMargin"> | |||
|
30 | <number>0</number> | |||
|
31 | </property> | |||
|
32 | <item> | |||
|
33 | <widget class="QLabel" name="graphNameLabel"> | |||
|
34 | <property name="styleSheet"> | |||
|
35 | <string notr="true">font: 75 9pt "MS Shell Dlg 2";</string> | |||
|
36 | </property> | |||
|
37 | <property name="text"> | |||
|
38 | <string>TextLabel</string> | |||
|
39 | </property> | |||
|
40 | <property name="textFormat"> | |||
|
41 | <enum>Qt::AutoText</enum> | |||
|
42 | </property> | |||
|
43 | <property name="alignment"> | |||
|
44 | <set>Qt::AlignCenter</set> | |||
|
45 | </property> | |||
|
46 | </widget> | |||
|
47 | </item> | |||
|
48 | <item> | |||
|
49 | <widget class="QToolButton" name="closeButton"> | |||
|
50 | <property name="styleSheet"> | |||
|
51 | <string notr="true">background-color: transparent;</string> | |||
|
52 | </property> | |||
|
53 | <property name="text"> | |||
|
54 | <string>Close</string> | |||
|
55 | </property> | |||
|
56 | </widget> | |||
|
57 | </item> | |||
|
58 | </layout> | |||
|
59 | </widget> | |||
|
60 | </item> | |||
|
61 | <item> | |||
|
62 | <widget class="QCustomPlot" name="widget" native="true"> | |||
|
63 | <property name="sizePolicy"> | |||
|
64 | <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> | |||
|
65 | <horstretch>0</horstretch> | |||
|
66 | <verstretch>0</verstretch> | |||
|
67 | </sizepolicy> | |||
|
68 | </property> | |||
|
69 | </widget> | |||
19 | </item> |
|
70 | </item> | |
20 | </layout> |
|
71 | </layout> | |
21 | </widget> |
|
72 | </widget> |
General Comments 0
You need to be logged in to leave comments.
Login now