diff --git a/README.md b/README.md index 01e6e47..76d7f9a 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index 5bb3aae..f8d4998 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -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 diff --git a/demo/MainWindow.cpp b/demo/MainWindow.cpp index ec75f53..95e34be 100644 --- a/demo/MainWindow.cpp +++ b/demo/MainWindow.cpp @@ -53,8 +53,14 @@ #include #include #include +#include +#include #include +#ifdef Q_OS_WIN +#include +#endif + #include #include @@ -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(); diff --git a/demo/demo.pro b/demo/demo.pro index e1ece66..57ff0a5 100644 --- a/demo/demo.pro +++ b/demo/demo.pro @@ -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 diff --git a/doc/grouped-dragging.gif b/doc/grouped-dragging.gif new file mode 100644 index 0000000..a27d04d Binary files /dev/null and b/doc/grouped-dragging.gif differ diff --git a/doc/non_opaque_resizing.gif b/doc/non_opaque_resizing.gif index 0c29683..7582f5d 100644 Binary files a/doc/non_opaque_resizing.gif and b/doc/non_opaque_resizing.gif differ diff --git a/doc/opaque_resizing.gif b/doc/opaque_resizing.gif index 498a145..c979924 100644 Binary files a/doc/opaque_resizing.gif and b/doc/opaque_resizing.gif differ diff --git a/doc/perspectives.gif b/doc/perspectives.gif new file mode 100644 index 0000000..1290921 Binary files /dev/null and b/doc/perspectives.gif differ diff --git a/src/FloatingDockContainer.cpp b/src/FloatingDockContainer.cpp index 91e8568..400f12d 100644 --- a/src/FloatingDockContainer.cpp +++ b/src/FloatingDockContainer.cpp @@ -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(); } } diff --git a/src/IconProvider.h b/src/IconProvider.h index 9174ef8..fa7d150 100644 --- a/src/IconProvider.h +++ b/src/IconProvider.h @@ -29,7 +29,7 @@ class ADS_EXPORT CIconProvider { private: IconProviderPrivate* d; ///< private data (pimpl) - friend class IconProviderPrivate; + friend struct IconProviderPrivate; public: /**