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