Skip to content

Commit 4c92807

Browse files
Merge branch 'master' into closerequest
# Conflicts: # demo/MainWindow.cpp
2 parents a5e8011 + ea03b98 commit 4c92807

10 files changed

+51
-21
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ When dragging the titlebar of a dock, all the tabs that are tabbed with it are
5353
going to be dragged. So you can move complete groups of tabbed widgets into
5454
a floating widget or from one dock area to another one.
5555

56-
![Grouped dragging](doc/grouped-dragging.png)\
56+
![Grouped dragging](doc/grouped-dragging.gif)\
5757
\
5858
![Grouped dragging](doc/grouped-dragging_dark.png)
5959

@@ -64,7 +64,7 @@ perspective to make your own custom perspective. Later you can simply
6464
select a perspective from the perspective list to quickly switch the complete
6565
main window layout.
6666

67-
![Perspective](doc/perspectives.png)\
67+
![Perspective](doc/perspectives.gif)\
6868
\
6969
![Perspective](doc/perspectives_dark.png)
7070

demo/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5Gui_COMPILE_DEFINITI
1919
set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5Widgets_LIBRARIES})
2020
set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5Widgets_INCLUDE_DIRS})
2121
set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5Widgets_COMPILE_DEFINITIONS})
22+
if(WIN32)
23+
find_package(Qt5AxContainer ${REQUIRED_QT_VERSION} REQUIRED)
24+
set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5AxContainer_LIBRARIES})
25+
set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5AxContainer_INCLUDE_DIRS})
26+
set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5AxContainer_COMPILE_DEFINITIONS})
27+
endif()
2228
set(CMAKE_INCLUDE_CURRENT_DIR ON)
2329
set(ads_demo_SRCS
2430
main.cpp

demo/MainWindow.cpp

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,14 @@
5353
#include <QRubberBand>
5454
#include <QPlainTextEdit>
5555
#include <QTableWidget>
56+
#include <QScreen>
57+
#include <QStyle>
5658
#include <QMessageBox>
5759

60+
#ifdef Q_OS_WIN
61+
#include <QAxWidget>
62+
#endif
63+
5864
#include <QMap>
5965
#include <QElapsedTimer>
6066

@@ -202,6 +208,20 @@ static ads::CDockWidget* createTableWidget(QMenu* ViewMenu)
202208
}
203209

204210

211+
#ifdef Q_OS_WIN
212+
//============================================================================
213+
static ads::CDockWidget* createActiveXWidget(QMenu* ViewMenu, QWidget* parent = nullptr)
214+
{
215+
static int ActiveXCount = 0;
216+
QAxWidget* w = new QAxWidget("{6bf52a52-394a-11d3-b153-00c04f79faa6}", parent);
217+
ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Active X %1").arg(ActiveXCount++));
218+
DockWidget->setWidget(w);
219+
ViewMenu->addAction(DockWidget->toggleViewAction());
220+
return DockWidget;
221+
}
222+
#endif
223+
224+
205225
//============================================================================
206226
/**
207227
* Private data class pimpl
@@ -281,12 +301,19 @@ void MainWindowPrivate::createContent()
281301
auto RighDockArea = DockManager->addDockWidget(ads::RightDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), TopDockArea);
282302
DockManager->addDockWidget(ads::TopDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
283303
auto BottomDockArea = DockManager->addDockWidget(ads::BottomDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
284-
DockManager->addDockWidget(ads::RightDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
304+
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
285305
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), BottomDockArea);
286306

287307
auto Action = ui.menuView->addAction(QString("Set %1 floating").arg(DockWidget->windowTitle()));
288308
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(setFloating()));
289309

310+
#ifdef Q_OS_WIN
311+
if (!DockManager->configFlags().testFlag(ads::CDockManager::OpaqueUndocking))
312+
{
313+
DockManager->addDockWidget(ads::CenterDockWidgetArea, createActiveXWidget(ViewMenu), RighDockArea);
314+
}
315+
#endif
316+
290317
for (auto DockWidget : DockManager->dockWidgetsMap())
291318
{
292319
_this->connect(DockWidget, SIGNAL(viewToggled(bool)), SLOT(onViewToggled(bool)));
@@ -384,9 +411,9 @@ CMainWindow::CMainWindow(QWidget *parent) :
384411
// not change if the visibility of the close button changes
385412
// CDockManager::setConfigFlag(CDockManager::RetainTabSizeWhenCloseButtonHidden, true);
386413

387-
// uncomment the following line if you want to use non opaque undocking and splitter
388-
// movements
389-
// CDockManager::setConfigFlags(CDockManager::DefaultNonOpaqueConfig);
414+
// comment the following line if you want to use opaque undocking and
415+
// opaque splitter resizing
416+
CDockManager::setConfigFlags(CDockManager::DefaultNonOpaqueConfig);
390417

391418
// Now create the dock manager and its content
392419
d->DockManager = new CDockManager(this);
@@ -399,8 +426,12 @@ CMainWindow::CMainWindow(QWidget *parent) :
399426
d->DockManager, SLOT(openPerspective(const QString&)));
400427

401428
d->createContent();
402-
// Default window geometry
429+
// Default window geometry - center on screen
403430
resize(1280, 720);
431+
setGeometry(QStyle::alignedRect(
432+
Qt::LeftToRight, Qt::AlignCenter, frameSize(),
433+
QGuiApplication::primaryScreen()->availableGeometry()
434+
));
404435

405436
//d->restoreState();
406437
d->restorePerspectives();

demo/demo.pro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ ADS_OUT_ROOT = $${OUT_PWD}/..
33
TARGET = AdvancedDockingSystemDemo
44
DESTDIR = $${ADS_OUT_ROOT}/lib
55
QT += core gui widgets
6+
7+
win32 {
8+
QT += axcontainer
9+
}
10+
611
CONFIG += c++14
712
CONFIG += debug_and_release
813
DEFINES += QT_DEPRECATED_WARNINGS

doc/grouped-dragging.gif

523 KB
Loading

doc/non_opaque_resizing.gif

-92.2 KB
Loading

doc/opaque_resizing.gif

-513 KB
Loading

doc/perspectives.gif

316 KB
Loading

src/FloatingDockContainer.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ void CFloatingDockContainer::closeEvent(QCloseEvent *event)
354354
{
355355
ADS_PRINT("CFloatingDockContainer closeEvent");
356356
d->setState(DraggingInactive);
357+
event->ignore();
357358

358359
if (isClosable())
359360
{
@@ -380,20 +381,7 @@ void CFloatingDockContainer::closeEvent(QCloseEvent *event)
380381
// Starting from Qt version 5.12.2 this seems to work again. But
381382
// now the QEvent::NonClientAreaMouseButtonPress function returns always
382383
// Qt::RightButton even if the left button was pressed
383-
#ifndef Q_OS_LINUX
384-
#if (QT_VERSION > QT_VERSION_CHECK(5, 9, 2) && QT_VERSION < QT_VERSION_CHECK(5, 12, 2))
385-
event->ignore();
386384
this->hide();
387-
#else
388-
Super::closeEvent(event);
389-
#endif
390-
#else // Q_OS_LINUX
391-
Super::closeEvent(event);
392-
#endif
393-
}
394-
else
395-
{
396-
event->ignore();
397385
}
398386
}
399387

src/IconProvider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ADS_EXPORT CIconProvider
2929
{
3030
private:
3131
IconProviderPrivate* d; ///< private data (pimpl)
32-
friend class IconProviderPrivate;
32+
friend struct IconProviderPrivate;
3333

3434
public:
3535
/**

0 commit comments

Comments
 (0)