spinetoolbox.widgets.multi_tab_window
¶
Contains the MultiTabWindow and TabBarPlus classes.
- author
Marin (KTH)
- date
12.12.2020
Module Contents¶
Classes¶
Tab bar that has a plus button floating to the right of the tabs. |
- class spinetoolbox.widgets.multi_tab_window.MultiTabWindow(qsettings, settings_group, parent=None)[source]¶
Bases:
PySide2.QtWidgets.QMainWindow
- add_new_tab(self, *args, **kwargs)[source]¶
Creates a new tab and adds it at the end of the tab bar.
- insert_new_tab(self, index, *args, **kwargs)[source]¶
Creates a new tab and inserts it at the given index.
- Parameters
index (int) –
- detach(self, index, hot_spot, offset=0)[source]¶
Detaches the tab at given index into another MultiTabWindow window and starts dragging it.
- Parameters
index (int) –
hot_spot (QPoint) –
offset (int) –
- start_drag(self, hot_spot, offset=0)[source]¶
Starts dragging a detached tab.
- Parameters
hot_spot (QPoint) – The anchor point of the drag in widget coordinates.
offset (int, optional) – Horizontal offset of the tab in the bar.
- timerEvent(self, event)[source]¶
Performs the drag, i.e., moves the window with the mouse cursor. As soon as the mouse hovers the tab bar of another MultiTabWindow, reattaches it.
- mouseReleaseEvent(self, event)[source]¶
Stops the drag. This only happens when the detached tab is not reattached to another window.
- reattach(self, index, db_editor, text)[source]¶
Reattaches a tab that has been dragged over this window’s tab bar.
- Parameters
index (int) – Index in this widget’s tab bar where the detached tab has been dragged.
db_editor (SpineDBEditor) – The widget in the tab being dragged.
text (str) – The title of the tab.
- class spinetoolbox.widgets.multi_tab_window.TabBarPlus(parent)[source]¶
Bases:
PySide2.QtWidgets.QTabBar
Tab bar that has a plus button floating to the right of the tabs.
- Parameters
parent (MultiSpineDBEditor) –
- resizeEvent(self, event)[source]¶
Sets the dimension of the plus button. Also, makes the tab bar as wide as the parent.
- mousePressEvent(self, event)[source]¶
Registers the position of the press, in case we need to detach the tab.
- mouseMoveEvent(self, event)[source]¶
Detaches a tab either if the user moves beyond the limits of the tab bar, or if it’s the only one.
- _send_release_event(self, pos)[source]¶
Sends a mouse release event at given position in local coordinates. Called just before detaching a tab.
- Parameters
pos (QPoint) –
- start_dragging(self, index)[source]¶
Stars dragging the given index. This happens when a detached tab is reattached to this bar.
- Parameters
index (int) –