108 Public method to shrink the sidebar. |
108 Public method to shrink the sidebar. |
109 """ |
109 """ |
110 self.__minimized = True |
110 self.__minimized = True |
111 self.__bigSize = self.size() |
111 self.__bigSize = self.size() |
112 if self.__orientation in [E5SideBar.North, E5SideBar.South]: |
112 if self.__orientation in [E5SideBar.North, E5SideBar.South]: |
113 self.__minSize = max(self.minimumHeight(), self.__minimum) |
113 self.__minSize = self.minimumSizeHint().height() |
114 self.__maxSize = self.maximumHeight() |
114 self.__maxSize = self.maximumHeight() |
115 else: |
115 else: |
116 self.__minSize = max(self.minimumWidth(), self.__minimum) |
116 self.__minSize = self.minimumSizeHint().width() |
117 self.__maxSize = self.maximumWidth() |
117 self.__maxSize = self.maximumWidth() |
118 if self.splitter: |
118 if self.splitter: |
119 self.splitterSizes = self.splitter.sizes() |
119 self.splitterSizes = self.splitter.sizes() |
120 |
120 |
121 self.__stackedWidget.hide() |
121 self.__stackedWidget.hide() |
202 if label: |
202 if label: |
203 self.__tabBar.addTab(iconOrLabel, label) |
203 self.__tabBar.addTab(iconOrLabel, label) |
204 else: |
204 else: |
205 self.__tabBar.addTab(iconOrLabel) |
205 self.__tabBar.addTab(iconOrLabel) |
206 self.__stackedWidget.addWidget(widget) |
206 self.__stackedWidget.addWidget(widget) |
|
207 if self.__orientation in [E5SideBar.North, E5SideBar.South]: |
|
208 self.__minSize = self.minimumSizeHint().height() |
|
209 else: |
|
210 self.__minSize = self.minimumSizeHint().width() |
207 |
211 |
208 def insertTab(self, index, widget, iconOrLabel, label=None): |
212 def insertTab(self, index, widget, iconOrLabel, label=None): |
209 """ |
213 """ |
210 Public method to insert a tab into the sidebar. |
214 Public method to insert a tab into the sidebar. |
211 |
215 |
219 if label: |
223 if label: |
220 self.__tabBar.insertTab(index, iconOrLabel, label) |
224 self.__tabBar.insertTab(index, iconOrLabel, label) |
221 else: |
225 else: |
222 self.__tabBar.insertTab(index, iconOrLabel) |
226 self.__tabBar.insertTab(index, iconOrLabel) |
223 self.__stackedWidget.insertWidget(index, widget) |
227 self.__stackedWidget.insertWidget(index, widget) |
|
228 if self.__orientation in [E5SideBar.North, E5SideBar.South]: |
|
229 self.__minSize = self.minimumSizeHint().height() |
|
230 else: |
|
231 self.__minSize = self.minimumSizeHint().width() |
224 |
232 |
225 def removeTab(self, index): |
233 def removeTab(self, index): |
226 """ |
234 """ |
227 Public method to remove a tab. |
235 Public method to remove a tab. |
228 |
236 |
229 @param index the index of the tab to remove (integer) |
237 @param index the index of the tab to remove (integer) |
230 """ |
238 """ |
231 self.__stackedWidget.removeWidget(self.__stackedWidget.widget(index)) |
239 self.__stackedWidget.removeWidget(self.__stackedWidget.widget(index)) |
232 self.__tabBar.removeTab(index) |
240 self.__tabBar.removeTab(index) |
|
241 if self.__orientation in [E5SideBar.North, E5SideBar.South]: |
|
242 self.__minSize = self.minimumSizeHint().height() |
|
243 else: |
|
244 self.__minSize = self.minimumSizeHint().width() |
233 |
245 |
234 def clear(self): |
246 def clear(self): |
235 """ |
247 """ |
236 Public method to remove all tabs. |
248 Public method to remove all tabs. |
237 """ |
249 """ |
458 if len(self.splitterSizes) == 0: |
470 if len(self.splitterSizes) == 0: |
459 if self.splitter: |
471 if self.splitter: |
460 self.splitterSizes = self.splitter.sizes() |
472 self.splitterSizes = self.splitter.sizes() |
461 self.__bigSize = self.size() |
473 self.__bigSize = self.size() |
462 if self.__orientation in [E5SideBar.North, E5SideBar.South]: |
474 if self.__orientation in [E5SideBar.North, E5SideBar.South]: |
463 self.__minSize = self.minimumHeight() |
475 self.__minSize = self.minimumSizeHint().height() |
464 self.__maxSize = self.maximumHeight() |
476 self.__maxSize = self.maximumHeight() |
465 else: |
477 else: |
466 self.__minSize = self.minimumWidth() |
478 self.__minSize = self.minimumSizeHint().width() |
467 self.__maxSize = self.maximumWidth() |
479 self.__maxSize = self.maximumWidth() |
468 |
480 |
469 data = QByteArray() |
481 data = QByteArray() |
470 stream = QDataStream(data, QIODevice.WriteOnly) |
482 stream = QDataStream(data, QIODevice.WriteOnly) |
471 |
483 |