Merge branch 'master' into closerequest

# Conflicts:
#	demo/MainWindow.cpp
This commit is contained in:
Uwe Kindler 2020-01-12 15:07:51 +01:00
commit 4c928071af
10 changed files with 51 additions and 21 deletions

View File

@ -53,7 +53,7 @@ When dragging the titlebar of a dock, all the tabs that are tabbed with it are
going to be dragged. So you can move complete groups of tabbed widgets into
a floating widget or from one dock area to another one.
![Grouped dragging](doc/grouped-dragging.png)\
![Grouped dragging](doc/grouped-dragging.gif)\
\
![Grouped dragging](doc/grouped-dragging_dark.png)
@ -64,7 +64,7 @@ perspective to make your own custom perspective. Later you can simply
select a perspective from the perspective list to quickly switch the complete
main window layout.
![Perspective](doc/perspectives.png)\
![Perspective](doc/perspectives.gif)\
\
![Perspective](doc/perspectives_dark.png)

View File

@ -19,6 +19,12 @@ set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5Gui_COMPILE_DEFINITI
set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5Widgets_LIBRARIES})
set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5Widgets_INCLUDE_DIRS})
set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5Widgets_COMPILE_DEFINITIONS})
if(WIN32)
find_package(Qt5AxContainer ${REQUIRED_QT_VERSION} REQUIRED)
set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5AxContainer_LIBRARIES})
set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5AxContainer_INCLUDE_DIRS})
set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5AxContainer_COMPILE_DEFINITIONS})
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(ads_demo_SRCS
main.cpp

View File

@ -53,8 +53,14 @@
#include <QRubberBand>
#include <QPlainTextEdit>
#include <QTableWidget>
#include <QScreen>
#include <QStyle>
#include <QMessageBox>
#ifdef Q_OS_WIN
#include <QAxWidget>
#endif
#include <QMap>
#include <QElapsedTimer>
@ -202,6 +208,20 @@ static ads::CDockWidget* createTableWidget(QMenu* ViewMenu)
}
#ifdef Q_OS_WIN
//============================================================================
static ads::CDockWidget* createActiveXWidget(QMenu* ViewMenu, QWidget* parent = nullptr)
{
static int ActiveXCount = 0;
QAxWidget* w = new QAxWidget("{6bf52a52-394a-11d3-b153-00c04f79faa6}", parent);
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Active X %1").arg(ActiveXCount++));
DockWidget->setWidget(w);
ViewMenu->addAction(DockWidget->toggleViewAction());
return DockWidget;
}
#endif
//============================================================================
/**
* Private data class pimpl
@ -281,12 +301,19 @@ void MainWindowPrivate::createContent()
auto RighDockArea = DockManager->addDockWidget(ads::RightDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), TopDockArea);
DockManager->addDockWidget(ads::TopDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
auto BottomDockArea = DockManager->addDockWidget(ads::BottomDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
DockManager->addDockWidget(ads::RightDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), BottomDockArea);
auto Action = ui.menuView->addAction(QString("Set %1 floating").arg(DockWidget->windowTitle()));
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(setFloating()));
#ifdef Q_OS_WIN
if (!DockManager->configFlags().testFlag(ads::CDockManager::OpaqueUndocking))
{
DockManager->addDockWidget(ads::CenterDockWidgetArea, createActiveXWidget(ViewMenu), RighDockArea);
}
#endif
for (auto DockWidget : DockManager->dockWidgetsMap())
{
_this->connect(DockWidget, SIGNAL(viewToggled(bool)), SLOT(onViewToggled(bool)));
@ -384,9 +411,9 @@ CMainWindow::CMainWindow(QWidget *parent) :
// not change if the visibility of the close button changes
// CDockManager::setConfigFlag(CDockManager::RetainTabSizeWhenCloseButtonHidden, true);
// uncomment the following line if you want to use non opaque undocking and splitter
// movements
// CDockManager::setConfigFlags(CDockManager::DefaultNonOpaqueConfig);
// comment the following line if you want to use opaque undocking and
// opaque splitter resizing
CDockManager::setConfigFlags(CDockManager::DefaultNonOpaqueConfig);
// Now create the dock manager and its content
d->DockManager = new CDockManager(this);
@ -399,8 +426,12 @@ CMainWindow::CMainWindow(QWidget *parent) :
d->DockManager, SLOT(openPerspective(const QString&)));
d->createContent();
// Default window geometry
// Default window geometry - center on screen
resize(1280, 720);
setGeometry(QStyle::alignedRect(
Qt::LeftToRight, Qt::AlignCenter, frameSize(),
QGuiApplication::primaryScreen()->availableGeometry()
));
//d->restoreState();
d->restorePerspectives();

View File

@ -3,6 +3,11 @@ ADS_OUT_ROOT = $${OUT_PWD}/..
TARGET = AdvancedDockingSystemDemo
DESTDIR = $${ADS_OUT_ROOT}/lib
QT += core gui widgets
win32 {
QT += axcontainer
}
CONFIG += c++14
CONFIG += debug_and_release
DEFINES += QT_DEPRECATED_WARNINGS

BIN
doc/grouped-dragging.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 414 KiB

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 902 KiB

After

Width:  |  Height:  |  Size: 389 KiB

BIN
doc/perspectives.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

View File

@ -354,6 +354,7 @@ void CFloatingDockContainer::closeEvent(QCloseEvent *event)
{
ADS_PRINT("CFloatingDockContainer closeEvent");
d->setState(DraggingInactive);
event->ignore();
if (isClosable())
{
@ -380,20 +381,7 @@ void CFloatingDockContainer::closeEvent(QCloseEvent *event)
// Starting from Qt version 5.12.2 this seems to work again. But
// now the QEvent::NonClientAreaMouseButtonPress function returns always
// Qt::RightButton even if the left button was pressed
#ifndef Q_OS_LINUX
#if (QT_VERSION > QT_VERSION_CHECK(5, 9, 2) && QT_VERSION < QT_VERSION_CHECK(5, 12, 2))
event->ignore();
this->hide();
#else
Super::closeEvent(event);
#endif
#else // Q_OS_LINUX
Super::closeEvent(event);
#endif
}
else
{
event->ignore();
}
}

View File

@ -29,7 +29,7 @@ class ADS_EXPORT CIconProvider
{
private:
IconProviderPrivate* d; ///< private data (pimpl)
friend class IconProviderPrivate;
friend struct IconProviderPrivate;
public:
/**