Implemented proper hiding and showing of dock widgets

This commit is contained in:
Uwe Kindler 2017-03-23 10:23:53 +01:00
parent b6ee26adc2
commit 16bd1a3bd2
13 changed files with 3130 additions and 2690 deletions

313
.cproject Normal file
View File

@ -0,0 +1,313 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795.1949777584" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.base.88699815" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.PE" id="cdt.managedbuild.target.gnu.platform.mingw.base.519267520" name="Debug Platform" osList="win32" superClass="cdt.managedbuild.target.gnu.platform.mingw.base"/>
<builder id="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795.1200539104" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.base.1438677059" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.base">
<option id="gnu.both.asm.option.include.paths.403127333" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/QtAdvancedDockingSystem/demo}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/QtAdvancedDockingSystem/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${QTDIR}/include&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1249325593" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.933824900" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.base.1947822681" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.base">
<option id="gnu.cpp.compiler.option.include.paths.349616932" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/QtAdvancedDockingSystem/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/QtAdvancedDockingSystem/demo}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${QTDIR}/include&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1318830536" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.base.389117097" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.base">
<option id="gnu.c.compiler.option.include.paths.1871729602" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/QtAdvancedDockingSystem/demo}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/QtAdvancedDockingSystem/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${QTDIR}/include&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1568363924" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.1734874312" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base.985493173" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.266071128" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="QtAdvancedDockingSystem.null.1346550114" name="QtAdvancedDockingSystem"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="Build all" path=" build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Clean" path=" build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildTarget>clean</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Debug Build" path=" build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j6</buildArguments>
<buildTarget>debug</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="qmake" path=" build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>qmake</buildCommand>
<buildArguments>-recursive ../ads.pro</buildArguments>
<buildTarget/>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Release Build" path=" build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j4</buildArguments>
<buildTarget>release</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Build all" path=" build/src" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Clean" path=" build/src" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>clean</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Debug Build" path=" build/src" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j6</buildArguments>
<buildTarget>debug</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="qmake" path=" build/src" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>qmake</buildCommand>
<buildArguments>-recursive ../../src/src.pro</buildArguments>
<buildTarget/>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Release Build" path=" build/src" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j4</buildArguments>
<buildTarget>release</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Build all" path=" build/demo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Clean" path=" build/demo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>clean</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Debug Build" path=" build/demo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j6</buildArguments>
<buildTarget>debug</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="qmake" path=" build/demo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>qmake</buildCommand>
<buildArguments>-recursive ../../demo/demo.pro</buildArguments>
<buildTarget/>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Release Build" path=" build/demo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j4</buildArguments>
<buildTarget>release</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Build all" path=" build/AdvancedDockingSystemDemo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Clean" path=" build/AdvancedDockingSystemDemo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildTarget>clean</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Debug Build" path=" build/AdvancedDockingSystemDemo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j6</buildArguments>
<buildTarget>debug</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="qmake" path=" build/AdvancedDockingSystemDemo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>qmake</buildCommand>
<buildArguments>-recursive ../../AdvancedDockingSystemDemo/AdvancedDockingSystemDemo.pro</buildArguments>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Release Build" path=" build/AdvancedDockingSystemDemo" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j4</buildArguments>
<buildTarget>release</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Build all" path=" build/AdvancedDockingSystemDemo_v2" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Clean" path=" build/AdvancedDockingSystemDemo_v2" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildTarget>clean</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Debug Build" path=" build/AdvancedDockingSystemDemo_v2" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j6</buildArguments>
<buildTarget>debug</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="qmake" path=" build/AdvancedDockingSystemDemo_v2" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>qmake</buildCommand>
<buildArguments>-recursive ../../AdvancedDockingSystemDemo_v2/AdvancedDockingSystemDemo_v2.pro</buildArguments>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Release Build" path=" build/AdvancedDockingSystemDemo_v2" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j4</buildArguments>
<buildTarget>release</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Build all" path=" build/AdvancedDockingSystem" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Clean" path=" build/AdvancedDockingSystem" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildTarget>clean</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Debug Build" path=" build/AdvancedDockingSystem" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j6</buildArguments>
<buildTarget>debug</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="qmake" path=" build/AdvancedDockingSystem" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>qmake</buildCommand>
<buildArguments>-recursive ../../AdvancedDockingSystem/src.pro</buildArguments>
<buildTarget/>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="Release Build" path=" build/AdvancedDockingSystem" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments>-j4</buildArguments>
<buildTarget>release</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
</buildTargets>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795;cdt.managedbuild.toolchain.gnu.mingw.base.1119687795.1949777584;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.base.1947822681;cdt.managedbuild.tool.gnu.cpp.compiler.input.1318830536">
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795;cdt.managedbuild.toolchain.gnu.mingw.base.1119687795.1949777584;cdt.managedbuild.tool.gnu.c.compiler.mingw.base.389117097;cdt.managedbuild.tool.gnu.c.compiler.input.1568363924">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
</cproject>

