mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 15:41:34 +08:00
Added setHideSingleWidgetTitleBar to DockWidgetArea
This commit is contained in:
parent
81c99745d4
commit
8443414ae3
@ -399,6 +399,9 @@ void MainWindowPrivate::createContent()
|
||||
// Test custom factory - we inject a help button into the title bar
|
||||
ads::CDockComponentsFactory::setFactory(new CCustomComponentsFactory());
|
||||
auto TopDockArea = DockManager->addDockWidget(ads::TopDockWidgetArea, FileSystemWidget);
|
||||
// Uncomment the next line if you would like to test the
|
||||
// setHideSingleWidgetTitleBar() functionality
|
||||
// TopDockArea->setHideSingleWidgetTitleBar(true);
|
||||
ads::CDockComponentsFactory::resetDefaultFactory();
|
||||
|
||||
// We create a calendar widget and clear all flags to prevent the dock area
|
||||
|
@ -30,8 +30,6 @@
|
||||
//============================================================================
|
||||
#include "DockAreaWidget.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <QStackedLayout>
|
||||
#include <QScrollBar>
|
||||
#include <QScrollArea>
|
||||
@ -251,6 +249,7 @@ struct DockAreaWidgetPrivate
|
||||
CDockManager* DockManager = nullptr;
|
||||
bool UpdateTitleBarButtons = false;
|
||||
DockWidgetAreas AllowedAreas = AllDockAreas;
|
||||
bool HideSingleWidgetTitleBar = false;
|
||||
QSize MinSizeHint;
|
||||
|
||||
/**
|
||||
@ -747,6 +746,7 @@ void CDockAreaWidget::updateTitleBarVisibility()
|
||||
{
|
||||
bool Hidden = Container->hasTopLevelDockWidget() && (Container->isFloating()
|
||||
|| CDockManager::testConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar));
|
||||
Hidden |= (d->HideSingleWidgetTitleBar && openDockWidgetsCount() == 1);
|
||||
d->TitleBar->setVisible(!Hidden);
|
||||
}
|
||||
}
|
||||
@ -850,16 +850,28 @@ void CDockAreaWidget::setVisible(bool Visible)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaWidget::setAllowedAreas(DockWidgetAreas areas)
|
||||
{
|
||||
d->AllowedAreas = areas;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
DockWidgetAreas CDockAreaWidget::allowedAreas() const
|
||||
{
|
||||
return d->AllowedAreas;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaWidget::setHideSingleWidgetTitleBar(bool hide)
|
||||
{
|
||||
d->HideSingleWidgetTitleBar = hide;
|
||||
updateTitleBarVisibility();
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
QAbstractButton* CDockAreaWidget::titleBarButton(TitleBarButton which) const
|
||||
{
|
||||
|
@ -272,6 +272,12 @@ public:
|
||||
*/
|
||||
DockWidgetAreas allowedAreas() const;
|
||||
|
||||
/**
|
||||
* Will hide the title bar when set to true and there is only one
|
||||
* dock widget in this area
|
||||
*/
|
||||
void setHideSingleWidgetTitleBar(bool hide);
|
||||
|
||||
/**
|
||||
* Returns the title bar of this dock area
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user