https://github.com/houmain/qmainwindow-tabs
QMainWindow dock title bars and tabs combined
https://github.com/houmain/qmainwindow-tabs
qdockwidget qmainwindow qt5 qt6 qtabbar qwidget
Last synced: 29 days ago
JSON representation
QMainWindow dock title bars and tabs combined
- Host: GitHub
- URL: https://github.com/houmain/qmainwindow-tabs
- Owner: houmain
- License: unlicense
- Created: 2023-08-28T17:52:38.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-28T17:53:37.000Z (almost 3 years ago)
- Last Synced: 2025-01-27T22:39:10.045Z (over 1 year ago)
- Topics: qdockwidget, qmainwindow, qt5, qt6, qtabbar, qwidget
- Language: C++
- Homepage:
- Size: 26.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# QMainWindow Tabs
As you might have experienced, QMainWindow behaves quite inconsistently, with dock titles appearing twice when a dock is tabbed and arranging docks by dragging tabs is in vain...
This project demonstrates how the situation can arguably be improved without completely replacing QMainWindow with another implementation.
## Features
- Dock title bars and tabs are combined into one tab bar.
- Tab headers can be dragged to rearrange docks.
- Tab bars can be double clicked to open new tabs.
- The middle mouse button can be used to close tabs.
- When tabs are elided a button appears allowing to select further tabs.
- The selected, all or other tabs can be closed via a context menu.
## Before and after screenshots


## Usage
The projects contains two classes [DockWindow](src/DockWindow.h) and [DockTitle](src/DockTitle.h).
Together they form a drop-in-replacement for QMainWindow. So one simply has to derive from DockWindow instead of QMainWindow.
## How does it work
DockWindow derives from QMainWindow and sets a custom dock title bar, which appears and behaves like a QTabBar. Additionally it hides the tab bars potentially created by QMainWindow.