@@ -51,6 +51,14 | |||||
51 |
|
51 | |||
52 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") |
|
52 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") | |
53 |
|
53 | |||
|
54 | namespace { | |||
|
55 | const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0; | |||
|
56 | const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1; | |||
|
57 | const auto VIEWPLITTERINDEX = 2; | |||
|
58 | const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3; | |||
|
59 | const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; | |||
|
60 | } | |||
|
61 | ||||
54 | class MainWindow::MainWindowPrivate { |
|
62 | class MainWindow::MainWindowPrivate { | |
55 | public: |
|
63 | public: | |
56 | QSize m_LastOpenLeftInspectorSize; |
|
64 | QSize m_LastOpenLeftInspectorSize; | |
@@ -64,11 +72,12 MainWindow::MainWindow(QWidget *parent) | |||||
64 | { |
|
72 | { | |
65 | m_Ui->setupUi(this); |
|
73 | m_Ui->setupUi(this); | |
66 |
|
74 | |||
|
75 | m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false); | |||
|
76 | m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false); | |||
67 |
|
77 | |||
68 | m_Ui->splitter->setCollapsible(1, false); |
|
78 | // NOTE: These lambda could be factorized. Be careful of theirs parameters | |
69 | m_Ui->splitter->setCollapsible(3, false); |
|
|||
70 | // Lambda that defines what's happened when clicking on the leftSidePaneInspector open button |
|
79 | // Lambda that defines what's happened when clicking on the leftSidePaneInspector open button | |
71 |
auto openLeftInspector = [ |
|
80 | auto openLeftInspector = [this](bool checked) { | |
72 |
|
81 | |||
73 | // Update of the last opened geometry |
|
82 | // Update of the last opened geometry | |
74 | if (checked) { |
|
83 | if (checked) { | |
@@ -79,24 +88,26 MainWindow::MainWindow(QWidget *parent) | |||||
79 | auto endSize = startSize; |
|
88 | auto endSize = startSize; | |
80 | endSize.setWidth(0); |
|
89 | endSize.setWidth(0); | |
81 |
|
90 | |||
82 |
|
|
91 | auto currentSizes = m_Ui->splitter->sizes(); | |
83 | if (checked) { |
|
92 | if (checked) { | |
84 | // adjust sizes individually here, e.g. |
|
93 | // adjust sizes individually here, e.g. | |
85 | currentSizes[0] -= impl->m_LastOpenLeftInspectorSize.width(); |
|
94 | currentSizes[LEFTMAININSPECTORWIDGETSPLITTERINDEX] | |
86 |
|
|
95 | -= impl->m_LastOpenLeftInspectorSize.width(); | |
|
96 | currentSizes[VIEWPLITTERINDEX] += impl->m_LastOpenLeftInspectorSize.width(); | |||
87 | m_Ui->splitter->setSizes(currentSizes); |
|
97 | m_Ui->splitter->setSizes(currentSizes); | |
88 | } |
|
98 | } | |
89 | else { |
|
99 | else { | |
90 | // adjust sizes individually here, e.g. |
|
100 | // adjust sizes individually here, e.g. | |
91 | currentSizes[0] += impl->m_LastOpenLeftInspectorSize.width(); |
|
101 | currentSizes[LEFTMAININSPECTORWIDGETSPLITTERINDEX] | |
92 |
|
|
102 | += impl->m_LastOpenLeftInspectorSize.width(); | |
|
103 | currentSizes[VIEWPLITTERINDEX] -= impl->m_LastOpenLeftInspectorSize.width(); | |||
93 | m_Ui->splitter->setSizes(currentSizes); |
|
104 | m_Ui->splitter->setSizes(currentSizes); | |
94 | } |
|
105 | } | |
95 |
|
106 | |||
96 | }; |
|
107 | }; | |
97 |
|
108 | |||
98 | // Lambda that defines what's happened when clicking on the SidePaneInspector open button |
|
109 | // Lambda that defines what's happened when clicking on the SidePaneInspector open button | |
99 |
auto openRightInspector = [ |
|
110 | auto openRightInspector = [this](bool checked) { | |
100 |
|
111 | |||
101 | // Update of the last opened geometry |
|
112 | // Update of the last opened geometry | |
102 | if (checked) { |
|
113 | if (checked) { | |
@@ -107,17 +118,19 MainWindow::MainWindow(QWidget *parent) | |||||
107 | auto endSize = startSize; |
|
118 | auto endSize = startSize; | |
108 | endSize.setWidth(0); |
|
119 | endSize.setWidth(0); | |
109 |
|
120 | |||
110 |
|
|
121 | auto currentSizes = m_Ui->splitter->sizes(); | |
111 | if (checked) { |
|
122 | if (checked) { | |
112 | // adjust sizes individually here, e.g. |
|
123 | // adjust sizes individually here, e.g. | |
113 | currentSizes[4] -= impl->m_LastOpenRightInspectorSize.width(); |
|
124 | currentSizes[RIGHTMAININSPECTORWIDGETSPLITTERINDEX] | |
114 |
|
|
125 | -= impl->m_LastOpenRightInspectorSize.width(); | |
|
126 | currentSizes[VIEWPLITTERINDEX] += impl->m_LastOpenRightInspectorSize.width(); | |||
115 | m_Ui->splitter->setSizes(currentSizes); |
|
127 | m_Ui->splitter->setSizes(currentSizes); | |
116 | } |
|
128 | } | |
117 | else { |
|
129 | else { | |
118 | // adjust sizes individually here, e.g. |
|
130 | // adjust sizes individually here, e.g. | |
119 | currentSizes[4] += impl->m_LastOpenRightInspectorSize.width(); |
|
131 | currentSizes[RIGHTMAININSPECTORWIDGETSPLITTERINDEX] | |
120 |
|
|
132 | += impl->m_LastOpenRightInspectorSize.width(); | |
|
133 | currentSizes[VIEWPLITTERINDEX] -= impl->m_LastOpenRightInspectorSize.width(); | |||
121 | m_Ui->splitter->setSizes(currentSizes); |
|
134 | m_Ui->splitter->setSizes(currentSizes); | |
122 | } |
|
135 | } | |
123 |
|
136 | |||
@@ -129,7 +142,7 MainWindow::MainWindow(QWidget *parent) | |||||
129 | QIcon{ |
|
142 | QIcon{ | |
130 | ":/icones/openInspector.png", |
|
143 | ":/icones/openInspector.png", | |
131 | }, |
|
144 | }, | |
132 |
" |
|
145 | tr("Show/hide the left inspector"), openLeftInspector); | |
133 |
|
146 | |||
134 | openLeftInspectorAction->setCheckable(true); |
|
147 | openLeftInspectorAction->setCheckable(true); | |
135 |
|
148 | |||
@@ -138,14 +151,13 MainWindow::MainWindow(QWidget *parent) | |||||
138 | QIcon{ |
|
151 | QIcon{ | |
139 | ":/icones/openInspector.png", |
|
152 | ":/icones/openInspector.png", | |
140 | }, |
|
153 | }, | |
141 |
" |
|
154 | tr("Show/hide the right inspector"), openRightInspector); | |
142 |
|
155 | |||
143 | openRightInspectorAction->setCheckable(true); |
|
156 | openRightInspectorAction->setCheckable(true); | |
144 |
|
157 | |||
145 |
|
158 | this->menuBar()->addAction(tr("File")); | ||
146 | this->menuBar()->addAction("File"); |
|
159 | auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar")); | |
147 | auto mainToolBar = this->addToolBar("MainToolBar"); |
|
160 | mainToolBar->addAction(QStringLiteral("A1")); | |
148 | mainToolBar->addAction("A1"); |
|
|||
149 |
|
161 | |||
150 | // Widgets / controllers connections |
|
162 | // Widgets / controllers connections | |
151 | connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)), |
|
163 | connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)), |
General Comments 0
You need to be logged in to leave comments.
Login now