mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 23:51:33 +08:00
Fixed all Qt6 build issues
This commit is contained in:
parent
c8fe4c46dd
commit
018ce2001e
@ -58,12 +58,15 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
#include <QToolBar>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
#include <QAxWidget>
|
#include <QAxWidget>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
@ -355,6 +358,7 @@ struct MainWindowPrivate
|
|||||||
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
/**
|
/**
|
||||||
* Creates an ActiveX widget on windows
|
* Creates an ActiveX widget on windows
|
||||||
*/
|
*/
|
||||||
@ -368,6 +372,7 @@ struct MainWindowPrivate
|
|||||||
return DockWidget;
|
return DockWidget;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -446,10 +451,12 @@ void MainWindowPrivate::createContent()
|
|||||||
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(raise()));
|
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(raise()));
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
if (!ads::CDockManager::testConfigFlag(ads::CDockManager::OpaqueUndocking))
|
if (!ads::CDockManager::testConfigFlag(ads::CDockManager::OpaqueUndocking))
|
||||||
{
|
{
|
||||||
DockManager->addDockWidget(ads::CenterDockWidgetArea, createActiveXWidget(), RighDockArea);
|
DockManager->addDockWidget(ads::CenterDockWidgetArea, createActiveXWidget(), RighDockArea);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (auto DockWidget : DockManager->dockWidgetsMap())
|
for (auto DockWidget : DockManager->dockWidgetsMap())
|
||||||
|
@ -4,9 +4,11 @@ TARGET = AdvancedDockingSystemDemo
|
|||||||
DESTDIR = $${ADS_OUT_ROOT}/lib
|
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||||
QT += core gui widgets
|
QT += core gui widgets
|
||||||
|
|
||||||
|
lessThan(QT_MAJOR_VERSION, 6) {
|
||||||
win32 {
|
win32 {
|
||||||
QT += axcontainer
|
QT += axcontainer
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CONFIG += c++14
|
CONFIG += c++14
|
||||||
CONFIG += debug_and_release
|
CONFIG += debug_and_release
|
||||||
|
@ -917,15 +917,15 @@ bool DockContainerWidgetPrivate::restoreSplitter(CDockingStateReader& s,
|
|||||||
{
|
{
|
||||||
QWidget* ChildNode = nullptr;
|
QWidget* ChildNode = nullptr;
|
||||||
bool Result = true;
|
bool Result = true;
|
||||||
if (s.name() == "Splitter")
|
if (s.name() == QLatin1String("Splitter"))
|
||||||
{
|
{
|
||||||
Result = restoreSplitter(s, ChildNode, Testing);
|
Result = restoreSplitter(s, ChildNode, Testing);
|
||||||
}
|
}
|
||||||
else if (s.name() == "Area")
|
else if (s.name() == QLatin1String("Area"))
|
||||||
{
|
{
|
||||||
Result = restoreDockArea(s, ChildNode, Testing);
|
Result = restoreDockArea(s, ChildNode, Testing);
|
||||||
}
|
}
|
||||||
else if (s.name() == "Sizes")
|
else if (s.name() == QLatin1String("Sizes"))
|
||||||
{
|
{
|
||||||
QString sSizes = s.readElementText().trimmed();
|
QString sSizes = s.readElementText().trimmed();
|
||||||
ADS_PRINT("Sizes: " << sSizes);
|
ADS_PRINT("Sizes: " << sSizes);
|
||||||
@ -1026,7 +1026,7 @@ bool DockContainerWidgetPrivate::restoreDockArea(CDockingStateReader& s,
|
|||||||
|
|
||||||
while (s.readNextStartElement())
|
while (s.readNextStartElement())
|
||||||
{
|
{
|
||||||
if (s.name() != "Widget")
|
if (s.name() != QLatin1String("Widget"))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1089,12 +1089,12 @@ bool DockContainerWidgetPrivate::restoreChildNodes(CDockingStateReader& s,
|
|||||||
bool Result = true;
|
bool Result = true;
|
||||||
while (s.readNextStartElement())
|
while (s.readNextStartElement())
|
||||||
{
|
{
|
||||||
if (s.name() == "Splitter")
|
if (s.name() == QLatin1String("Splitter"))
|
||||||
{
|
{
|
||||||
Result = restoreSplitter(s, CreatedWidget, Testing);
|
Result = restoreSplitter(s, CreatedWidget, Testing);
|
||||||
ADS_PRINT("Splitter");
|
ADS_PRINT("Splitter");
|
||||||
}
|
}
|
||||||
else if (s.name() == "Area")
|
else if (s.name() == QLatin1String("Area"))
|
||||||
{
|
{
|
||||||
Result = restoreDockArea(s, CreatedWidget, Testing);
|
Result = restoreDockArea(s, CreatedWidget, Testing);
|
||||||
ADS_PRINT("DockAreaWidget");
|
ADS_PRINT("DockAreaWidget");
|
||||||
@ -1664,7 +1664,7 @@ bool CDockContainerWidget::restoreState(CDockingStateReader& s, bool Testing)
|
|||||||
if (IsFloating)
|
if (IsFloating)
|
||||||
{
|
{
|
||||||
ADS_PRINT("Restore floating widget");
|
ADS_PRINT("Restore floating widget");
|
||||||
if (!s.readNextStartElement() || s.name() != "Geometry")
|
if (!s.readNextStartElement() || s.name() != QLatin1String("Geometry"))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int versi
|
|||||||
}
|
}
|
||||||
CDockingStateReader s(state);
|
CDockingStateReader s(state);
|
||||||
s.readNextStartElement();
|
s.readNextStartElement();
|
||||||
if (s.name() != "QtAdvancedDockingSystem")
|
if (s.name() != QLatin1String("QtAdvancedDockingSystem"))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int versi
|
|||||||
int DockContainerCount = 0;
|
int DockContainerCount = 0;
|
||||||
while (s.readNextStartElement())
|
while (s.readNextStartElement())
|
||||||
{
|
{
|
||||||
if (s.name() == "Container")
|
if (s.name() == QLatin1String("Container"))
|
||||||
{
|
{
|
||||||
Result = restoreContainer(DockContainerCount, s, Testing);
|
Result = restoreContainer(DockContainerCount, s, Testing);
|
||||||
if (!Result)
|
if (!Result)
|
||||||
|
@ -806,10 +806,15 @@ void CDockOverlayCross::setIconColors(const QString& Colors)
|
|||||||
{"Arrow", CDockOverlayCross::ArrowColor},
|
{"Arrow", CDockOverlayCross::ArrowColor},
|
||||||
{"Shadow", CDockOverlayCross::ShadowColor}};
|
{"Shadow", CDockOverlayCross::ShadowColor}};
|
||||||
|
|
||||||
auto ColorList = Colors.split(' ', QString::SkipEmptyParts);
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
auto SkipEmptyParts = QString::SkipEmptyParts;
|
||||||
|
#else
|
||||||
|
auto SkipEmptyParts = Qt::SkipEmptyParts;
|
||||||
|
#endif
|
||||||
|
auto ColorList = Colors.split(' ', SkipEmptyParts);
|
||||||
for (const auto& ColorListEntry : ColorList)
|
for (const auto& ColorListEntry : ColorList)
|
||||||
{
|
{
|
||||||
auto ComponentColor = ColorListEntry.split('=', QString::SkipEmptyParts);
|
auto ComponentColor = ColorListEntry.split('=', SkipEmptyParts);
|
||||||
int Component = ColorCompenentStringMap.value(ComponentColor[0], -1);
|
int Component = ColorCompenentStringMap.value(ComponentColor[0], -1);
|
||||||
if (Component < 0)
|
if (Component < 0)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QChildEvent>
|
#include <QChildEvent>
|
||||||
|
#include <QVariant>
|
||||||
#include "DockAreaWidget.h"
|
#include "DockAreaWidget.h"
|
||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
@ -52,7 +52,7 @@ CDockSplitter::CDockSplitter(QWidget *parent)
|
|||||||
: QSplitter(parent),
|
: QSplitter(parent),
|
||||||
d(new DockSplitterPrivate(this))
|
d(new DockSplitterPrivate(this))
|
||||||
{
|
{
|
||||||
setProperty("ads-splitter", true);
|
setProperty("ads-splitter", QVariant(true));
|
||||||
setChildrenCollapsible(false);
|
setChildrenCollapsible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,12 @@ void CElidingLabel::resizeEvent(QResizeEvent *event)
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
QSize CElidingLabel::minimumSizeHint() const
|
QSize CElidingLabel::minimumSizeHint() const
|
||||||
{
|
{
|
||||||
if (pixmap() != nullptr || d->isModeElideNone())
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
bool NoPixmap = pixmap().isNull();
|
||||||
|
#else
|
||||||
|
bool NoPixmap = (pixmap() == nullptr);
|
||||||
|
#endif
|
||||||
|
if (NoPixmap || d->isModeElideNone())
|
||||||
{
|
{
|
||||||
return QLabel::minimumSizeHint();
|
return QLabel::minimumSizeHint();
|
||||||
}
|
}
|
||||||
@ -180,7 +185,12 @@ QSize CElidingLabel::minimumSizeHint() const
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
QSize CElidingLabel::sizeHint() const
|
QSize CElidingLabel::sizeHint() const
|
||||||
{
|
{
|
||||||
if (pixmap() != nullptr || d->isModeElideNone())
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
bool NoPixmap = pixmap().isNull();
|
||||||
|
#else
|
||||||
|
bool NoPixmap = (pixmap() == nullptr);
|
||||||
|
#endif
|
||||||
|
if (NoPixmap || d->isModeElideNone())
|
||||||
{
|
{
|
||||||
return QLabel::sizeHint();
|
return QLabel::sizeHint();
|
||||||
}
|
}
|
||||||
|
@ -58,8 +58,8 @@ protected:
|
|||||||
public:
|
public:
|
||||||
using Super = QLabel;
|
using Super = QLabel;
|
||||||
|
|
||||||
CElidingLabel(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
CElidingLabel(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags ());
|
||||||
CElidingLabel(const QString& text, QWidget* parent = 0, Qt::WindowFlags f = 0);
|
CElidingLabel(const QString& text, QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags ());
|
||||||
virtual ~CElidingLabel();
|
virtual ~CElidingLabel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -733,8 +733,11 @@ void CFloatingDockContainer::changeEvent(QEvent *event)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
//============================================================================
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
bool CFloatingDockContainer::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
bool CFloatingDockContainer::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
||||||
|
#else
|
||||||
|
bool CFloatingDockContainer::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
QWidget::nativeEvent(eventType, message, result);
|
QWidget::nativeEvent(eventType, message, result);
|
||||||
MSG *msg = static_cast<MSG*>(message);
|
MSG *msg = static_cast<MSG*>(message);
|
||||||
|
@ -194,7 +194,11 @@ protected: // reimplements QWidget
|
|||||||
/**
|
/**
|
||||||
* Native event filter for handling WM_MOVING messages on Windows
|
* Native event filter for handling WM_MOVING messages on Windows
|
||||||
*/
|
*/
|
||||||
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
||||||
|
#else
|
||||||
|
virtual bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ void hideEmptyParentSplitters(CDockSplitter* FirstParentSplitter);
|
|||||||
class CDockInsertParam : public QPair<Qt::Orientation, bool>
|
class CDockInsertParam : public QPair<Qt::Orientation, bool>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using QPair::QPair;
|
using QPair<Qt::Orientation, bool>::QPair;
|
||||||
Qt::Orientation orientation() const {return this->first;}
|
Qt::Orientation orientation() const {return this->first;}
|
||||||
bool append() const {return this->second;}
|
bool append() const {return this->second;}
|
||||||
int insertOffset() const {return append() ? 1 : 0;}
|
int insertOffset() const {return append() ? 1 : 0;}
|
||||||
|
Loading…
Reference in New Issue
Block a user