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