27
.project Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>QtAdvancedDockingSystem</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="cdt.managedbuild.toolchain.gnu.mingw.base.1119687795" name="Default">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="(g?cc)|([gc]\+\+)|(clang)" prefer-non-shared="true"/>
<provider class="org.eclipse.cdt.managedbuilder.internal.language.settings.providers.GCCBuiltinSpecsDetectorMinGW" console="false" env-hash="-797032510223863550" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorMinGW" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings MinGW" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
</extension>
</configuration>
</project>

BIN
ContainerWidget.dat Normal file

Binary file not shown.

BIN
MainWindow.dat Normal file

Binary file not shown.

View File

@ -38,6 +38,8 @@
#include <QPushButton> #include <QPushButton>
#include <QDebug> #include <QDebug>
#include <QMenu> #include <QMenu>
#include <QSplitter>
#include "DockContainerWidget.h" #include "DockContainerWidget.h"
#include "DockWidget.h" #include "DockWidget.h"
@ -442,6 +444,7 @@ void CDockAreaWidget::insertDockWidget(int index, CDockWidget* DockWidget,
d->TabsLayout->insertWidget(index, TitleBar); d->TabsLayout->insertWidget(index, TitleBar);
TitleBar->show(); TitleBar->show();
connect(TitleBar, SIGNAL(clicked()), this, SLOT(onDockWidgetTitleClicked())); connect(TitleBar, SIGNAL(clicked()), this, SLOT(onDockWidgetTitleClicked()));
connect(DockWidget, SIGNAL(viewToggled(bool)), this, SLOT(onDockWidgetViewToggled(bool)));
DockWidget->setProperty(INDEX_PROPERTY, index); DockWidget->setProperty(INDEX_PROPERTY, index);
if (Activate) if (Activate)
{ {
@ -461,6 +464,7 @@ void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget)
TitleBar->hide(); TitleBar->hide();
d->TabsLayout->removeWidget(TitleBar); d->TabsLayout->removeWidget(TitleBar);
disconnect(TitleBar, SIGNAL(clicked()), this, SLOT(onDockWidgetTitleClicked())); disconnect(TitleBar, SIGNAL(clicked()), this, SLOT(onDockWidgetTitleClicked()));
disconnect(DockWidget, SIGNAL(viewToggled(bool)), this, SLOT(onDockWidgetViewToggled(bool)));
setCurrentIndex(d->ContentsLayout->currentIndex()); setCurrentIndex(d->ContentsLayout->currentIndex());
d->updateTabsMenu(); d->updateTabsMenu();
@ -600,7 +604,7 @@ QList<CDockWidget*> CDockAreaWidget::dockWidgets() const
//============================================================================ //============================================================================
QList<CDockWidget*> CDockAreaWidget::openDockWidgets() const QList<CDockWidget*> CDockAreaWidget::openedDockWidgets() const
{ {
QList<CDockWidget*> DockWidgetList; QList<CDockWidget*> DockWidgetList;
for (int i = 0; i < d->ContentsLayout->count(); ++i) for (int i = 0; i < d->ContentsLayout->count(); ++i)
@ -697,18 +701,9 @@ void CDockAreaWidget::updateDockArea()
//============================================================================ //============================================================================
void CDockAreaWidget::hideEvent(QHideEvent* event) void CDockAreaWidget::onDockWidgetViewToggled(bool Open)
{ {
QFrame::hideEvent(event); auto DockWidget = dynamic_cast<CDockWidget*>(sender());
emit visibilityChanged(isVisible());
}
//============================================================================
void CDockAreaWidget::showEvent(QShowEvent* event)
{
QFrame::showEvent(event);
emit visibilityChanged(isVisible());
} }
} // namespace ads } // namespace ads

View File

@ -55,10 +55,7 @@ private slots:
void onDockWidgetTitleClicked(); void onDockWidgetTitleClicked();
void onTabsMenuActionTriggered(QAction* Action); void onTabsMenuActionTriggered(QAction* Action);
void onCloseButtonClicked(); void onCloseButtonClicked();
void onDockWidgetViewToggled(bool Open);
protected:
virtual void hideEvent(QHideEvent *) override;
virtual void showEvent(QShowEvent *) override;
public: public:
/** /**
@ -132,7 +129,7 @@ public:
/** /**
* Returns a list of dock widgets that are not closed * Returns a list of dock widgets that are not closed
*/ */
QList<CDockWidget*> openDockWidgets() const; QList<CDockWidget*> openedDockWidgets() const;
/** /**
* Returns the number of dock widgets in this area * Returns the number of dock widgets in this area
@ -189,12 +186,11 @@ signals:
void currentChanged(int index); void currentChanged(int index);
/** /**
* This signal is emitted if a dock areas visibility changed. * This signal is emitted if the dock area is closed or opened.
* The visibility changes, if the last dock widget in a dock area is closed * The dock area will be closed, if all dock widgets in the dock area are
* or if one dock widget in a dock area with only closed dock widgets * closed and will be opened, when the first dock widget is opened
* becomes visible
*/ */
void visibilityChanged(bool Visible); void viewToggled(bool Open);
}; // class DockAreaWidget }; // class DockAreaWidget
} }
// namespace ads // namespace ads

