mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Fixed FloatingDockContainer closeEvent to properly support QAxWidgets
This commit is contained in:
parent
1de42a9766
commit
616e50c3f5
@ -53,6 +53,7 @@
|
||||
#include <QRubberBand>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QTableWidget>
|
||||
#include <QAxWidget>
|
||||
|
||||
#include <QMap>
|
||||
#include <QElapsedTimer>
|
||||
@ -200,6 +201,18 @@ static ads::CDockWidget* createTableWidget(QMenu* ViewMenu)
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
/**
|
||||
* Private data class pimpl
|
||||
@ -285,6 +298,8 @@ void MainWindowPrivate::createContent()
|
||||
auto Action = ui.menuView->addAction(QString("Set %1 floating").arg(DockWidget->windowTitle()));
|
||||
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(setFloating()));
|
||||
|
||||
DockManager->addDockWidgetFloating(createActiveXWidget(ViewMenu));
|
||||
|
||||
for (auto DockWidget : DockManager->dockWidgetsMap())
|
||||
{
|
||||
_this->connect(DockWidget, SIGNAL(viewToggled(bool)), SLOT(onViewToggled(bool)));
|
||||
@ -384,7 +399,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
||||
|
||||
// uncomment the following line if you want to use non opaque undocking and splitter
|
||||
// movements
|
||||
// CDockManager::setConfigFlags(CDockManager::DefaultNonOpaqueConfig);
|
||||
CDockManager::setConfigFlags(CDockManager::DefaultNonOpaqueConfig);
|
||||
|
||||
// Now create the dock manager and its content
|
||||
d->DockManager = new CDockManager(this);
|
||||
|
@ -2,7 +2,7 @@ ADS_OUT_ROOT = $${OUT_PWD}/..
|
||||
|
||||
TARGET = AdvancedDockingSystemDemo
|
||||
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||
QT += core gui widgets
|
||||
QT += core gui widgets axcontainer
|
||||
CONFIG += c++14
|
||||
CONFIG += debug_and_release
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
@ -352,6 +352,7 @@ void CFloatingDockContainer::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
ADS_PRINT("CFloatingDockContainer closeEvent");
|
||||
d->setState(DraggingInactive);
|
||||
event->ignore();
|
||||
|
||||
if (isClosable())
|
||||
{
|
||||
@ -371,20 +372,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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user