mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 07:31:33 +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
|
// Test custom factory - we inject a help button into the title bar
|
||||||
ads::CDockComponentsFactory::setFactory(new CCustomComponentsFactory());
|
ads::CDockComponentsFactory::setFactory(new CCustomComponentsFactory());
|
||||||
auto TopDockArea = DockManager->addDockWidget(ads::TopDockWidgetArea, FileSystemWidget);
|
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();
|
ads::CDockComponentsFactory::resetDefaultFactory();
|
||||||
|
|
||||||
// We create a calendar widget and clear all flags to prevent the dock area
|
// We create a calendar widget and clear all flags to prevent the dock area
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
#include "DockAreaWidget.h"
|
#include "DockAreaWidget.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <QStackedLayout>
|
#include <QStackedLayout>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
@ -251,6 +249,7 @@ struct DockAreaWidgetPrivate
|
|||||||
CDockManager* DockManager = nullptr;
|
CDockManager* DockManager = nullptr;
|
||||||
bool UpdateTitleBarButtons = false;
|
bool UpdateTitleBarButtons = false;
|
||||||
DockWidgetAreas AllowedAreas = AllDockAreas;
|
DockWidgetAreas AllowedAreas = AllDockAreas;
|
||||||
|
bool HideSingleWidgetTitleBar = false;
|
||||||
QSize MinSizeHint;
|
QSize MinSizeHint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -747,6 +746,7 @@ void CDockAreaWidget::updateTitleBarVisibility()
|
|||||||
{
|
{
|
||||||
bool Hidden = Container->hasTopLevelDockWidget() && (Container->isFloating()
|
bool Hidden = Container->hasTopLevelDockWidget() && (Container->isFloating()
|
||||||
|| CDockManager::testConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar));
|
|| CDockManager::testConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar));
|
||||||
|
Hidden |= (d->HideSingleWidgetTitleBar && openDockWidgetsCount() == 1);
|
||||||
d->TitleBar->setVisible(!Hidden);
|
d->TitleBar->setVisible(!Hidden);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -850,16 +850,28 @@ void CDockAreaWidget::setVisible(bool Visible)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
void CDockAreaWidget::setAllowedAreas(DockWidgetAreas areas)
|
void CDockAreaWidget::setAllowedAreas(DockWidgetAreas areas)
|
||||||
{
|
{
|
||||||
d->AllowedAreas = areas;
|
d->AllowedAreas = areas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
DockWidgetAreas CDockAreaWidget::allowedAreas() const
|
DockWidgetAreas CDockAreaWidget::allowedAreas() const
|
||||||
{
|
{
|
||||||
return d->AllowedAreas;
|
return d->AllowedAreas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockAreaWidget::setHideSingleWidgetTitleBar(bool hide)
|
||||||
|
{
|
||||||
|
d->HideSingleWidgetTitleBar = hide;
|
||||||
|
updateTitleBarVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
QAbstractButton* CDockAreaWidget::titleBarButton(TitleBarButton which) const
|
QAbstractButton* CDockAreaWidget::titleBarButton(TitleBarButton which) const
|
||||||
{
|
{
|
||||||
|
@ -272,6 +272,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
DockWidgetAreas allowedAreas() const;
|
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
|
* Returns the title bar of this dock area
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user