View File

@ -588,6 +588,22 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
} }
//============================================================================
QList<CDockAreaWidget*> CDockContainerWidget::openedDockAreas() const
{
QList<CDockAreaWidget*> Result;
for (auto DockArea : d->DockAreas)
{
if (DockArea->isVisible())
{
Result.append(DockArea);
}
}
return Result;
}
} // namespace ads } // namespace ads
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@ -118,6 +118,12 @@ public:
*/ */
CDockAreaWidget* dockArea(int Index) const; CDockAreaWidget* dockArea(int Index) const;
/**
* Returns the list of dock areas that are not closed
* If all dock widgets in a dock area are closed, the dock area will be closed
*/
QList<CDockAreaWidget*> openedDockAreas() const;
/** /**
* Returns the number of dock areas in this container * Returns the number of dock areas in this container
*/ */

View File

@ -85,6 +85,11 @@ struct DockWidgetPrivate
*/ */
void showDockWidget(); void showDockWidget();
/**
* Hide dock widget.
*/
void hideDockWidget();
/** /**
* Hides a parent splitter if all dock widgets in the splitter are closed * Hides a parent splitter if all dock widgets in the splitter are closed
*/ */
@ -94,6 +99,12 @@ struct DockWidgetPrivate
* Hides a dock area if all dock widgets in the area are closed * Hides a dock area if all dock widgets in the area are closed
*/ */
void hideEmptyParentDockArea(); void hideEmptyParentDockArea();
/**
* Hides a floating widget if all dock areas are empty - that means,
* if all dock widgets in all dock areas are closed
*/
void hideEmptyFloatingWidget();
}; };
// struct DockWidgetPrivate // struct DockWidgetPrivate
@ -149,6 +160,25 @@ void DockWidgetPrivate::showDockWidget()
{ {
Splitter->show(); Splitter->show();
} }
CDockContainerWidget* Container = DockArea->dockContainer();
if (Container->isFloating())
{
CFloatingDockContainer* FloatingWidget = internal::findParent<
CFloatingDockContainer*>(Container);
FloatingWidget->show();
}
}
//============================================================================
void DockWidgetPrivate::hideDockWidget()
{
ToggleViewAction->setChecked(false);
TitleWidget->hide();
hideEmptyParentDockArea();
hideEmptyParentSplitter();
hideEmptyFloatingWidget();
} }
@ -176,7 +206,7 @@ void DockWidgetPrivate::hideEmptyParentSplitter()
//============================================================================ //============================================================================
void DockWidgetPrivate::hideEmptyParentDockArea() void DockWidgetPrivate::hideEmptyParentDockArea()
{ {
auto OpenDockWidgets = DockArea->openDockWidgets(); auto OpenDockWidgets = DockArea->openedDockWidgets();
if (OpenDockWidgets.count() > 1) if (OpenDockWidgets.count() > 1)
{ {
CDockWidget* NextDockWidget; CDockWidget* NextDockWidget;
@ -199,6 +229,18 @@ void DockWidgetPrivate::hideEmptyParentDockArea()
} }
//============================================================================
void DockWidgetPrivate::hideEmptyFloatingWidget()
{
CDockContainerWidget* Container = _this->dockContainer();
if (Container->isFloating() && Container->openedDockAreas().isEmpty())
{
CFloatingDockContainer* FloatingWidget = internal::findParent<CFloatingDockContainer*>(Container);
FloatingWidget->hide();
}
}
//============================================================================ //============================================================================
CDockWidget::CDockWidget(const QString &title, QWidget *parent) : CDockWidget::CDockWidget(const QString &title, QWidget *parent) :
QFrame(parent), QFrame(parent),
@ -225,6 +267,16 @@ CDockWidget::~CDockWidget()
} }
//============================================================================
void CDockWidget::setToggleViewActionChecked(bool Checked)
{
QAction* Action = d->ToggleViewAction;
Action->blockSignals(true);
Action->setChecked(Checked);
Action->blockSignals(false);
}
//============================================================================ //============================================================================
void CDockWidget::setWidget(QWidget* widget) void CDockWidget::setWidget(QWidget* widget)
{ {
@ -327,9 +379,14 @@ void CDockWidget::toggleView(bool Open)
} }
else else
{ {
hideDockWidget(); d->hideDockWidget();
} }
d->Closed = !Open; d->Closed = !Open;
if (!Open)
{
emit closed();
}
emit viewToggled(Open);
} }
@ -341,17 +398,6 @@ void CDockWidget::setDockArea(CDockAreaWidget* DockArea)
} }
//============================================================================
void CDockWidget::hideDockWidget()
{
CDockAreaWidget* DockArea = d->DockArea;
d->ToggleViewAction->setChecked(false);
d->TitleWidget->hide();
d->hideEmptyParentDockArea();
d->hideEmptyParentSplitter();
}
} // namespace ads } // namespace ads
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@ -70,9 +70,10 @@ protected:
void setDockArea(CDockAreaWidget* DockArea); void setDockArea(CDockAreaWidget* DockArea);
/** /**
* Hide dock widget. * This function changes the toggle view action without emitting any
* signal
*/ */
void hideDockWidget(); void setToggleViewActionChecked(bool Checked);
public: public:
enum DockWidgetFeature enum DockWidgetFeature
@ -173,6 +174,17 @@ public slots:
* The toogleViewAction triggers this slot * The toogleViewAction triggers this slot
*/ */
void toggleView(bool Open); void toggleView(bool Open);
signals:
/**
* This signal is emitted if the dock widget is opened or closed
*/
void viewToggled(bool Open);
/**
* This signal is emitted if the dock widget is closed
*/
void closed();
}; // class DockWidget }; // class DockWidget
} }
// namespace ads // namespace ads

