mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 07:21:32 +08:00
Added DockAreaHasTabsMenuButton and DockAreaHasUndockButton to CDockManager config (#108)
* Added DockAreaHasUndockButton and DockAreaHasTabsMenuButton configuration flag
This commit is contained in:
parent
1dbd3f3f06
commit
1d68e27558
@ -418,12 +418,19 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
||||
// comment the following line if you want to use opaque undocking and
|
||||
// opaque splitter resizing
|
||||
CDockManager::setConfigFlags(CDockManager::DefaultNonOpaqueConfig);
|
||||
//CDockManager::setConfigFlag(CDockManager::DockAreaHasCloseButton, false);
|
||||
|
||||
// uncomment the following line if you want a fixed tab width that does
|
||||
// not change if the visibility of the close button changes
|
||||
//CDockManager::setConfigFlag(CDockManager::RetainTabSizeWhenCloseButtonHidden, true);
|
||||
|
||||
// uncomment the following line if you don't want close button on DockArea's title bar
|
||||
//CDockManager::setConfigFlag(CDockManager::DockAreaHasCloseButton, false);
|
||||
|
||||
// uncomment the following line if you don't want undock button on DockArea's title bar
|
||||
//CDockManager::setConfigFlag(CDockManager::DockAreaHasUndockButton, false);
|
||||
|
||||
// uncomment the following line if you don't want tabs menu button on DockArea's title bar
|
||||
//CDockManager::setConfigFlag(CDockManager::DockAreaHasTabsMenuButton, false);
|
||||
|
||||
// Now create the dock manager and its content
|
||||
d->DockManager = new CDockManager(this);
|
||||
|
@ -167,38 +167,53 @@ DockAreaTitleBarPrivate::DockAreaTitleBarPrivate(CDockAreaTitleBar* _public) :
|
||||
void DockAreaTitleBarPrivate::createButtons()
|
||||
{
|
||||
QSizePolicy ButtonSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||
// Tabs menu button
|
||||
TabsMenuButton = new tTitleBarButton();
|
||||
TabsMenuButton->setObjectName("tabsMenuButton");
|
||||
TabsMenuButton->setAutoRaise(true);
|
||||
TabsMenuButton->setPopupMode(QToolButton::InstantPopup);
|
||||
setTitleBarButtonIcon(TabsMenuButton, QStyle::SP_TitleBarUnshadeButton, ads::DockAreaMenuIcon);
|
||||
QMenu* TabsMenu = new QMenu(TabsMenuButton);
|
||||
|
||||
if (testConfigFlag(CDockManager::DockAreaHasTabsMenuButton))
|
||||
{
|
||||
// Tabs menu button
|
||||
TabsMenuButton = new tTitleBarButton();
|
||||
TabsMenuButton->setObjectName("tabsMenuButton");
|
||||
TabsMenuButton->setAutoRaise(true);
|
||||
TabsMenuButton->setPopupMode(QToolButton::InstantPopup);
|
||||
setTitleBarButtonIcon(TabsMenuButton, QStyle::SP_TitleBarUnshadeButton, ads::DockAreaMenuIcon);
|
||||
QMenu* TabsMenu = new QMenu(TabsMenuButton);
|
||||
#ifndef QT_NO_TOOLTIP
|
||||
TabsMenu->setToolTipsVisible(true);
|
||||
TabsMenu->setToolTipsVisible(true);
|
||||
#endif
|
||||
_this->connect(TabsMenu, SIGNAL(aboutToShow()), SLOT(onTabsMenuAboutToShow()));
|
||||
TabsMenuButton->setMenu(TabsMenu);
|
||||
_this->connect(TabsMenu, SIGNAL(aboutToShow()), SLOT(onTabsMenuAboutToShow()));
|
||||
TabsMenuButton->setMenu(TabsMenu);
|
||||
#ifndef QT_NO_TOOLTIP
|
||||
TabsMenuButton->setToolTip(QObject::tr("List all tabs"));
|
||||
TabsMenuButton->setToolTip(QObject::tr("List all tabs"));
|
||||
#endif
|
||||
TabsMenuButton->setSizePolicy(ButtonSizePolicy);
|
||||
TopLayout->addWidget(TabsMenuButton, 0);
|
||||
_this->connect(TabsMenuButton->menu(), SIGNAL(triggered(QAction*)),
|
||||
SLOT(onTabsMenuActionTriggered(QAction*)));
|
||||
TabsMenuButton->setSizePolicy(ButtonSizePolicy);
|
||||
TopLayout->addWidget(TabsMenuButton, 0);
|
||||
_this->connect(TabsMenuButton->menu(), SIGNAL(triggered(QAction*)),
|
||||
SLOT(onTabsMenuActionTriggered(QAction*)));
|
||||
}
|
||||
else
|
||||
{
|
||||
TabsMenuButton = new CInvisibleButton();
|
||||
}
|
||||
|
||||
|
||||
// Undock button
|
||||
UndockButton = new tTitleBarButton();
|
||||
UndockButton->setObjectName("undockButton");
|
||||
UndockButton->setAutoRaise(true);
|
||||
if (testConfigFlag(CDockManager::DockAreaHasUndockButton))
|
||||
{
|
||||
// Undock button
|
||||
UndockButton = new tTitleBarButton();
|
||||
UndockButton->setObjectName("undockButton");
|
||||
UndockButton->setAutoRaise(true);
|
||||
#ifndef QT_NO_TOOLTIP
|
||||
UndockButton->setToolTip(QObject::tr("Detach Group"));
|
||||
UndockButton->setToolTip(QObject::tr("Detach Group"));
|
||||
#endif
|
||||
setTitleBarButtonIcon(UndockButton, QStyle::SP_TitleBarNormalButton, ads::DockAreaUndockIcon);
|
||||
UndockButton->setSizePolicy(ButtonSizePolicy);
|
||||
TopLayout->addWidget(UndockButton, 0);
|
||||
_this->connect(UndockButton, SIGNAL(clicked()), SLOT(onUndockButtonClicked()));
|
||||
setTitleBarButtonIcon(UndockButton, QStyle::SP_TitleBarNormalButton, ads::DockAreaUndockIcon);
|
||||
UndockButton->setSizePolicy(ButtonSizePolicy);
|
||||
TopLayout->addWidget(UndockButton, 0);
|
||||
_this->connect(UndockButton, SIGNAL(clicked()), SLOT(onUndockButtonClicked()));
|
||||
}
|
||||
else
|
||||
{
|
||||
UndockButton = new CInvisibleButton();
|
||||
}
|
||||
|
||||
if (testConfigFlag(CDockManager::DockAreaHasCloseButton))
|
||||
{
|
||||
|
@ -157,17 +157,25 @@ public:
|
||||
DragPreviewShowsContentPixmap = 0x0800,///< If opaque undocking is disabled, the created drag preview window shows a copy of the content of the dock widget / dock are that is dragged
|
||||
DragPreviewHasWindowFrame = 0x1000,///< If opaque undocking is disabled, then this flag configures if the drag preview is frameless or looks like a real window
|
||||
AlwaysShowTabs = 0x2000,///< If this option is enabled, the tab of a dock widget is always displayed - even if it is the only visible dock widget in a floating widget.
|
||||
DockAreaHasUndockButton = 0x4000, //!< If the flag is set each dock area has an undock button
|
||||
DockAreaHasTabsMenuButton = 0x8000, //!< If the flag is set each dock area has a tabs menu button
|
||||
DefaultConfig = ActiveTabHasCloseButton
|
||||
| DockAreaHasCloseButton
|
||||
| DockAreaHasUndockButton
|
||||
| DockAreaHasTabsMenuButton
|
||||
| OpaqueSplitterResize
|
||||
| XmlCompressionEnabled
|
||||
| OpaqueUndocking, ///< the default configuration
|
||||
DefaultNonOpaqueConfig = ActiveTabHasCloseButton
|
||||
| DockAreaHasCloseButton
|
||||
| DockAreaHasUndockButton
|
||||
| DockAreaHasTabsMenuButton
|
||||
| XmlCompressionEnabled
|
||||
| DragPreviewShowsContentPixmap, ///< the default configuration for non opaque operations
|
||||
NonOpaqueWithWindowFrame = ActiveTabHasCloseButton
|
||||
| DockAreaHasCloseButton
|
||||
| DockAreaHasUndockButton
|
||||
| DockAreaHasTabsMenuButton
|
||||
| XmlCompressionEnabled
|
||||
| DragPreviewShowsContentPixmap
|
||||
| DragPreviewHasWindowFrame ///< the default configuration for non opaque operations that show a real window with frame
|
||||
|
Loading…
Reference in New Issue
Block a user