##// END OF EJS Templates
Add button on the SidePane widgets to open left or right inspectors
perrinel -
r101:9678ebc27091
parent child
Show More
1 NO CONTENT: new file 100755, binary diff hidden
NO CONTENT: new file 100755, binary diff hidden
@@ -0,0 +1,5
1 <RCC>
2 <qresource prefix="/">
3 <file>icones/openInspector.png</file>
4 </qresource>
5 </RCC>
@@ -23,17 +23,20
23 #define SCIQLOP_MAINWINDOW_H
23 #define SCIQLOP_MAINWINDOW_H
24
24
25 #include <QListWidgetItem>
25 #include <QListWidgetItem>
26 #include <QLoggingCategory>
26 #include <QMainWindow>
27 #include <QMainWindow>
27 #include <QProgressBar>
28 #include <QProgressBar>
28 #include <QProgressDialog>
29 #include <QProgressDialog>
29 #include <QThread>
30 #include <QThread>
30 #include <QVBoxLayout>
31 #include <QVBoxLayout>
31 #include <QWidget>
32 #include <QWidget>
32 //#include "../Core/qlopservice.h"
33
33 //#include "../Core/qlopgui.h"
34 #include <Common/spimpl.h>
34
35
35 #include <memory>
36 #include <memory>
36
37
38 Q_DECLARE_LOGGING_CATEGORY(LOG_MainWindow)
39
37 namespace Ui {
40 namespace Ui {
38 class MainWindow;
41 class MainWindow;
39 } // namespace Ui
42 } // namespace Ui
@@ -55,6 +58,8 private:
55 // QWidget *m_progressWidget;
58 // QWidget *m_progressWidget;
56 // QVBoxLayout *m_progressLayout;
59 // QVBoxLayout *m_progressLayout;
57 // QList<QLopService*> m_qlopServices;
60 // QList<QLopService*> m_qlopServices;
61 class MainWindowPrivate;
62 spimpl::unique_impl_ptr<MainWindowPrivate> impl;
58 };
63 };
59
64
60 #endif // SCIQLOP_MAINWINDOW_H
65 #endif // SCIQLOP_MAINWINDOW_H
@@ -24,6 +24,7
24
24
25 #include <DataSource/DataSourceController.h>
25 #include <DataSource/DataSourceController.h>
26 #include <DataSource/DataSourceWidget.h>
26 #include <DataSource/DataSourceWidget.h>
27 #include <SidePane/SqpSidePane.h>
27 #include <SqpApplication.h>
28 #include <SqpApplication.h>
28
29
29 #include <QAction>
30 #include <QAction>
@@ -31,6 +32,9
31 #include <QDateTime>
32 #include <QDateTime>
32 #include <QDir>
33 #include <QDir>
33 #include <QFileDialog>
34 #include <QFileDialog>
35 #include <QToolBar>
36 #include <memory.h>
37
34 //#include <omp.h>
38 //#include <omp.h>
35 //#include <network/filedownloader.h>
39 //#include <network/filedownloader.h>
36 //#include <qlopdatabase.h>
40 //#include <qlopdatabase.h>
@@ -42,22 +46,102
42 //#include "cdfcodec.h"
46 //#include "cdfcodec.h"
43 //#include "amdatxtcodec.h"
47 //#include "amdatxtcodec.h"
44 //#include <qlopplotmanager.h>
48 //#include <qlopplotmanager.h>
45 #include <QAction>
49
46 #include <QToolBar>
50 #include "iostream"
47 #include <memory.h>
51
48 MainWindow::MainWindow(QWidget *parent) : QMainWindow{parent}, m_Ui{new Ui::MainWindow}
52 Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow")
53
54 class MainWindow::MainWindowPrivate {
55 public:
56 QSize m_LastOpenLeftInspectorSize;
57 QSize m_LastOpenRightInspectorSize;
58 };
59
60 MainWindow::MainWindow(QWidget *parent)
61 : QMainWindow{parent},
62 m_Ui{new Ui::MainWindow},
63 impl{spimpl::make_unique_impl<MainWindowPrivate>()}
49 {
64 {
50 m_Ui->setupUi(this);
65 m_Ui->setupUi(this);
51
66
52 auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane();
67
53 leftSidePane->addAction("ACTION L1");
68 m_Ui->splitter->setCollapsible(1, false);
54 leftSidePane->addAction("ACTION L2");
69 m_Ui->splitter->setCollapsible(3, false);
55 leftSidePane->addAction("ACTION L3");
70 // Lambda that defines what's happened when clicking on the leftSidePaneInspector open button
71 auto openLeftInspector = [&](bool checked) {
72
73 // Update of the last opened geometry
74 if (checked) {
75 impl->m_LastOpenLeftInspectorSize = m_Ui->leftMainInspectorWidget->size();
76 }
77
78 auto startSize = impl->m_LastOpenLeftInspectorSize;
79 auto endSize = startSize;
80 endSize.setWidth(0);
81
82 QList<int> currentSizes = m_Ui->splitter->sizes();
83 if (checked) {
84 // adjust sizes individually here, e.g.
85 currentSizes[0] -= impl->m_LastOpenLeftInspectorSize.width();
86 currentSizes[2] += impl->m_LastOpenLeftInspectorSize.width();
87 m_Ui->splitter->setSizes(currentSizes);
88 }
89 else {
90 // adjust sizes individually here, e.g.
91 currentSizes[0] += impl->m_LastOpenLeftInspectorSize.width();
92 currentSizes[2] -= impl->m_LastOpenLeftInspectorSize.width();
93 m_Ui->splitter->setSizes(currentSizes);
94 }
95
96 };
97
98 // Lambda that defines what's happened when clicking on the SidePaneInspector open button
99 auto openRightInspector = [&](bool checked) {
100
101 // Update of the last opened geometry
102 if (checked) {
103 impl->m_LastOpenRightInspectorSize = m_Ui->rightMainInspectorWidget->size();
104 }
105
106 auto startSize = impl->m_LastOpenRightInspectorSize;
107 auto endSize = startSize;
108 endSize.setWidth(0);
109
110 QList<int> currentSizes = m_Ui->splitter->sizes();
111 if (checked) {
112 // adjust sizes individually here, e.g.
113 currentSizes[4] -= impl->m_LastOpenRightInspectorSize.width();
114 currentSizes[2] += impl->m_LastOpenRightInspectorSize.width();
115 m_Ui->splitter->setSizes(currentSizes);
116 }
117 else {
118 // adjust sizes individually here, e.g.
119 currentSizes[4] += impl->m_LastOpenRightInspectorSize.width();
120 currentSizes[2] -= impl->m_LastOpenRightInspectorSize.width();
121 m_Ui->splitter->setSizes(currentSizes);
122 }
123
124 };
125
126
127 QToolBar *leftSidePane = m_Ui->leftInspectorSidePane->sidePane();
128 auto openLeftInspectorAction = leftSidePane->addAction(
129 QIcon{
130 ":/icones/openInspector.png",
131 },
132 "ACTION L1", openLeftInspector);
133
134 openLeftInspectorAction->setCheckable(true);
56
135
57 auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane();
136 auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane();
58 rightSidePane->addAction("ACTION R1");
137 auto openRightInspectorAction = rightSidePane->addAction(
59 rightSidePane->addAction("ACTION R2");
138 QIcon{
60 rightSidePane->addAction("ACTION R3");
139 ":/icones/openInspector.png",
140 },
141 "ACTION L1", openRightInspector);
142
143 openRightInspectorAction->setCheckable(true);
144
61
145
62 this->menuBar()->addAction("File");
146 this->menuBar()->addAction("File");
63 auto mainToolBar = this->addToolBar("MainToolBar");
147 auto mainToolBar = this->addToolBar("MainToolBar");
@@ -34,26 +34,8
34 </property>
34 </property>
35 <layout class="QHBoxLayout" name="horizontalLayout">
35 <layout class="QHBoxLayout" name="horizontalLayout">
36 <property name="spacing">
36 <property name="spacing">
37 <number>3</number>
38 </property>
39 <property name="leftMargin">
40 <number>0</number>
41 </property>
42 <property name="topMargin">
43 <number>0</number>
44 </property>
45 <property name="rightMargin">
46 <number>0</number>
37 <number>0</number>
47 </property>
38 </property>
48 <property name="bottomMargin">
49 <number>0</number>
50 </property>
51 <item>
52 <widget class="QWidget" name="leftInspectorWidget" native="true">
53 <layout class="QHBoxLayout" name="horizontalLayout_2">
54 <property name="spacing">
55 <number>3</number>
56 </property>
57 <property name="leftMargin">
39 <property name="leftMargin">
58 <number>0</number>
40 <number>0</number>
59 </property>
41 </property>
@@ -67,10 +49,14
67 <number>0</number>
49 <number>0</number>
68 </property>
50 </property>
69 <item>
51 <item>
70 <widget class="QWidget" name="widget" native="true">
52 <widget class="QSplitter" name="splitter">
53 <property name="orientation">
54 <enum>Qt::Horizontal</enum>
55 </property>
56 <widget class="QWidget" name="leftMainInspectorWidget" native="true">
71 <layout class="QVBoxLayout" name="verticalLayout">
57 <layout class="QVBoxLayout" name="verticalLayout">
72 <property name="spacing">
58 <property name="spacing">
73 <number>3</number>
59 <number>0</number>
74 </property>
60 </property>
75 <property name="leftMargin">
61 <property name="leftMargin">
76 <number>0</number>
62 <number>0</number>
@@ -95,60 +81,20
95 </item>
81 </item>
96 </layout>
82 </layout>
97 </widget>
83 </widget>
98 </item>
84 <widget class="SqpSidePane" name="leftInspectorSidePane" native="true"/>
99 <item>
85 <widget class="VisualizationWidget" name="view" native="true">
100 <widget class="SqpSidePane" name="leftInspectorSidePane" native="true">
86 <property name="sizePolicy">
101 <layout class="QVBoxLayout" name="verticalLayout_2">
87 <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
102 <property name="spacing">
88 <horstretch>0</horstretch>
103 <number>3</number>
89 <verstretch>0</verstretch>
104 </property>
90 </sizepolicy>
105 <property name="leftMargin">
106 <number>0</number>
107 </property>
108 <property name="topMargin">
109 <number>0</number>
110 </property>
111 <property name="rightMargin">
112 <number>0</number>
113 </property>
114 <property name="bottomMargin">
115 <number>0</number>
116 </property>
91 </property>
117 </layout>
118 </widget>
92 </widget>
119 </item>
120 </layout>
121 </widget>
122 </item>
123 <item>
124 <widget class="VisualizationWidget" name="view" native="true"/>
125 </item>
126 <item>
127 <widget class="QWidget" name="rightInspectorWidget" native="true">
128 <layout class="QHBoxLayout" name="horizontalLayout_3">
129 <property name="spacing">
130 <number>3</number>
131 </property>
132 <property name="leftMargin">
133 <number>0</number>
134 </property>
135 <property name="topMargin">
136 <number>0</number>
137 </property>
138 <property name="rightMargin">
139 <number>0</number>
140 </property>
141 <property name="bottomMargin">
142 <number>0</number>
143 </property>
144 <item>
145 <widget class="SqpSidePane" name="rightInspectorSidePane" native="true"/>
93 <widget class="SqpSidePane" name="rightInspectorSidePane" native="true"/>
146 </item>
94 <widget class="QWidget" name="rightMainInspectorWidget" native="true">
147 <item>
148 <widget class="QWidget" name="widget_2" native="true">
149 <layout class="QVBoxLayout" name="verticalLayout_3">
95 <layout class="QVBoxLayout" name="verticalLayout_3">
150 <property name="spacing">
96 <property name="spacing">
151 <number>3</number>
97 <number>0</number>
152 </property>
98 </property>
153 <property name="leftMargin">
99 <property name="leftMargin">
154 <number>0</number>
100 <number>0</number>
@@ -166,12 +112,10
166 <widget class="QWidget" name="commonPropertyInspectorWidget" native="true"/>
112 <widget class="QWidget" name="commonPropertyInspectorWidget" native="true"/>
167 </item>
113 </item>
168 <item>
114 <item>
169 <widget class="QWidget" name="catalogWidget" native="true"/>
115 <widget class="DataSourceWidget" name="catalogWidget" native="true"/>
170 </item>
116 </item>
171 </layout>
117 </layout>
172 </widget>
118 </widget>
173 </item>
174 </layout>
175 </widget>
119 </widget>
176 </item>
120 </item>
177 </layout>
121 </layout>
@@ -182,7 +126,7
182 <x>0</x>
126 <x>0</x>
183 <y>0</y>
127 <y>0</y>
184 <width>800</width>
128 <width>800</width>
185 <height>26</height>
129 <height>28</height>
186 </rect>
130 </rect>
187 </property>
131 </property>
188 </widget>
132 </widget>
@@ -24,16 +24,23 static const QString SQPSIDEPANESTYLESHEET
24
24
25 SqpSidePane::SqpSidePane(QWidget *parent) : QWidget{parent}, ui{new Ui::SqpSidePane}
25 SqpSidePane::SqpSidePane(QWidget *parent) : QWidget{parent}, ui{new Ui::SqpSidePane}
26 {
26 {
27 QVBoxLayout *sidePaneLayout = new QVBoxLayout(this);
27 // QVBoxLayout *sidePaneLayout = new QVBoxLayout(this);
28 sidePaneLayout->setContentsMargins(0, 0, 0, 0);
28 // sidePaneLayout->setContentsMargins(0, 0, 0, 0);
29 this->setLayout(sidePaneLayout);
29 // this->setLayout(sidePaneLayout);
30
30
31 ui->setupUi(this);
31 ui->setupUi(this);
32 m_SidePaneToolbar = new QToolBar(this);
32 m_SidePaneToolbar = new QToolBar();
33 m_SidePaneToolbar->setOrientation(Qt::Vertical);
33 m_SidePaneToolbar->setOrientation(Qt::Vertical);
34 sidePaneLayout->addWidget(m_SidePaneToolbar);
34 this->layout()->addWidget(m_SidePaneToolbar);
35
35
36 m_SidePaneToolbar->setStyleSheet(SQPSIDEPANESTYLESHEET);
36 m_SidePaneToolbar->setStyleSheet(SQPSIDEPANESTYLESHEET);
37
38 this->setStyleSheet(
39 " QWidget {"
40 "background: red;"
41
42 "border: 1px;"
43 " }");
37 }
44 }
38
45
39 SqpSidePane::~SqpSidePane()
46 SqpSidePane::~SqpSidePane()
@@ -20,7 +20,7 VisualizationWidget::VisualizationWidget(QWidget *parent)
20 addTabViewButton->setAutoRaise(true);
20 addTabViewButton->setAutoRaise(true);
21 ui->tabWidget->setCornerWidget(addTabViewButton, Qt::TopRightCorner);
21 ui->tabWidget->setCornerWidget(addTabViewButton, Qt::TopRightCorner);
22
22
23 auto addTabView = [&](bool checked) {
23 auto addTabView = [&]() {
24 auto index = ui->tabWidget->addTab(new VisualizationTabWidget(ui->tabWidget),
24 auto index = ui->tabWidget->addTab(new VisualizationTabWidget(ui->tabWidget),
25 QString("View %1").arg(ui->tabWidget->count() + 1));
25 QString("View %1").arg(ui->tabWidget->count() + 1));
26 qCInfo(LOG_VisualizationWidget()) << tr("add the tab of index %1").arg(index);
26 qCInfo(LOG_VisualizationWidget()) << tr("add the tab of index %1").arg(index);
@@ -14,8 +14,26
14 <string>Data sources</string>
14 <string>Data sources</string>
15 </property>
15 </property>
16 <layout class="QGridLayout" name="gridLayout">
16 <layout class="QGridLayout" name="gridLayout">
17 <property name="topMargin">
18 <number>0</number>
19 </property>
20 <property name="rightMargin">
21 <number>0</number>
22 </property>
23 <property name="bottomMargin">
24 <number>0</number>
25 </property>
26 <property name="spacing">
27 <number>0</number>
28 </property>
17 <item row="0" column="0">
29 <item row="0" column="0">
18 <widget class="QTreeWidget" name="treeWidget"/>
30 <widget class="QTreeWidget" name="treeWidget">
31 <column>
32 <property name="text">
33 <string notr="true">1</string>
34 </property>
35 </column>
36 </widget>
19 </item>
37 </item>
20 </layout>
38 </layout>
21 </widget>
39 </widget>
@@ -1,21 +1,42
1 <?xml version="1.0" encoding="UTF-8"?>
1 <ui version="4.0">
2 <ui version="4.0">
2 <author/>
3 <comment/>
4 <exportmacro/>
5 <class>SqpSidePane</class>
3 <class>SqpSidePane</class>
6 <widget name="SqpSidePane" class="QWidget">
4 <widget class="QWidget" name="SqpSidePane">
7 <property name="geometry">
5 <property name="geometry">
8 <rect>
6 <rect>
9 <x>0</x>
7 <x>0</x>
10 <y>0</y>
8 <y>0</y>
11 <width>400</width>
9 <width>12</width>
12 <height>300</height>
10 <height>12</height>
13 </rect>
11 </rect>
14 </property>
12 </property>
13 <property name="maximumSize">
14 <size>
15 <width>45</width>
16 <height>16777215</height>
17 </size>
18 </property>
15 <property name="windowTitle">
19 <property name="windowTitle">
16 <string>Form</string>
20 <string>Form</string>
17 </property>
21 </property>
22 <layout class="QVBoxLayout" name="verticalLayout_2">
23 <property name="spacing">
24 <number>0</number>
25 </property>
26 <property name="leftMargin">
27 <number>0</number>
28 </property>
29 <property name="topMargin">
30 <number>0</number>
31 </property>
32 <property name="rightMargin">
33 <number>0</number>
34 </property>
35 <property name="bottomMargin">
36 <number>0</number>
37 </property>
38 </layout>
18 </widget>
39 </widget>
19 <pixmapfunction/>
40 <resources/>
20 <connections/>
41 <connections/>
21 </ui>
42 </ui>
General Comments 0
You need to be logged in to leave comments. Login now