##// END OF EJS Templates
Removes title and close button from graph widget...
Alexandre Leroux -
r665:6a98c66c04c4
parent child
Show More
@@ -28,11 +28,15 const auto VERTICAL_ZOOM_MODIFIER = Qt::ControlModifier;
28
28
29 struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate {
29 struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate {
30
30
31 explicit VisualizationGraphWidgetPrivate()
31 explicit VisualizationGraphWidgetPrivate(const QString &name)
32 : m_DoAcquisition{true}, m_IsCalibration{false}, m_RenderingDelegate{nullptr}
32 : m_Name{name},
33 m_DoAcquisition{true},
34 m_IsCalibration{false},
35 m_RenderingDelegate{nullptr}
33 {
36 {
34 }
37 }
35
38
39 QString m_Name;
36 // 1 variable -> n qcpplot
40 // 1 variable -> n qcpplot
37 std::map<std::shared_ptr<Variable>, PlottablesMap> m_VariableToPlotMultiMap;
41 std::map<std::shared_ptr<Variable>, PlottablesMap> m_VariableToPlotMultiMap;
38 bool m_DoAcquisition;
42 bool m_DoAcquisition;
@@ -45,19 +49,12 struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate {
45 VisualizationGraphWidget::VisualizationGraphWidget(const QString &name, QWidget *parent)
49 VisualizationGraphWidget::VisualizationGraphWidget(const QString &name, QWidget *parent)
46 : QWidget{parent},
50 : QWidget{parent},
47 ui{new Ui::VisualizationGraphWidget},
51 ui{new Ui::VisualizationGraphWidget},
48 impl{spimpl::make_unique_impl<VisualizationGraphWidgetPrivate>()}
52 impl{spimpl::make_unique_impl<VisualizationGraphWidgetPrivate>(name)}
49 {
53 {
50 ui->setupUi(this);
54 ui->setupUi(this);
51
55
52 // The delegate must be initialized after the ui as it uses the plot
53 impl->m_RenderingDelegate = std::make_unique<VisualizationGraphRenderingDelegate>(*ui->widget);
54
55 ui->graphNameLabel->setText(name);
56
57 // 'Close' options : widget is deleted when closed
56 // 'Close' options : widget is deleted when closed
58 setAttribute(Qt::WA_DeleteOnClose);
57 setAttribute(Qt::WA_DeleteOnClose);
59 connect(ui->closeButton, &QToolButton::clicked, this, &VisualizationGraphWidget::close);
60 ui->closeButton->setIcon(sqpApp->style()->standardIcon(QStyle::SP_TitleBarCloseButton));
61
58
62 // Set qcpplot properties :
59 // Set qcpplot properties :
63 // - Drag (on x-axis) and zoom are enabled
60 // - Drag (on x-axis) and zoom are enabled
@@ -65,6 +62,9 VisualizationGraphWidget::VisualizationGraphWidget(const QString &name, QWidget
65 ui->widget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
62 ui->widget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
66 ui->widget->axisRect()->setRangeDrag(Qt::Horizontal);
63 ui->widget->axisRect()->setRangeDrag(Qt::Horizontal);
67
64
65 // The delegate must be initialized after the ui as it uses the plot
66 impl->m_RenderingDelegate = std::make_unique<VisualizationGraphRenderingDelegate>(*this);
67
68 connect(ui->widget, &QCustomPlot::mousePress, this, &VisualizationGraphWidget::onMousePress);
68 connect(ui->widget, &QCustomPlot::mousePress, this, &VisualizationGraphWidget::onMousePress);
69 connect(ui->widget, &QCustomPlot::mouseRelease, this,
69 connect(ui->widget, &QCustomPlot::mouseRelease, this,
70 &VisualizationGraphWidget::onMouseRelease);
70 &VisualizationGraphWidget::onMouseRelease);
@@ -201,7 +201,7 bool VisualizationGraphWidget::contains(const Variable &variable) const
201
201
202 QString VisualizationGraphWidget::name() const
202 QString VisualizationGraphWidget::name() const
203 {
203 {
204 return ui->graphNameLabel->text();
204 return impl->m_Name;
205 }
205 }
206
206
207 void VisualizationGraphWidget::onGraphMenuRequested(const QPoint &pos) noexcept
207 void VisualizationGraphWidget::onGraphMenuRequested(const QPoint &pos) noexcept
@@ -27,50 +27,6
27 <number>0</number>
27 <number>0</number>
28 </property>
28 </property>
29 <item>
29 <item>
30 <widget class="QWidget" name="infobar" native="true">
31 <layout class="QHBoxLayout" name="horizontalLayout_2">
32 <property name="leftMargin">
33 <number>0</number>
34 </property>
35 <property name="topMargin">
36 <number>0</number>
37 </property>
38 <property name="rightMargin">
39 <number>0</number>
40 </property>
41 <property name="bottomMargin">
42 <number>0</number>
43 </property>
44 <item>
45 <widget class="QLabel" name="graphNameLabel">
46 <property name="styleSheet">
47 <string notr="true">font: 75 9pt &quot;MS Shell Dlg 2&quot;;</string>
48 </property>
49 <property name="text">
50 <string>TextLabel</string>
51 </property>
52 <property name="textFormat">
53 <enum>Qt::AutoText</enum>
54 </property>
55 <property name="alignment">
56 <set>Qt::AlignCenter</set>
57 </property>
58 </widget>
59 </item>
60 <item>
61 <widget class="QToolButton" name="closeButton">
62 <property name="styleSheet">
63 <string notr="true">background-color: transparent;</string>
64 </property>
65 <property name="text">
66 <string>Close</string>
67 </property>
68 </widget>
69 </item>
70 </layout>
71 </widget>
72 </item>
73 <item>
74 <widget class="QCustomPlot" name="widget" native="true">
30 <widget class="QCustomPlot" name="widget" native="true">
75 <property name="sizePolicy">
31 <property name="sizePolicy">
76 <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
32 <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
General Comments 0
You need to be logged in to leave comments. Login now