View File

@ -34,6 +34,7 @@
#include <QApplication> #include <QApplication>
#include <QMouseEvent> #include <QMouseEvent>
#include <QPointer> #include <QPointer>
#include <QAction>
#include <iostream> #include <iostream>
@ -263,27 +264,38 @@ void CFloatingDockContainer::moveEvent(QMoveEvent *event)
void CFloatingDockContainer::closeEvent(QCloseEvent *event) void CFloatingDockContainer::closeEvent(QCloseEvent *event)
{ {
d->setDraggingActive(false); d->setDraggingActive(false);
if (dockContainer()->dockAreaCount() > 1 || dockContainer()->dockArea(0)->count() == 1)
{
for (int i = 0; i < dockContainer()->dockAreaCount(); ++i)
{
auto DockWidgets = dockContainer()->dockArea(i)->dockWidgets();
for (auto DockWidget : DockWidgets)
{
DockWidget->hideDockWidget();
}
}
QWidget::closeEvent(event); QWidget::closeEvent(event);
} }
else
//============================================================================
void CFloatingDockContainer::hideEvent(QHideEvent *event)
{ {
auto DockArea = dockContainer()->dockArea(0); QWidget::hideEvent(event);
DockArea->currentDockWidget()->hideDockWidget(); auto OpenDockAreas = d->DockContainer->openedDockAreas();
// As long as there are open dock widgets, we do not close the floating for (auto DockArea : OpenDockAreas)
// window
if (DockArea->openDockWidgets().count())
{ {
event->ignore(); auto OpenDockWidgets = DockArea->openedDockWidgets();
for (auto DockWidget : OpenDockWidgets)
{
DockWidget->setToggleViewActionChecked(false);
}
}
}
//============================================================================
void CFloatingDockContainer::showEvent(QShowEvent *event)
{
QWidget::showEvent(event);
CDockContainerWidget* DockContainer = dockContainer();
for (int i = 0; i < DockContainer->dockAreaCount(); ++i)
{
auto DockArea = DockContainer->dockArea(i);
for (auto DockWidget : DockArea->openedDockWidgets())
{
DockWidget->setToggleViewActionChecked(true);
} }
} }
} }

View File

@ -66,6 +66,8 @@ protected: // reimplements QWidget
virtual void moveEvent(QMoveEvent *event) override; virtual void moveEvent(QMoveEvent *event) override;
virtual bool event(QEvent *e) override; virtual bool event(QEvent *e) override;
virtual void closeEvent(QCloseEvent *event) override; virtual void closeEvent(QCloseEvent *event) override;
virtual void hideEvent(QHideEvent *event) override;
virtual void showEvent(QShowEvent *event) override;
virtual bool eventFilter(QObject *watched, QEvent *event) override; virtual bool eventFilter(QObject *watched, QEvent *event) override;
public: public: