mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-03-16 02:59:51 +08:00
Add option to always show all tabs (#102)
* Add option to always show tabs. * Disable "Detach" context menu option in tab if there is only one tab in the floating container.
This commit is contained in:
parent
d4c179c48e
commit
dd06d84206
@ -702,6 +702,11 @@ void CDockAreaWidget::updateTitleBarVisibility()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CDockManager::configFlags().testFlag(CDockManager::AlwaysShowTabs))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (d->TitleBar)
|
if (d->TitleBar)
|
||||||
{
|
{
|
||||||
d->TitleBar->setVisible(!Container->isFloating() || !Container->hasTopLevelDockWidget());
|
d->TitleBar->setVisible(!Container->isFloating() || !Container->hasTopLevelDockWidget());
|
||||||
|
@ -130,14 +130,6 @@ protected:
|
|||||||
*/
|
*/
|
||||||
CDockAreaWidget* lastAddedDockAreaWidget(DockWidgetArea area) const;
|
CDockAreaWidget* lastAddedDockAreaWidget(DockWidgetArea area) const;
|
||||||
|
|
||||||
/**
|
|
||||||
* This function returns true if this dock area has only one single
|
|
||||||
* visible dock widget.
|
|
||||||
* A top level widget is a real floating widget. Only the isFloating()
|
|
||||||
* function of top level widgets may returns true.
|
|
||||||
*/
|
|
||||||
bool hasTopLevelDockWidget() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If hasSingleVisibleDockWidget() returns true, this function returns the
|
* If hasSingleVisibleDockWidget() returns true, this function returns the
|
||||||
* one and only visible dock widget. Otherwise it returns a nullptr.
|
* one and only visible dock widget. Otherwise it returns a nullptr.
|
||||||
@ -214,6 +206,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
QList<CDockAreaWidget*> openedDockAreas() const;
|
QList<CDockAreaWidget*> openedDockAreas() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function returns true if this dock area has only one single
|
||||||
|
* visible dock widget.
|
||||||
|
* A top level widget is a real floating widget. Only the isFloating()
|
||||||
|
* function of top level widgets may returns true.
|
||||||
|
*/
|
||||||
|
bool hasTopLevelDockWidget() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of dock areas in this container
|
* Returns the number of dock areas in this container
|
||||||
*/
|
*/
|
||||||
|
@ -156,6 +156,7 @@ public:
|
|||||||
DragPreviewIsDynamic = 0x0400,///< If opaque undocking is disabled, this flag defines the behavior of the drag preview window, if this flag is enabled, the preview will be adjusted dynamically to the drop area
|
DragPreviewIsDynamic = 0x0400,///< If opaque undocking is disabled, this flag defines the behavior of the drag preview window, if this flag is enabled, the preview will be adjusted dynamically to the drop area
|
||||||
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
|
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
|
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,
|
||||||
DefaultConfig = ActiveTabHasCloseButton
|
DefaultConfig = ActiveTabHasCloseButton
|
||||||
| DockAreaHasCloseButton
|
| DockAreaHasCloseButton
|
||||||
| OpaqueSplitterResize
|
| OpaqueSplitterResize
|
||||||
|
@ -426,8 +426,14 @@ void CDockWidgetTab::contextMenuEvent(QContextMenuEvent* ev)
|
|||||||
|
|
||||||
d->GlobalDragStartMousePosition = ev->globalPos();
|
d->GlobalDragStartMousePosition = ev->globalPos();
|
||||||
QMenu Menu(this);
|
QMenu Menu(this);
|
||||||
|
|
||||||
|
const bool isFloatable = d->DockWidget->features().testFlag(CDockWidget::DockWidgetFloatable);
|
||||||
|
const bool isNotOnlyTabInContainer = !d->DockArea->dockContainer()->hasTopLevelDockWidget();
|
||||||
|
|
||||||
|
const bool isDetachable = isFloatable && isNotOnlyTabInContainer;
|
||||||
|
|
||||||
auto Action = Menu.addAction(tr("Detach"), this, SLOT(detachDockWidget()));
|
auto Action = Menu.addAction(tr("Detach"), this, SLOT(detachDockWidget()));
|
||||||
Action->setEnabled(d->DockWidget->features().testFlag(CDockWidget::DockWidgetFloatable));
|
Action->setEnabled(isDetachable);
|
||||||
Menu.addSeparator();
|
Menu.addSeparator();
|
||||||
Action = Menu.addAction(tr("Close"), this, SIGNAL(closeRequested()));
|
Action = Menu.addAction(tr("Close"), this, SIGNAL(closeRequested()));
|
||||||
Action->setEnabled(isClosable());
|
Action->setEnabled(isClosable());
|
||||||
|
Loading…
Reference in New Issue
Block a user