Fixed all Qt6 build issues

This commit is contained in:
Uwe Kindler 2021-01-02 18:06:45 +01:00
parent c8fe4c46dd
commit 018ce2001e
11 changed files with 53 additions and 22 deletions

View File

@ -58,12 +58,15 @@
#include <QMessageBox>
#include <QMenu>
#include <QToolButton>
#include <QToolBar>
#include <QPointer>
#ifdef Q_OS_WIN
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QAxWidget>
#endif
#endif
#include <QMap>
#include <QElapsedTimer>
@ -355,6 +358,7 @@ struct MainWindowPrivate
#ifdef Q_OS_WIN
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
/**
* Creates an ActiveX widget on windows
*/
@ -368,6 +372,7 @@ struct MainWindowPrivate
return DockWidget;
}
#endif
#endif
};
@ -446,10 +451,12 @@ void MainWindowPrivate::createContent()
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(raise()));
#ifdef Q_OS_WIN
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if (!ads::CDockManager::testConfigFlag(ads::CDockManager::OpaqueUndocking))
{
DockManager->addDockWidget(ads::CenterDockWidgetArea, createActiveXWidget(), RighDockArea);
}
#endif
#endif
for (auto DockWidget : DockManager->dockWidgetsMap())

View File

@ -4,8 +4,10 @@ TARGET = AdvancedDockingSystemDemo
DESTDIR = $${ADS_OUT_ROOT}/lib
QT += core gui widgets
win32 {
QT += axcontainer
lessThan(QT_MAJOR_VERSION, 6) {
win32 {
QT += axcontainer
}
}
CONFIG += c++14

View File

@ -917,15 +917,15 @@ bool DockContainerWidgetPrivate::restoreSplitter(CDockingStateReader& s,
{
QWidget* ChildNode = nullptr;
bool Result = true;
if (s.name() == "Splitter")
if (s.name() == QLatin1String("Splitter"))
{
Result = restoreSplitter(s, ChildNode, Testing);
}
else if (s.name() == "Area")
else if (s.name() == QLatin1String("Area"))
{
Result = restoreDockArea(s, ChildNode, Testing);
}
else if (s.name() == "Sizes")
else if (s.name() == QLatin1String("Sizes"))
{
QString sSizes = s.readElementText().trimmed();
ADS_PRINT("Sizes: " << sSizes);
@ -1026,7 +1026,7 @@ bool DockContainerWidgetPrivate::restoreDockArea(CDockingStateReader& s,
while (s.readNextStartElement())
{
if (s.name() != "Widget")
if (s.name() != QLatin1String("Widget"))
{
continue;
}
@ -1089,12 +1089,12 @@ bool DockContainerWidgetPrivate::restoreChildNodes(CDockingStateReader& s,
bool Result = true;
while (s.readNextStartElement())
{
if (s.name() == "Splitter")
if (s.name() == QLatin1String("Splitter"))
{
Result = restoreSplitter(s, CreatedWidget, Testing);
ADS_PRINT("Splitter");
}
else if (s.name() == "Area")
else if (s.name() == QLatin1String("Area"))
{
Result = restoreDockArea(s, CreatedWidget, Testing);
ADS_PRINT("DockAreaWidget");
@ -1664,7 +1664,7 @@ bool CDockContainerWidget::restoreState(CDockingStateReader& s, bool Testing)
if (IsFloating)
{
ADS_PRINT("Restore floating widget");
if (!s.readNextStartElement() || s.name() != "Geometry")
if (!s.readNextStartElement() || s.name() != QLatin1String("Geometry"))
{
return false;
}

View File

@ -250,7 +250,7 @@ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int versi
}
CDockingStateReader s(state);
s.readNextStartElement();
if (s.name() != "QtAdvancedDockingSystem")
if (s.name() != QLatin1String("QtAdvancedDockingSystem"))
{
return false;
}
@ -304,7 +304,7 @@ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int versi
int DockContainerCount = 0;
while (s.readNextStartElement())
{
if (s.name() == "Container")
if (s.name() == QLatin1String("Container"))
{
Result = restoreContainer(DockContainerCount, s, Testing);
if (!Result)

View File

@ -806,10 +806,15 @@ void CDockOverlayCross::setIconColors(const QString& Colors)
{"Arrow", CDockOverlayCross::ArrowColor},
{"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)
{
auto ComponentColor = ColorListEntry.split('=', QString::SkipEmptyParts);
auto ComponentColor = ColorListEntry.split('=', SkipEmptyParts);
int Component = ColorCompenentStringMap.value(ComponentColor[0], -1);
if (Component < 0)
{

View File

@ -31,7 +31,7 @@
#include <QDebug>
#include <QChildEvent>
#include <QVariant>
#include "DockAreaWidget.h"
namespace ads
@ -52,7 +52,7 @@ CDockSplitter::CDockSplitter(QWidget *parent)
: QSplitter(parent),
d(new DockSplitterPrivate(this))
{
setProperty("ads-splitter", true);
setProperty("ads-splitter", QVariant(true));
setChildrenCollapsible(false);
}

View File

@ -163,7 +163,12 @@ void CElidingLabel::resizeEvent(QResizeEvent *event)
//============================================================================
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();
}
@ -180,7 +185,12 @@ QSize CElidingLabel::minimumSizeHint() 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();
}

View File

@ -58,8 +58,8 @@ protected:
public:
using Super = QLabel;
CElidingLabel(QWidget* parent = 0, Qt::WindowFlags f = 0);
CElidingLabel(const QString& text, 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 = Qt::WindowFlags ());
virtual ~CElidingLabel();
/**

View File

@ -733,8 +733,11 @@ void CFloatingDockContainer::changeEvent(QEvent *event)
#ifdef Q_OS_WIN
//============================================================================
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
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);
MSG *msg = static_cast<MSG*>(message);

View File

@ -194,7 +194,11 @@ protected: // reimplements QWidget
/**
* Native event filter for handling WM_MOVING messages on Windows
*/
virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
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

View File

@ -179,7 +179,7 @@ void hideEmptyParentSplitters(CDockSplitter* FirstParentSplitter);
class CDockInsertParam : public QPair<Qt::Orientation, bool>
{
public:
using QPair::QPair;
using QPair<Qt::Orientation, bool>::QPair;
Qt::Orientation orientation() const {return this->first;}
bool append() const {return this->second;}
int insertOffset() const {return append() ? 1 : 0;}