mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 07:31:33 +08:00
Merge branch 'master' into custom_titlebar
This commit is contained in:
commit
93394577d0
@ -42,6 +42,7 @@ set(ads_SRCS
|
|||||||
src/FloatingDockContainer.cpp
|
src/FloatingDockContainer.cpp
|
||||||
src/FloatingDragPreview.cpp
|
src/FloatingDragPreview.cpp
|
||||||
src/IconProvider.cpp
|
src/IconProvider.cpp
|
||||||
|
src/DockComponentsFactory.cpp
|
||||||
src/ads.qrc
|
src/ads.qrc
|
||||||
src/linux/FloatingWidgetTitleBar.cpp
|
src/linux/FloatingWidgetTitleBar.cpp
|
||||||
)
|
)
|
||||||
@ -61,6 +62,7 @@ set(ads_INSTALL_INCLUDE
|
|||||||
src/FloatingDockContainer.h
|
src/FloatingDockContainer.h
|
||||||
src/FloatingDragPreview.h
|
src/FloatingDragPreview.h
|
||||||
src/IconProvider.h
|
src/IconProvider.h
|
||||||
|
src/DockComponentsFactory.h
|
||||||
src/linux/FloatingWidgetTitleBar.h
|
src/linux/FloatingWidgetTitleBar.h
|
||||||
)
|
)
|
||||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
|
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
|
||||||
|
@ -73,6 +73,8 @@
|
|||||||
#include "DockAreaTitleBar.h"
|
#include "DockAreaTitleBar.h"
|
||||||
#include "DockAreaTabBar.h"
|
#include "DockAreaTabBar.h"
|
||||||
#include "FloatingDockContainer.h"
|
#include "FloatingDockContainer.h"
|
||||||
|
#include "DockComponentsFactory.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -142,6 +144,25 @@ static QIcon svgIcon(const QString& File)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
class CCustomComponentsFactory : public ads::CDockComponentsFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using Super = ads::CDockComponentsFactory;
|
||||||
|
ads::CDockAreaTitleBar* createDockAreaTitleBar(ads::CDockAreaWidget* DockArea) const override
|
||||||
|
{
|
||||||
|
auto TitleBar = new ads::CDockAreaTitleBar(DockArea);
|
||||||
|
auto CustomButton = new QToolButton(DockArea);
|
||||||
|
CustomButton->setToolTip(QObject::tr("Help"));
|
||||||
|
CustomButton->setIcon(svgIcon(":/adsdemo/images/help_outline.svg"));
|
||||||
|
CustomButton->setAutoRaise(true);
|
||||||
|
int Index = TitleBar->indexOf(TitleBar->button(ads::TitleBarButtonTabsMenu));
|
||||||
|
TitleBar->insertWidget(Index + 1, CustomButton);
|
||||||
|
return TitleBar;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
static ads::CDockWidget* createCalendarDockWidget(QMenu* ViewMenu)
|
static ads::CDockWidget* createCalendarDockWidget(QMenu* ViewMenu)
|
||||||
{
|
{
|
||||||
@ -202,28 +223,29 @@ static ads::CDockWidget* createEditorWidget(QMenu* ViewMenu)
|
|||||||
return DockWidget;
|
return DockWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
static ads::CDockWidget* createTableWidget(QMenu* ViewMenu)
|
static ads::CDockWidget* createTableWidget(QMenu* ViewMenu)
|
||||||
{
|
{
|
||||||
static int TableCount = 0;
|
static int TableCount = 0;
|
||||||
QTableWidget* w = new QTableWidget();
|
QTableWidget* w = new QTableWidget();
|
||||||
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Table %1").arg(TableCount++));
|
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Table %1").arg(TableCount++));
|
||||||
static int colCount = 5;
|
static int colCount = 5;
|
||||||
static int rowCount = 30;
|
static int rowCount = 30;
|
||||||
w->setColumnCount(colCount);
|
w->setColumnCount(colCount);
|
||||||
w->setRowCount(rowCount);
|
w->setRowCount(rowCount);
|
||||||
for (int col = 0; col < colCount; ++col)
|
for (int col = 0; col < colCount; ++col)
|
||||||
{
|
{
|
||||||
w->setHorizontalHeaderItem(col, new QTableWidgetItem(QString("Col %1").arg(col+1)));
|
w->setHorizontalHeaderItem(col, new QTableWidgetItem(QString("Col %1").arg(col+1)));
|
||||||
for (int row = 0; row < rowCount; ++row)
|
for (int row = 0; row < rowCount; ++row)
|
||||||
{
|
{
|
||||||
w->setItem(row, col, new QTableWidgetItem(QString("T %1-%2").arg(row + 1).arg(col+1)));
|
w->setItem(row, col, new QTableWidgetItem(QString("T %1-%2").arg(row + 1).arg(col+1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DockWidget->setWidget(w);
|
DockWidget->setWidget(w);
|
||||||
DockWidget->setIcon(svgIcon(":/adsdemo/images/grid_on.svg"));
|
DockWidget->setIcon(svgIcon(":/adsdemo/images/grid_on.svg"));
|
||||||
ViewMenu->addAction(DockWidget->toggleViewAction());
|
ViewMenu->addAction(DockWidget->toggleViewAction());
|
||||||
return DockWidget;
|
return DockWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -318,9 +340,13 @@ void MainWindowPrivate::createContent()
|
|||||||
FileSystemWidget->setFeature(ads::CDockWidget::DockWidgetMovable, false);
|
FileSystemWidget->setFeature(ads::CDockWidget::DockWidgetMovable, false);
|
||||||
FileSystemWidget->setFeature(ads::CDockWidget::DockWidgetFloatable, false);
|
FileSystemWidget->setFeature(ads::CDockWidget::DockWidgetFloatable, false);
|
||||||
appendFeaturStringToWindowTitle(FileSystemWidget);
|
appendFeaturStringToWindowTitle(FileSystemWidget);
|
||||||
auto TopDockArea = DockManager->addDockWidget(ads::TopDockWidgetArea, FileSystemWidget);
|
|
||||||
|
|
||||||
// We create a calender widget and clear all flags to prevent the dock area
|
// Test custom factory - we inject a help button into the title bar
|
||||||
|
ads::CDockComponentsFactory::setFactory(new CCustomComponentsFactory());
|
||||||
|
auto TopDockArea = DockManager->addDockWidget(ads::TopDockWidgetArea, FileSystemWidget);
|
||||||
|
ads::CDockComponentsFactory::resetDefaultFactory();
|
||||||
|
|
||||||
|
// We create a calendar widget and clear all flags to prevent the dock area
|
||||||
// from closing
|
// from closing
|
||||||
DockWidget = createCalendarDockWidget(ViewMenu);
|
DockWidget = createCalendarDockWidget(ViewMenu);
|
||||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetClosable, false);
|
DockWidget->setFeature(ads::CDockWidget::DockWidgetClosable, false);
|
||||||
@ -481,6 +507,12 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
|||||||
// uncomment the following line if you want to show tabs menu button on DockArea's title bar only when there are more than one tab and at least of them has elided title
|
// uncomment the following line if you want to show tabs menu button on DockArea's title bar only when there are more than one tab and at least of them has elided title
|
||||||
//CDockManager::setConfigFlag(CDockManager::DockAreaDynamicTabsMenuButtonVisibility, true);
|
//CDockManager::setConfigFlag(CDockManager::DockAreaDynamicTabsMenuButtonVisibility, true);
|
||||||
|
|
||||||
|
// uncomment the following line if you want floating container to always show application title instead of active dock widget's title
|
||||||
|
//CDockManager::setConfigFlag(CDockManager::FloatingContainerHasWidgetTitle, false);
|
||||||
|
|
||||||
|
// uncomment the following line if you want floating container to show active dock widget's icon instead of always showing application icon
|
||||||
|
//CDockManager::setConfigFlag(CDockManager::FloatingContainerHasWidgetIcon, true);
|
||||||
|
|
||||||
// Now create the dock manager and its content
|
// Now create the dock manager and its content
|
||||||
d->DockManager = new CDockManager(this);
|
d->DockManager = new CDockManager(this);
|
||||||
|
|
||||||
|
@ -12,5 +12,6 @@
|
|||||||
<file>images/custom-menu-button.svg</file>
|
<file>images/custom-menu-button.svg</file>
|
||||||
<file>app.css</file>
|
<file>app.css</file>
|
||||||
<file>images/plus.svg</file>
|
<file>images/plus.svg</file>
|
||||||
|
<file>images/help_outline.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
6
demo/images/help_outline.svg
Normal file
6
demo/images/help_outline.svg
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,1024,1024">
|
||||||
|
<desc>help_outline icon - Licensed under Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) - Created with Iconfu.com - Derivative work of Material icons (Copyright Google Inc.)</desc>
|
||||||
|
<g fill="#03b8e5" fill-rule="nonzero" style="mix-blend-mode: normal">
|
||||||
|
<path d="M938.67,512c0,235.52 -191.15,426.67 -426.67,426.67c-235.52,0 -426.67,-191.15 -426.67,-426.67c0,-235.52 191.15,-426.67 426.67,-426.67c235.52,0 426.67,191.15 426.67,426.67zM853.33,512c0,-188.16 -153.17,-341.33 -341.33,-341.33c-188.16,0 -341.33,153.17 -341.33,341.33c0,188.16 153.17,341.33 341.33,341.33c188.16,0 341.33,-153.17 341.33,-341.33zM682.67,426.67c0,106.67 -128,117.33 -128,213.33h-85.34c0,-138.67 128,-128 128,-213.33c0,-46.93 -38.4,-85.34 -85.33,-85.34c-46.93,0 -85.33,38.41 -85.33,85.34h-85.34c0,-94.29 76.38,-170.67 170.67,-170.67c94.29,0 170.67,76.38 170.67,170.67zM469.33,682.67h85.34v85.33h-85.34z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.0 KiB |
@ -49,6 +49,7 @@
|
|||||||
#include "DockWidgetTab.h"
|
#include "DockWidgetTab.h"
|
||||||
#include "DockAreaTabBar.h"
|
#include "DockAreaTabBar.h"
|
||||||
#include "IconProvider.h"
|
#include "IconProvider.h"
|
||||||
|
#include "DockComponentsFactory.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@ -273,7 +274,7 @@ void DockAreaTitleBarPrivate::createButtons()
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void DockAreaTitleBarPrivate::createTabBar()
|
void DockAreaTitleBarPrivate::createTabBar()
|
||||||
{
|
{
|
||||||
TabBar = new CDockAreaTabBar(DockArea);
|
TabBar = componentsFactory()->createDockAreaTabBar(DockArea);
|
||||||
TabBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
TabBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
||||||
Layout->addWidget(TabBar);
|
Layout->addWidget(TabBar);
|
||||||
_this->connect(TabBar, SIGNAL(tabClosed(int)), SLOT(markTabsMenuOutdated()));
|
_this->connect(TabBar, SIGNAL(tabClosed(int)), SLOT(markTabsMenuOutdated()));
|
||||||
|
@ -28,9 +28,10 @@
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
// INCLUDES
|
// INCLUDES
|
||||||
//============================================================================
|
//============================================================================
|
||||||
#include "DockWidgetTab.h"
|
|
||||||
#include "DockAreaWidget.h"
|
#include "DockAreaWidget.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include <QStackedLayout>
|
#include <QStackedLayout>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
@ -53,8 +54,8 @@
|
|||||||
#include "DockAreaTabBar.h"
|
#include "DockAreaTabBar.h"
|
||||||
#include "DockSplitter.h"
|
#include "DockSplitter.h"
|
||||||
#include "DockAreaTitleBar.h"
|
#include "DockAreaTitleBar.h"
|
||||||
|
#include "DockComponentsFactory.h"
|
||||||
#include <iostream>
|
#include "DockWidgetTab.h"
|
||||||
|
|
||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
@ -317,7 +318,7 @@ DockAreaWidgetPrivate::DockAreaWidgetPrivate(CDockAreaWidget* _public) :
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void DockAreaWidgetPrivate::createTitleBar()
|
void DockAreaWidgetPrivate::createTitleBar()
|
||||||
{
|
{
|
||||||
TitleBar = new CDockAreaTitleBar(_this);
|
TitleBar = componentsFactory()->createDockAreaTitleBar(_this);
|
||||||
Layout->addWidget(TitleBar);
|
Layout->addWidget(TitleBar);
|
||||||
QObject::connect(tabBar(), &CDockAreaTabBar::tabCloseRequested, _this, &CDockAreaWidget::onTabCloseRequested);
|
QObject::connect(tabBar(), &CDockAreaTabBar::tabCloseRequested, _this, &CDockAreaWidget::onTabCloseRequested);
|
||||||
QObject::connect(TitleBar, &CDockAreaTitleBar::tabBarClicked, _this, &CDockAreaWidget::setCurrentIndex);
|
QObject::connect(TitleBar, &CDockAreaTitleBar::tabBarClicked, _this, &CDockAreaWidget::setCurrentIndex);
|
||||||
|
69
src/DockComponentsFactory.cpp
Normal file
69
src/DockComponentsFactory.cpp
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
//============================================================================
|
||||||
|
/// \file DockComponentsFactory.cpp
|
||||||
|
/// \author Uwe Kindler
|
||||||
|
/// \date 10.02.2020
|
||||||
|
/// \brief Implementation of DockComponentsFactory
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
// INCLUDES
|
||||||
|
//============================================================================
|
||||||
|
#include <DockComponentsFactory.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "DockWidgetTab.h"
|
||||||
|
#include "DockAreaTabBar.h"
|
||||||
|
#include "DockAreaTitleBar.h"
|
||||||
|
#include "DockWidget.h"
|
||||||
|
#include "DockAreaWidget.h"
|
||||||
|
|
||||||
|
namespace ads
|
||||||
|
{
|
||||||
|
static std::unique_ptr<CDockComponentsFactory> DefaultFactory(new CDockComponentsFactory());
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
CDockWidgetTab* CDockComponentsFactory::createDockWidgetTab(CDockWidget* DockWidget) const
|
||||||
|
{
|
||||||
|
return new CDockWidgetTab(DockWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
CDockAreaTabBar* CDockComponentsFactory::createDockAreaTabBar(CDockAreaWidget* DockArea) const
|
||||||
|
{
|
||||||
|
return new CDockAreaTabBar(DockArea);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
CDockAreaTitleBar* CDockComponentsFactory::createDockAreaTitleBar(CDockAreaWidget* DockArea) const
|
||||||
|
{
|
||||||
|
return new CDockAreaTitleBar(DockArea);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
const CDockComponentsFactory* CDockComponentsFactory::factory()
|
||||||
|
{
|
||||||
|
return DefaultFactory.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockComponentsFactory::setFactory(CDockComponentsFactory* Factory)
|
||||||
|
{
|
||||||
|
DefaultFactory.reset(Factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockComponentsFactory::resetDefaultFactory()
|
||||||
|
{
|
||||||
|
DefaultFactory.reset(new CDockComponentsFactory());
|
||||||
|
}
|
||||||
|
} // namespace ads
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// EOF DockComponentsFactory.cpp
|
90
src/DockComponentsFactory.h
Normal file
90
src/DockComponentsFactory.h
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
#ifndef DockComponentsFactoryH
|
||||||
|
#define DockComponentsFactoryH
|
||||||
|
//============================================================================
|
||||||
|
/// \file DockComponentsFactory.h
|
||||||
|
/// \author Uwe Kindler
|
||||||
|
/// \date 10.02.2020
|
||||||
|
/// \brief Declaration of DockComponentsFactory
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
// INCLUDES
|
||||||
|
//============================================================================
|
||||||
|
#include "ads_globals.h"
|
||||||
|
|
||||||
|
namespace ads
|
||||||
|
{
|
||||||
|
class CDockWidgetTab;
|
||||||
|
class CDockAreaTitleBar;
|
||||||
|
class CDockAreaTabBar;
|
||||||
|
class CDockAreaWidget;
|
||||||
|
class CDockWidget;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory for creation of certain GUI elements for the docking framework.
|
||||||
|
* A default unique instance provided by CDockComponentsFactory is used for
|
||||||
|
* creation of all supported components. To inject your custom components,
|
||||||
|
* you can create your own derived dock components factory and register
|
||||||
|
* it via setDefaultFactory() function.
|
||||||
|
* \code
|
||||||
|
* CDockComponentsFactory::setDefaultFactory(new MyComponentsFactory()));
|
||||||
|
* \endcode
|
||||||
|
*/
|
||||||
|
class ADS_EXPORT CDockComponentsFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Force virtual destructor
|
||||||
|
*/
|
||||||
|
virtual ~CDockComponentsFactory() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This default implementation just creates a dock widget tab with
|
||||||
|
* new CDockWidgetTab(DockWIdget).
|
||||||
|
*/
|
||||||
|
virtual CDockWidgetTab* createDockWidgetTab(CDockWidget* DockWidget) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This default implementation just creates a dock area tab bar with
|
||||||
|
* new CDockAreaTabBar(DockArea).
|
||||||
|
*/
|
||||||
|
virtual CDockAreaTabBar* createDockAreaTabBar(CDockAreaWidget* DockArea) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This default implementation just creates a dock area title bar with
|
||||||
|
* new CDockAreaTitleBar(DockArea).
|
||||||
|
*/
|
||||||
|
virtual CDockAreaTitleBar* createDockAreaTitleBar(CDockAreaWidget* DockArea) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the default components factory
|
||||||
|
*/
|
||||||
|
static const CDockComponentsFactory* factory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a new default factory for creation of GUI elements.
|
||||||
|
* This function takes ownership of the given Factory.
|
||||||
|
*/
|
||||||
|
static void setFactory(CDockComponentsFactory* Factory);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the current factory to the
|
||||||
|
*/
|
||||||
|
static void resetDefaultFactory();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience function to ease factory instance access
|
||||||
|
*/
|
||||||
|
inline const CDockComponentsFactory* componentsFactory()
|
||||||
|
{
|
||||||
|
return CDockComponentsFactory::factory();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ads
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#endif // DockComponentsFactoryH
|
@ -59,6 +59,7 @@ class CDockWidgetTab;
|
|||||||
struct DockWidgetTabPrivate;
|
struct DockWidgetTabPrivate;
|
||||||
struct DockAreaWidgetPrivate;
|
struct DockAreaWidgetPrivate;
|
||||||
class CIconProvider;
|
class CIconProvider;
|
||||||
|
class CDockComponentsFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The central dock manager that maintains the complete docking system.
|
* The central dock manager that maintains the complete docking system.
|
||||||
@ -162,6 +163,8 @@ public:
|
|||||||
DockAreaHasTabsMenuButton = 0x8000, //!< If the flag is set each dock area has a tabs menu button
|
DockAreaHasTabsMenuButton = 0x8000, //!< If the flag is set each dock area has a tabs menu button
|
||||||
DockAreaHideDisabledButtons = 0x10000, //!< If the flag is set disabled dock area buttons will not appear on the tollbar at all (enabling them will bring them back)
|
DockAreaHideDisabledButtons = 0x10000, //!< If the flag is set disabled dock area buttons will not appear on the tollbar at all (enabling them will bring them back)
|
||||||
DockAreaDynamicTabsMenuButtonVisibility = 0x20000, //!< If the flag is set dock area will disable a tabs menu button when there is only one tab in the area
|
DockAreaDynamicTabsMenuButtonVisibility = 0x20000, //!< If the flag is set dock area will disable a tabs menu button when there is only one tab in the area
|
||||||
|
FloatingContainerHasWidgetTitle = 0x40000,
|
||||||
|
FloatingContainerHasWidgetIcon = 0x80000,
|
||||||
|
|
||||||
|
|
||||||
DefaultDockAreaButtons = DockAreaHasCloseButton
|
DefaultDockAreaButtons = DockAreaHasCloseButton
|
||||||
@ -170,7 +173,8 @@ public:
|
|||||||
|
|
||||||
DefaultBaseConfig = DefaultDockAreaButtons
|
DefaultBaseConfig = DefaultDockAreaButtons
|
||||||
| ActiveTabHasCloseButton
|
| ActiveTabHasCloseButton
|
||||||
| XmlCompressionEnabled,///< default base configuration settings
|
| XmlCompressionEnabled
|
||||||
|
| FloatingContainerHasWidgetTitle,///< default base configuration settings
|
||||||
|
|
||||||
DefaultOpaqueConfig = DefaultBaseConfig
|
DefaultOpaqueConfig = DefaultBaseConfig
|
||||||
| OpaqueSplitterResize
|
| OpaqueSplitterResize
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
#include "DockManager.h"
|
#include "DockManager.h"
|
||||||
#include "FloatingDockContainer.h"
|
#include "FloatingDockContainer.h"
|
||||||
#include "DockSplitter.h"
|
#include "DockSplitter.h"
|
||||||
|
#include "DockComponentsFactory.h"
|
||||||
#include "ads_globals.h"
|
#include "ads_globals.h"
|
||||||
|
|
||||||
|
|
||||||
@ -220,7 +221,7 @@ CDockWidget::CDockWidget(const QString &title, QWidget *parent) :
|
|||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
setObjectName(title);
|
setObjectName(title);
|
||||||
|
|
||||||
d->TabWidget = new CDockWidgetTab(this);
|
d->TabWidget = componentsFactory()->createDockWidgetTab(this);
|
||||||
d->ToggleViewAction = new QAction(title, this);
|
d->ToggleViewAction = new QAction(title, this);
|
||||||
d->ToggleViewAction->setCheckable(true);
|
d->ToggleViewAction->setCheckable(true);
|
||||||
connect(d->ToggleViewAction, SIGNAL(triggered(bool)), this,
|
connect(d->ToggleViewAction, SIGNAL(triggered(bool)), this,
|
||||||
|
@ -79,6 +79,14 @@ struct FloatingDockContainerPrivate
|
|||||||
void titleMouseReleaseEvent();
|
void titleMouseReleaseEvent();
|
||||||
void updateDropOverlays(const QPoint &GlobalPos);
|
void updateDropOverlays(const QPoint &GlobalPos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the given config flag is set
|
||||||
|
*/
|
||||||
|
static bool testConfigFlag(CDockManager::eConfigFlag Flag)
|
||||||
|
{
|
||||||
|
return CDockManager::configFlags().testFlag(Flag);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests is a certain state is active
|
* Tests is a certain state is active
|
||||||
*/
|
*/
|
||||||
@ -100,6 +108,31 @@ struct FloatingDockContainerPrivate
|
|||||||
_this->setWindowTitle(Text);
|
_this->setWindowTitle(Text);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reflectCurrentWidget(CDockWidget* CurrentWidget)
|
||||||
|
{
|
||||||
|
// reflect CurrentWidget's title if configured to do so, otherwise display application name as window title
|
||||||
|
if (testConfigFlag(CDockManager::FloatingContainerHasWidgetTitle))
|
||||||
|
{
|
||||||
|
setWindowTitle(CurrentWidget->windowTitle());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setWindowTitle(qApp->applicationDisplayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
// reflect CurrentWidget's icon if configured to do so, otherwise display application icon as window icon
|
||||||
|
QIcon CurrentWidgetIcon = CurrentWidget->icon();
|
||||||
|
if (testConfigFlag(CDockManager::FloatingContainerHasWidgetIcon)
|
||||||
|
&& !CurrentWidgetIcon.isNull())
|
||||||
|
{
|
||||||
|
_this->setWindowIcon(CurrentWidget->icon());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_this->setWindowIcon(QApplication::windowIcon());
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// struct FloatingDockContainerPrivate
|
// struct FloatingDockContainerPrivate
|
||||||
|
|
||||||
@ -537,8 +570,8 @@ void CFloatingDockContainer::onDockAreasAddedOrRemoved()
|
|||||||
if (TopLevelDockArea)
|
if (TopLevelDockArea)
|
||||||
{
|
{
|
||||||
d->SingleDockArea = TopLevelDockArea;
|
d->SingleDockArea = TopLevelDockArea;
|
||||||
d->setWindowTitle(
|
CDockWidget* CurrentWidget = d->SingleDockArea->currentDockWidget();
|
||||||
d->SingleDockArea->currentDockWidget()->windowTitle());
|
d->reflectCurrentWidget(CurrentWidget);
|
||||||
connect(d->SingleDockArea, SIGNAL(currentChanged(int)), this,
|
connect(d->SingleDockArea, SIGNAL(currentChanged(int)), this,
|
||||||
SLOT(onDockAreaCurrentChanged(int)));
|
SLOT(onDockAreaCurrentChanged(int)));
|
||||||
}
|
}
|
||||||
@ -551,6 +584,7 @@ void CFloatingDockContainer::onDockAreasAddedOrRemoved()
|
|||||||
d->SingleDockArea = nullptr;
|
d->SingleDockArea = nullptr;
|
||||||
}
|
}
|
||||||
d->setWindowTitle(qApp->applicationDisplayName());
|
d->setWindowTitle(qApp->applicationDisplayName());
|
||||||
|
setWindowIcon(QApplication::windowIcon());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,11 +594,13 @@ void CFloatingDockContainer::updateWindowTitle()
|
|||||||
auto TopLevelDockArea = d->DockContainer->topLevelDockArea();
|
auto TopLevelDockArea = d->DockContainer->topLevelDockArea();
|
||||||
if (TopLevelDockArea)
|
if (TopLevelDockArea)
|
||||||
{
|
{
|
||||||
d->setWindowTitle(TopLevelDockArea->currentDockWidget()->windowTitle());
|
CDockWidget* CurrentWidget = TopLevelDockArea->currentDockWidget();
|
||||||
|
d->reflectCurrentWidget(CurrentWidget);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d->setWindowTitle(qApp->applicationDisplayName());
|
d->setWindowTitle(qApp->applicationDisplayName());
|
||||||
|
setWindowIcon(QApplication::windowIcon());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -572,7 +608,8 @@ void CFloatingDockContainer::updateWindowTitle()
|
|||||||
void CFloatingDockContainer::onDockAreaCurrentChanged(int Index)
|
void CFloatingDockContainer::onDockAreaCurrentChanged(int Index)
|
||||||
{
|
{
|
||||||
Q_UNUSED(Index);
|
Q_UNUSED(Index);
|
||||||
d->setWindowTitle(d->SingleDockArea->currentDockWidget()->windowTitle());
|
CDockWidget* CurrentWidget = d->SingleDockArea->currentDockWidget();
|
||||||
|
d->reflectCurrentWidget(CurrentWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
@ -43,7 +43,8 @@ HEADERS += \
|
|||||||
DockSplitter.h \
|
DockSplitter.h \
|
||||||
DockAreaTitleBar.h \
|
DockAreaTitleBar.h \
|
||||||
ElidingLabel.h \
|
ElidingLabel.h \
|
||||||
IconProvider.h
|
IconProvider.h \
|
||||||
|
DockComponentsFactory.h
|
||||||
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
@ -61,7 +62,8 @@ SOURCES += \
|
|||||||
DockSplitter.cpp \
|
DockSplitter.cpp \
|
||||||
DockAreaTitleBar.cpp \
|
DockAreaTitleBar.cpp \
|
||||||
ElidingLabel.cpp \
|
ElidingLabel.cpp \
|
||||||
IconProvider.cpp
|
IconProvider.cpp \
|
||||||
|
DockComponentsFactory.cpp
|
||||||
|
|
||||||
|
|
||||||
unix {
|
unix {
|
||||||
|
Loading…
Reference in New Issue
Block a user