forked from mfreiholz/Qt-Advanced-Docking-System
-
Notifications
You must be signed in to change notification settings - Fork 681
Auto hide feature #452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
SyarifFakhri
wants to merge
256
commits into
githubuser0xFFFF:master
from
duerr-ndt:auto_hide_feature
Closed
Auto hide feature #452
Changes from 12 commits
Commits
Show all changes
256 commits
Select commit
Hold shift + click to select a range
e456503
Merge branch 'master' into auto_hide_feature
1a903e7
add pin icon
4a77580
swap position of auto hide button and detach group button
9735f41
Fix toggle view through the actions menu not working correctly
1d9902b
Make tabs menu hidden when overlayed
302fcd1
Fix bug where dragging an overlayed widget would cause it to be empty
068797d
Fixed build issues of original pull request
githubuser0xFFFF de4a59d
Re added back in CentralWidgetExample after mistakenly removing it
8bfb98e
Remove auto hide feature being set by default. Add config for the def…
0087a1b
Add left right styling to the dock widget side tab
ecccba4
Add overlay splitter object name
5ddb02c
fix the border styling of the dock widget side tab when not focused
a279e71
Fix side tab bar area name being saved wrong in the XML
be4e5a8
Change the styling - Now the dock widget side tab has a gray left/right
37edf47
Fix the side tab widget not updating style when its restored from XML
9bfd77a
Remove None and Bottom from the SideTabBarArea enum
af549d8
Add title label to the overlayed dock area
c1df05b
Fix bug where undock button would be show incorrectly in floating dock
fac8126
Whitespace changes only
3ec395f
update default stylesheet
60c2200
Add hover styling
a2e9c1a
Add config flag for enabling the overlay dock area title
6ae14fa
add comment regarding empty widget in overlay dock container
1097d65
fix elision for vertical eliding label.
nickdademo 84c6afa
Reworked toggle view
dc05ec3
Add nullptr check when restoring state with overlayed widgets
54b9a8d
Merge branch 'auto_hide_feature' of github.com:duerr-ndt/Qt-Advanced-…
22402e7
Added support for delete on close to overlayed widgets
621e5e7
fix tooltips for auto hide button and close button
3ef1ac9
Fix splitter size being saved incorrectly if the overlay widget is ne…
883d5b5
fix crash when sometimes restoring state
489f72a
Add side tab widget icons
214c415
Add Bottom side bar
4841d9b
Set splitter sizes based on proportion settable in the dock widget
dfc2714
Fix invalid state on restore
b950b8a
Fix overlayed containers able to drag into the center
9a69955
Simplify logic when restoring state
263c731
Add bottom side icon config
daa52e1
Add missing update style to dock widget side tab
42498b2
Fixed some more spacing in DockWidgetSideTab
8ddabc4
Fix docking behavior when there is a central widget
1919254
Fix central dock widget being pinnable
d394930
Change splitter proportion from int to double
f0f3cae
tweak spacing
ac311d6
Fix moving content to parent on toggle view
0e5329f
add comment
ee97b03
Fix crash when restoring state
6b85b2b
Revert "Fix crash when restoring state"
773f186
Fix crash when restoring state but better
8e5e974
Remove event filter from dock area as well
f3305b9
Remove old crash fix
48163d2
add paintEvent override for styling purposes.
nickdademo 5df2467
add orientation prop to SideTabBar.
nickdademo 06bcf2c
Add insert order for overlayed widget to the side tab bar
4d3328e
Fix side tab widget ordering
6998c0e
double -> float
68e5aec
add rais
SyarifFakhri 68a3bcd
Add assert
SyarifFakhri 59108ed
Add right bottom and left bottom
SyarifFakhri 060313c
clear dock widget focus on repin
SyarifFakhri 8732484
Fix side tab widget resizing strangely on first add
SyarifFakhri f69b1e1
Fix active X widgets not being rendered correctly
SyarifFakhri ea0eac0
Fix autohide example
SyarifFakhri 6e143de
Fix side tab widgets being the wrong size when being added to a layout
SyarifFakhri 3d4d677
Bump XML version
SyarifFakhri 40dccdb
Remove testing code
SyarifFakhri 2bb1589
Add missing check for bottom sidebar config
SyarifFakhri c850e36
Update css for qt-5
SyarifFakhri b567f6c
Add documentation
SyarifFakhri 32f9b46
Fix weird behavior when widget is overlayed
SyarifFakhri 0e6971e
Remove [[fallthrough]]
SyarifFakhri 8ac8d63
Ensure that the closed state is consistent
SyarifFakhri 7f6fa0c
Fix linux styling
SyarifFakhri 880a7f1
add config flag in ads demo
SyarifFakhri 53e8010
Merge branch 'auto_hide_feature' of github.com:duerr-ndt/Qt-Advanced-…
SyarifFakhri 3cd0265
- Fix crash caused by not removing dock area from parent container
SyarifFakhri a74e034
remove unused vars
SyarifFakhri 412f245
Dissallow non focusable dock widgets from being pinned
SyarifFakhri 8fc3338
Pulled latest changes from duer autohide branch
githubuser0xFFFF 62d3d73
Made Auto Hide Feature independent from Focus Feature and renamed Ove…
githubuser0xFFFF 6c27115
Ignore MouseButtonPress events of SideTabWidget in event filter
githubuser0xFFFF 60526f2
Fixed some typos
githubuser0xFFFF ae55013
Merge branch 'auto_hide_feature' of github.com:githubuser0xFFFF/Qt-Ad…
SyarifFakhri 8610a64
Rename overlayDockContainer -> AutoHideDockContainer
SyarifFakhri 84ca7b1
fix side tab not hiding when double clicking dock title bar
SyarifFakhri b51c56e
Fix bug where left and bottom overlay splitters cannot be clicked
SyarifFakhri 589a62f
update user guide
SyarifFakhri 5b3ad7e
fix typo
SyarifFakhri ad0c210
fix crash when using widgets that delete on close
SyarifFakhri efb87c8
update size then mask
SyarifFakhri 91190e8
cleaner dock widget side tab click handling
SyarifFakhri ac8cf86
remove unused css
SyarifFakhri f9b6223
Add top area
SyarifFakhri b0544be
Added activeTab property
SyarifFakhri 754a41d
Formatting and cleanup
SyarifFakhri 4399f6e
Update css
SyarifFakhri 9f9d979
Added sideTabBarArea property to CAutoHideDockContainer to improve CS…
githubuser0xFFFF a8a40f0
Merge branch 'duerr-ndt-auto_hide_feature' into auto_hide_feature
githubuser0xFFFF e311712
Changed moveContentsToParent() logic when disabling auto dock for a c…
githubuser0xFFFF bb630ca
Changed toggleAutoHideArea)= logic - only the current dock widget is …
githubuser0xFFFF 1431244
Replaced tab bar areas LeftTop, LeftBottom, RightTop, RightBottom wit…
githubuser0xFFFF ffe6ecc
Improved logic for finding the auto hide side location
githubuser0xFFFF 96a5443
Added alternative auto hide button svg icon and modified stylesheet t…
githubuser0xFFFF 90b9290
Move autohide related CSS into a separate block to have all settings …
githubuser0xFFFF 60e0201
Added new auto hide config flag CDockManager::AutoHideButtonTogglesArea
githubuser0xFFFF fde8007
reduce margin a little bit for the horizontal component
SyarifFakhri 1c69685
Update css
SyarifFakhri 118e79e
Remove config flag
SyarifFakhri d83ec7c
Add config to make auto hide button optionally checkable for styling …
SyarifFakhri 0cbc810
Renamed SideTabIconLabel - added C prefix CSideTabIconLabel
githubuser0xFFFF 3a3c3a9
Fixed namespace comment in ElidingLabel
githubuser0xFFFF cbc43e5
Added PushButton to test new CDockWidgetSideTab
githubuser0xFFFF 866ccb2
Reimplemented DockWidgetSideTab based on QPushButton
githubuser0xFFFF 63fed89
Removed individual config flags for each sidebar with the global Auto…
githubuser0xFFFF 8974b1a
Merge branch 'auto_hide_feature_original_f' into auto_hide_feature
SyarifFakhri 7319c52
FIxed CMakeLists
SyarifFakhri 7ed3f8b
Remove all dock widget focusable constraint on auto hide button
SyarifFakhri 9eb9ee4
fix icon only config for side tab bars
SyarifFakhri 10a75b0
remove unused and cleanup
SyarifFakhri bc1f12b
Implemented experimental mouse event handling
githubuser0xFFFF 93d0d4b
Merge branch 'master' into auto_hide_dockcontainer
githubuser0xFFFF f549a92
Added resize support for new QFrame based AutoHideDockContainer
githubuser0xFFFF ff0b32a
Added new Visual Studio Light theme
githubuser0xFFFF 8e8ead0
Improved visual_studio_light.css
githubuser0xFFFF ebdd950
Removed supefluous onAutoHideToggleRequested() function
githubuser0xFFFF 7774aaa
Fixed calculateSideTabBarArea function to work properly with every do…
githubuser0xFFFF 14acd0f
Fixed updateResizeHandleSizeLimitMax() function to work properly with…
githubuser0xFFFF 6eb4625
Improved visual_studio_light.css theme
githubuser0xFFFF 0fbbef7
Fixed initial size of AutoHideDockContainer
githubuser0xFFFF 314ed4b
fix missing case statement
SyarifFakhri 54c7c7e
iconsize -> iconSize in css
SyarifFakhri fafa52a
fix bug where "right click -> detach group" would of an overlay dock …
SyarifFakhri a74d8ac
Improved visual_studio_light.css
githubuser0xFFFF 44bfc56
Removed superfluous function setDockSizeProportion()
githubuser0xFFFF c3aefff
Added missing exports for ResizeHandle and PushButton
githubuser0xFFFF 293bf9b
Updated stylesheet to default
githubuser0xFFFF 43c8d69
Restored initial implementation of ElidingLabel because vertical labe…
githubuser0xFFFF cd58e6e
Reverted stylesheets to initial code to restart with styling
githubuser0xFFFF 875a358
Ensure the SideTab is hidden if empty
githubuser0xFFFF b43770d
Added properties to auto hide widgets to improve CSS styling options
githubuser0xFFFF b14d3ff
Added auto hide styling to focus_highlighting.css
githubuser0xFFFF b2399bb
Removed superfluous code from AutoHideDockContainer.cpp
githubuser0xFFFF 5199fa4
Implemented save and restore function in AutoHideDockContainer
githubuser0xFFFF f22d62a
Implemented non opaque resizing for ResizeHandle
githubuser0xFFFF f5ac29c
Implemented support for Opaque / Non Opaque auto hide container resizing
githubuser0xFFFF eb008be
Cleanup of focus_highlighting.css
githubuser0xFFFF ea8e442
Updated default.css to support the new auto hide functionality
githubuser0xFFFF 822ad48
Code cleanup
githubuser0xFFFF c94155f
Moved SideBarLocation enum out of CDockWidgetSideTab into global ads …
githubuser0xFFFF 11223bf
Prevent deletion of DockWidgetSideTabs if SideTabBar is deleted - the…
githubuser0xFFFF f20c3bc
Fixed wrong position of AutoHideDockContainer when uncollapsing
githubuser0xFFFF da9062e
Fixed wrong rendering of DockWidgetSideTab if orientation changed whe…
githubuser0xFFFF 2d67e9e
Some small changes
githubuser0xFFFF 85d7b30
Changed AutoHide save and restore code
githubuser0xFFFF 3f256f7
Some small renamings
githubuser0xFFFF c80174e
Removed superfluous code and simplified some things
githubuser0xFFFF 85da93c
fix crash when adding auto hide dock container without a previous doc…
SyarifFakhri c2bd56e
add set size to allow the user to set a size for the pinned widget ma…
SyarifFakhri 2a97833
fix cmakelists and remove setDefaultDockProportion from dock widget
SyarifFakhri ee2ef8a
Use resize margin - disallow users from resizing to the size of the p…
SyarifFakhri a012426
cleanup - remove unused code, fix comments, add const
SyarifFakhri f6b77f5
Implemented showing and hiding of side bar when it does not contain a…
githubuser0xFFFF 6cf05c3
Removed debug output
githubuser0xFFFF b85a6b5
Removed debug output
githubuser0xFFFF 38ee87f
Merge branch 'duerr-ndt-auto_hide_feature' into auto_hide_feature_ref…
githubuser0xFFFF b70fc7b
Added some SideBar documentation
githubuser0xFFFF ae5a75b
Removed DockWidget->sideTabWidget()->setProperty("focused", Focused),…
githubuser0xFFFF 1eaeed6
Changed root index of file system model to prevent lagging UI if netw…
githubuser0xFFFF 6adce73
Some restructuring in default.css and default_linux.css to improve re…
f4bfa0f
Changed type of sideTabBarArea properties to int to fix non working L…
1189945
Updated Linux css files to properly support new auto hide feature
af4a3ef
Removed config flag CDockManager::AutoHideDockAreaHasTitle - this sho…
githubuser0xFFFF 8d67057
Moved creation of SideTabWidget into AutoHideDockContainer.cpp
githubuser0xFFFF d1d801c
Moved dock area restore code into CDockAreaWidget
githubuser0xFFFF d56281e
Fix crash that can happen on loading certain configurations
SyarifFakhri 4479030
Properly implemented restore functionality for auto hide container
githubuser0xFFFF fba9c7c
Create auto hide sidebars only if config flag is set
githubuser0xFFFF 760c036
Use explicit naming for functions to configure auto hide flags and di…
githubuser0xFFFF 2370d79
Removed debug code from DockManager saveState function
githubuser0xFFFF 782af9a
Renamed SideTabBar and DockWidgetSideTab into AutoHideSideBar and Aut…
githubuser0xFFFF 075ef61
Refactoring: renamed CDockWidgetSideTab to CAutoHideTab and CSideTabB…
githubuser0xFFFF da6bf2b
Fixed typo
githubuser0xFFFF bfad80c
Some code cleanup
githubuser0xFFFF 44b2dc4
Merge branch 'auto_hide_feature' of github.com:githubuser0xFFFF/Qt-Ad…
SyarifFakhri 94b8042
Made naming of auto hide config flags explicit
githubuser0xFFFF 08714dd
Properly evaluate pinnable flag
githubuser0xFFFF 8e46431
Merge branch 'master' into auto_hide_feature
githubuser0xFFFF 28745fa
Some small improvements and execute auto hide code only if config is …
githubuser0xFFFF fbd25a8
Improved auto hide config flags
githubuser0xFFFF 0d78303
Fixed typo
githubuser0xFFFF fda5887
Removed AutoHideInsertOrder enum - new side tabs are always appended.
githubuser0xFFFF 540961b
Renamed toggleAutoHide to setAutoHide and added toggleAutoHide function
githubuser0xFFFF 07355fa
change fix for crash on currentIndex invalid
SyarifFakhri ea499c7
setSideTabWidget on dockwidget
SyarifFakhri 1f69382
small cleanup
SyarifFakhri 983afc4
Fixed wrong size calculation in CAutoHideDockContainer updateSize() f…
githubuser0xFFFF 7d79ea2
Fixed crash by access to invalid dock parent container in CAutoHideDo…
githubuser0xFFFF 9f153af
Changed MainWindow to enable ActiveX only for non opaque configuratio…
githubuser0xFFFF 7c1d04f
Move calculateSideTabBarArea() function from DockContainerWidget into…
githubuser0xFFFF 9c14c62
Added setAutoHide() and toggleAutoHide() function to CDockWidget
githubuser0xFFFF b5a1795
Added context menu actions for titleBar and dock widget tab auto hide
githubuser0xFFFF d2c08ac
Improved context menu of DockAreaWidget
githubuser0xFFFF 159579f
Fixed some auto hide specific bugs
githubuser0xFFFF 716207f
Removed superfluous deleteAutoHideWidgets() function from CDockContai…
githubuser0xFFFF 736c096
make a copy before deleting
SyarifFakhri 246dd04
fix crash
SyarifFakhri 513bab4
Merge branch 'auto_hide_feature' of github.com:githubuser0xFFFF/Qt-Ad…
SyarifFakhri d255292
Revert "fix crash"
SyarifFakhri bcf8e8a
Revert "setSideTabWidget on dockwidget"
SyarifFakhri 986077c
revert not removing old dock widgets when restoring state
SyarifFakhri 3b97fdc
Improved AutoHideSidebar to provide better resize behavior if parent …
githubuser0xFFFF 1922395
Improved linux auto hide specific css code
04ea1c6
Added option to auto hide a DockWidget or a DockArea to a specific si…
githubuser0xFFFF 409d448
Added support for auto hiding a dock area / widget to a specific bord…
githubuser0xFFFF 5e59a6d
Removed debug output
githubuser0xFFFF 27d71ee
Fixed restoreDockWidgetsOpenState() function to delete legacy auto hi…
githubuser0xFFFF 58cd91d
Merge branch 'originf_auto_hide_feature' into auto_hide_feature
SyarifFakhri c0247fc
Added option ShowAutoHideOnMouseOver that enables showing of auto hid…
githubuser0xFFFF 279a9d7
Fixed delayed hiding of CAutoHideDockContainer on mouse leave when re…
githubuser0xFFFF 6f5e33a
Added CSS styling for AutoHideTab that is iconOnly
githubuser0xFFFF 32eaf93
Removed some whitespace from focus_highlighting.css
githubuser0xFFFF 35f212a
Fixed Qt6 build
githubuser0xFFFF 99854f6
3f11f74
Some cleanup
githubuser0xFFFF a878308
Merge branch 'auto_hide_feature' of https://github.com/githubuser0xFF…
githubuser0xFFFF a79abbd
Fixed hiding of sidebar if Auto Hide Tab is closed
githubuser0xFFFF 1bf6984
Added feature to apply a Visual Studio like light theme via ToolBar
githubuser0xFFFF 9c53734
Added a small image viewer to the demo application
githubuser0xFFFF bd0b2ad
Improved title bar button tooltips and made naming consistend with co…
githubuser0xFFFF 1b2b903
Auto Hide Tab now shows text as tooltip - for icon only buttons to he…
githubuser0xFFFF e1368be
Added missing render widget to demo application
githubuser0xFFFF aad16f7
Merge branch 'auto_hide_feature' of github.com:githubuser0xFFFF/Qt-Ad…
SyarifFakhri 44a5873
Fixed emission of missing top level event when redocking a auto hide …
githubuser0xFFFF eda6104
Added actions to demo applications to create floating, docked and aut…
githubuser0xFFFF be86a77
Implemented custom close handling for dynamically created image viewers
githubuser0xFFFF 2569e0a
Dynamically created image viewer now loads random image in demo
githubuser0xFFFF 95b627e
Prevent accidental hiding collapsing of an auto hide widget by a mous…
githubuser0xFFFF 6cdea82
Fixed wrong image filename in demo application
githubuser0xFFFF 0073870
Added documentation for Auto-Hide feature
githubuser0xFFFF 5a9f23a
Fixed emission of top level event in DockContainerWidget
githubuser0xFFFF 33e6098
Merge branch 'originf_auto_hide_feature' into auto_hide_feature
SyarifFakhri 64bd902
Fixed bug in dropIntoSection() caused by the addition of AutoHideSide…
githubuser0xFFFF 89cca4c
Reverted file version change for saved state data because the file is…
githubuser0xFFFF 208c804
User rootSplitter() function instead of searching for child widget
githubuser0xFFFF f132255
Added app icon for demo app
githubuser0xFFFF c646d13
Updated ads_logo.svg to fix size for mobile page
githubuser0xFFFF 38dfd51
Merge branch 'master' into auto_hide_feature
githubuser0xFFFF 00c05eb
Merge branch 'auto_hide_feature' of github.com:githubuser0xFFFF/Qt-Ad…
SyarifFakhri 8e7b7f5
Fixed CAutoHideDockContainer::addDockWidget to prevent OldDockArea->r…
githubuser0xFFFF 17bea8c
Merge branch 'auto_hide_feature' of github.com:githubuser0xFFFF/Qt-Ad…
SyarifFakhri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| cmake_minimum_required(VERSION 3.5) | ||
| project(ads_example_centralwidget VERSION ${VERSION_SHORT}) | ||
SyarifFakhri marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) | ||
| find_package(Qt${QT_VERSION_MAJOR} 5.5 COMPONENTS Core Gui Widgets REQUIRED) | ||
| set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
| add_executable(CentralWidgetExample WIN32 | ||
| main.cpp | ||
| mainwindow.cpp | ||
| mainwindow.ui | ||
| ) | ||
| target_include_directories(CentralWidgetExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src") | ||
| target_link_libraries(CentralWidgetExample PRIVATE qtadvanceddocking) | ||
| target_link_libraries(CentralWidgetExample PUBLIC Qt${QT_VERSION_MAJOR}::Core | ||
| Qt${QT_VERSION_MAJOR}::Gui | ||
| Qt${QT_VERSION_MAJOR}::Widgets) | ||
| set_target_properties(CentralWidgetExample PROPERTIES | ||
| AUTOMOC ON | ||
| AUTORCC ON | ||
| AUTOUIC ON | ||
| CXX_STANDARD 14 | ||
| CXX_STANDARD_REQUIRED ON | ||
| CXX_EXTENSIONS OFF | ||
| VERSION ${VERSION_SHORT} | ||
| EXPORT_NAME "Qt Advanced Docking System Central Widget Example" | ||
| ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" | ||
| LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" | ||
| RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #include <mainwindow.h> | ||
| #include <QApplication> | ||
|
|
||
| int main(int argc, char *argv[]) | ||
| { | ||
| QApplication a(argc, argv); | ||
| CMainWindow w; | ||
| w.show(); | ||
| return a.exec(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| import os | ||
| import sys | ||
|
|
||
| from PyQt5 import uic | ||
| from PyQt5.QtCore import Qt, QTimer, QDir, QSignalBlocker | ||
| from PyQt5.QtGui import QCloseEvent, QIcon | ||
| from PyQt5.QtWidgets import (QApplication, QLabel, QCalendarWidget, QFrame, QTreeView, | ||
| QTableWidget, QFileSystemModel, QPlainTextEdit, QToolBar, | ||
| QWidgetAction, QComboBox, QAction, QSizePolicy, QInputDialog) | ||
|
|
||
| from PyQtAds import QtAds | ||
|
|
||
| UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui') | ||
| MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE) | ||
|
|
||
| class MainWindow(MainWindowUI, MainWindowBase): | ||
|
|
||
| def __init__(self, parent=None): | ||
| super().__init__(parent) | ||
|
|
||
| self.setupUi(self) | ||
|
|
||
| QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.OpaqueSplitterResize, True) | ||
| QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.XmlCompressionEnabled, False) | ||
| QtAds.CDockManager.setConfigFlag(QtAds.CDockManager.FocusHighlighting, True) | ||
| self.dock_manager = QtAds.CDockManager(self) | ||
|
|
||
| # Set central widget | ||
| text_edit = QPlainTextEdit() | ||
| text_edit.setPlaceholderText("This is the central editor. Enter your text here.") | ||
| central_dock_widget = QtAds.CDockWidget("CentralWidget") | ||
| central_dock_widget.setWidget(text_edit) | ||
| central_dock_area = self.dock_manager.setCentralWidget(central_dock_widget) | ||
| central_dock_area.setAllowedAreas(QtAds.DockWidgetArea.OuterDockAreas) | ||
|
|
||
| # create other dock widgets | ||
| table = QTableWidget() | ||
| table.setColumnCount(3) | ||
| table.setRowCount(10) | ||
| table_dock_widget = QtAds.CDockWidget("Table 1") | ||
| table_dock_widget.setWidget(table) | ||
| table_dock_widget.setMinimumSizeHintMode(QtAds.CDockWidget.MinimumSizeHintFromDockWidget) | ||
| table_dock_widget.resize(250, 150) | ||
| table_dock_widget.setMinimumSize(200, 150) | ||
| table_area = self.dock_manager.addDockWidget(QtAds.DockWidgetArea.LeftDockWidgetArea, table_dock_widget) | ||
| self.menuView.addAction(table_dock_widget.toggleViewAction()) | ||
|
|
||
| table = QTableWidget() | ||
| table.setColumnCount(5) | ||
| table.setRowCount(1020) | ||
| table_dock_widget = QtAds.CDockWidget("Table 2") | ||
| table_dock_widget.setWidget(table) | ||
| table_dock_widget.setMinimumSizeHintMode(QtAds.CDockWidget.MinimumSizeHintFromDockWidget) | ||
| table_dock_widget.resize(250, 150) | ||
| table_dock_widget.setMinimumSize(200, 150) | ||
| table_area = self.dock_manager.addDockWidget(QtAds.DockWidgetArea.BottomDockWidgetArea, table_dock_widget, table_area) | ||
| self.menuView.addAction(table_dock_widget.toggleViewAction()) | ||
|
|
||
| properties_table = QTableWidget() | ||
| properties_table.setColumnCount(3) | ||
| properties_table.setRowCount(10) | ||
| properties_dock_widget = QtAds.CDockWidget("Properties") | ||
| properties_dock_widget.setWidget(properties_table) | ||
| properties_dock_widget.setMinimumSizeHintMode(QtAds.CDockWidget.MinimumSizeHintFromDockWidget) | ||
| properties_dock_widget.resize(250, 150) | ||
| properties_dock_widget.setMinimumSize(200, 150) | ||
| self.dock_manager.addDockWidget(QtAds.DockWidgetArea.RightDockWidgetArea, properties_dock_widget, central_dock_area) | ||
| self.menuView.addAction(properties_dock_widget.toggleViewAction()) | ||
|
|
||
| self.create_perspective_ui() | ||
|
|
||
| def create_perspective_ui(self): | ||
| save_perspective_action = QAction("Create Perspective", self) | ||
| save_perspective_action.triggered.connect(self.save_perspective) | ||
| perspective_list_action = QWidgetAction(self) | ||
| self.perspective_combobox = QComboBox(self) | ||
| self.perspective_combobox.setSizeAdjustPolicy(QComboBox.AdjustToContents) | ||
| self.perspective_combobox.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) | ||
| self.perspective_combobox.activated[str].connect(self.dock_manager.openPerspective) | ||
| perspective_list_action.setDefaultWidget(self.perspective_combobox) | ||
| self.toolBar.addSeparator() | ||
| self.toolBar.addAction(perspective_list_action) | ||
| self.toolBar.addAction(save_perspective_action) | ||
|
|
||
| def save_perspective(self): | ||
| perspective_name, ok = QInputDialog.getText(self, "Save Perspective", "Enter Unique name:") | ||
| if not ok or not perspective_name: | ||
| return | ||
|
|
||
| self.dock_manager.addPerspective(perspective_name) | ||
| blocker = QSignalBlocker(self.perspective_combobox) | ||
| self.perspective_combobox.clear() | ||
| self.perspective_combobox.addItems(self.dock_manager.perspectiveNames()) | ||
| self.perspective_combobox.setCurrentText(perspective_name) | ||
|
|
||
| def closeEvent(self, event: QCloseEvent): | ||
| self.dock_manager.deleteLater() | ||
| super().closeEvent(event) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| app = QApplication(sys.argv) | ||
|
|
||
| w = MainWindow() | ||
| w.show() | ||
| app.exec_() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| #include "mainwindow.h" | ||
|
|
||
| #include "ui_mainwindow.h" | ||
|
|
||
| #include <QWidgetAction> | ||
| #include <QLabel> | ||
| #include <QCalendarWidget> | ||
| #include <QTreeView> | ||
| #include <QFileSystemModel> | ||
| #include <QTableWidget> | ||
| #include <QHBoxLayout> | ||
| #include <QRadioButton> | ||
| #include <QPushButton> | ||
| #include <QInputDialog> | ||
| #include <QFileDialog> | ||
| #include <QSettings> | ||
| #include <QMessageBox> | ||
| #include <QPlainTextEdit> | ||
| #include <QToolBar> | ||
|
|
||
| #include "DockAreaWidget.h" | ||
| #include "DockAreaTitleBar.h" | ||
| #include "DockAreaTabBar.h" | ||
| #include "FloatingDockContainer.h" | ||
| #include "DockComponentsFactory.h" | ||
|
|
||
| using namespace ads; | ||
|
|
||
|
|
||
| CMainWindow::CMainWindow(QWidget *parent) | ||
| : QMainWindow(parent) | ||
| , ui(new Ui::CMainWindow) | ||
| { | ||
| ui->setupUi(this); | ||
| CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true); | ||
| CDockManager::setConfigFlag(CDockManager::XmlCompressionEnabled, false); | ||
| CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true); | ||
| DockManager = new CDockManager(this); | ||
|
|
||
| // Set central widget | ||
| QPlainTextEdit* w = new QPlainTextEdit(); | ||
| w->setPlaceholderText("This is the central editor. Enter your text here."); | ||
| CDockWidget* CentralDockWidget = new CDockWidget("CentralWidget"); | ||
| CentralDockWidget->setWidget(w); | ||
| auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget); | ||
| CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas); | ||
|
|
||
| // create other dock widgets | ||
| QTableWidget* table = new QTableWidget(); | ||
| table->setColumnCount(3); | ||
| table->setRowCount(10); | ||
| CDockWidget* TableDockWidget = new CDockWidget("Table 1"); | ||
| TableDockWidget->setWidget(table); | ||
| TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget); | ||
| TableDockWidget->resize(250, 150); | ||
| TableDockWidget->setMinimumSize(200,150); | ||
| auto TableArea = DockManager->addDockWidget(DockWidgetArea::LeftDockWidgetArea, TableDockWidget); | ||
| ui->menuView->addAction(TableDockWidget->toggleViewAction()); | ||
|
|
||
| table = new QTableWidget(); | ||
| table->setColumnCount(5); | ||
| table->setRowCount(1020); | ||
| TableDockWidget = new CDockWidget("Table 2"); | ||
| TableDockWidget->setWidget(table); | ||
| TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget); | ||
| TableDockWidget->resize(250, 150); | ||
| TableDockWidget->setMinimumSize(200,150); | ||
| DockManager->addDockWidget(DockWidgetArea::BottomDockWidgetArea, TableDockWidget, TableArea); | ||
| ui->menuView->addAction(TableDockWidget->toggleViewAction()); | ||
|
|
||
| QTableWidget* propertiesTable = new QTableWidget(); | ||
| propertiesTable->setColumnCount(3); | ||
| propertiesTable->setRowCount(10); | ||
| CDockWidget* PropertiesDockWidget = new CDockWidget("Properties"); | ||
| PropertiesDockWidget->setWidget(propertiesTable); | ||
| PropertiesDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget); | ||
| PropertiesDockWidget->resize(250, 150); | ||
| PropertiesDockWidget->setMinimumSize(200,150); | ||
| DockManager->addDockWidget(DockWidgetArea::RightDockWidgetArea, PropertiesDockWidget, CentralDockArea); | ||
| ui->menuView->addAction(PropertiesDockWidget->toggleViewAction()); | ||
|
|
||
| createPerspectiveUi(); | ||
| } | ||
|
|
||
| CMainWindow::~CMainWindow() | ||
| { | ||
| delete ui; | ||
| } | ||
|
|
||
|
|
||
| void CMainWindow::createPerspectiveUi() | ||
| { | ||
| SavePerspectiveAction = new QAction("Create Perspective", this); | ||
| connect(SavePerspectiveAction, SIGNAL(triggered()), SLOT(savePerspective())); | ||
| PerspectiveListAction = new QWidgetAction(this); | ||
| PerspectiveComboBox = new QComboBox(this); | ||
| PerspectiveComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents); | ||
| PerspectiveComboBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); | ||
| connect(PerspectiveComboBox, SIGNAL(currentTextChanged(const QString&)), | ||
| DockManager, SLOT(openPerspective(const QString&))); | ||
| PerspectiveListAction->setDefaultWidget(PerspectiveComboBox); | ||
| ui->toolBar->addSeparator(); | ||
| ui->toolBar->addAction(PerspectiveListAction); | ||
| ui->toolBar->addAction(SavePerspectiveAction); | ||
| } | ||
|
|
||
|
|
||
| void CMainWindow::savePerspective() | ||
| { | ||
| QString PerspectiveName = QInputDialog::getText(this, "Save Perspective", "Enter unique name:"); | ||
| if (PerspectiveName.isEmpty()) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| DockManager->addPerspective(PerspectiveName); | ||
| QSignalBlocker Blocker(PerspectiveComboBox); | ||
| PerspectiveComboBox->clear(); | ||
| PerspectiveComboBox->addItems(DockManager->perspectiveNames()); | ||
| PerspectiveComboBox->setCurrentText(PerspectiveName); | ||
| } | ||
|
|
||
|
|
||
| //============================================================================ | ||
| void CMainWindow::closeEvent(QCloseEvent* event) | ||
| { | ||
| // Delete dock manager here to delete all floating widgets. This ensures | ||
| // that all top level windows of the dock manager are properly closed | ||
| DockManager->deleteLater(); | ||
| QMainWindow::closeEvent(event); | ||
| } | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #ifndef MAINWINDOW_H | ||
| #define MAINWINDOW_H | ||
|
|
||
| #include <QMainWindow> | ||
| #include <QComboBox> | ||
| #include <QWidgetAction> | ||
|
|
||
| #include "DockManager.h" | ||
| #include "DockAreaWidget.h" | ||
| #include "DockWidget.h" | ||
|
|
||
| QT_BEGIN_NAMESPACE | ||
| namespace Ui { class CMainWindow; } | ||
| QT_END_NAMESPACE | ||
|
|
||
| class CMainWindow : public QMainWindow | ||
| { | ||
| Q_OBJECT | ||
|
|
||
| public: | ||
| CMainWindow(QWidget *parent = nullptr); | ||
| ~CMainWindow(); | ||
|
|
||
| protected: | ||
| virtual void closeEvent(QCloseEvent* event) override; | ||
|
|
||
| private: | ||
| QAction* SavePerspectiveAction = nullptr; | ||
| QWidgetAction* PerspectiveListAction = nullptr; | ||
| QComboBox* PerspectiveComboBox = nullptr; | ||
|
|
||
| Ui::CMainWindow *ui; | ||
|
|
||
| ads::CDockManager* DockManager; | ||
| ads::CDockAreaWidget* StatusDockArea; | ||
| ads::CDockWidget* TimelineDockWidget; | ||
|
|
||
| void createPerspectiveUi(); | ||
|
|
||
| private slots: | ||
| void savePerspective(); | ||
| }; | ||
| #endif // MAINWINDOW_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <ui version="4.0"> | ||
| <class>CMainWindow</class> | ||
| <widget class="QMainWindow" name="CMainWindow"> | ||
| <property name="geometry"> | ||
| <rect> | ||
| <x>0</x> | ||
| <y>0</y> | ||
| <width>1284</width> | ||
| <height>757</height> | ||
| </rect> | ||
| </property> | ||
| <property name="windowTitle"> | ||
| <string>MainWindow</string> | ||
| </property> | ||
| <widget class="QWidget" name="centralwidget"/> | ||
| <widget class="QMenuBar" name="menubar"> | ||
| <property name="geometry"> | ||
| <rect> | ||
| <x>0</x> | ||
| <y>0</y> | ||
| <width>1284</width> | ||
| <height>21</height> | ||
| </rect> | ||
| </property> | ||
| <widget class="QMenu" name="menuView"> | ||
| <property name="title"> | ||
| <string>View</string> | ||
| </property> | ||
| </widget> | ||
| <addaction name="menuView"/> | ||
| </widget> | ||
| <widget class="QToolBar" name="toolBar"> | ||
| <property name="windowTitle"> | ||
| <string>toolBar</string> | ||
| </property> | ||
| <attribute name="toolBarArea"> | ||
| <enum>TopToolBarArea</enum> | ||
| </attribute> | ||
| <attribute name="toolBarBreak"> | ||
| <bool>false</bool> | ||
| </attribute> | ||
| </widget> | ||
| </widget> | ||
| <resources/> | ||
| <connections/> | ||
| </ui> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.