Qt 5.5.1 (ubuntu 16.04) compatibility buildfixes

This commit is contained in:
Sergey Kartashev 2019-01-14 10:59:37 +03:00
parent 48382ccd82
commit 88d4bea2c1
5 changed files with 60 additions and 2 deletions

View File

@ -38,7 +38,9 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#if QT_VERSION >= 0x050600
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
std::shared_ptr<int> b; std::shared_ptr<int> b;
QApplication a(argc, argv); QApplication a(argc, argv);
a.setQuitOnLastWindowClosed(true); a.setQuitOnLastWindowClosed(true);

View File

@ -49,6 +49,32 @@
#include <iostream> #include <iostream>
#if QT_VERSION < 0x050900
inline char toHexLower(uint value)
{
return "0123456789abcdef"[value & 0xF];
}
QByteArray qByteArrayToHex(const QByteArray& src, char separator)
{
if(src.size() == 0)
return QByteArray();
const int length = separator ? (src.size() * 3 - 1) : (src.size() * 2);
QByteArray hex(length, Qt::Uninitialized);
char *hexData = hex.data();
const uchar *data = (const uchar *)src.data();
for (int i = 0, o = 0; i < src.size(); ++i) {
hexData[o++] = toHexLower(data[i] >> 4);
hexData[o++] = toHexLower(data[i] & 0xf);
if ((separator) && (o < length))
hexData[o++] = separator;
}
return hex;
}
#endif
namespace ads namespace ads
{ {
@ -1182,7 +1208,11 @@ void CDockContainerWidget::saveState(QXmlStreamWriter& s) const
{ {
CFloatingDockContainer* FloatingWidget = floatingWidget(); CFloatingDockContainer* FloatingWidget = floatingWidget();
QByteArray Geometry = FloatingWidget->saveGeometry(); QByteArray Geometry = FloatingWidget->saveGeometry();
#if QT_VERSION < 0x050900
s.writeTextElement("Geometry", qByteArrayToHex(Geometry, ' '));
#else
s.writeTextElement("Geometry", Geometry.toHex(' ')); s.writeTextElement("Geometry", Geometry.toHex(' '));
#endif
} }
d->saveChildNodesState(s, d->RootSplitter); d->saveChildNodesState(s, d->RootSplitter);
s.writeEndElement(); s.writeEndElement();

View File

@ -168,7 +168,11 @@ struct DockOverlayCrossPrivate
QColor borderColor = iconColor(CDockOverlayCross::FrameColor); QColor borderColor = iconColor(CDockOverlayCross::FrameColor);
QColor backgroundColor = iconColor(CDockOverlayCross::WindowBackgroundColor); QColor backgroundColor = iconColor(CDockOverlayCross::WindowBackgroundColor);
#if QT_VERSION >= 0x050600
double DevicePixelRatio = _this->window()->devicePixelRatioF(); double DevicePixelRatio = _this->window()->devicePixelRatioF();
#else
double DevicePixelRatio = _this->window()->devicePixelRatio();
#endif
QSizeF PixmapSize = size * DevicePixelRatio; QSizeF PixmapSize = size * DevicePixelRatio;
QPixmap pm(PixmapSize.toSize()); QPixmap pm(PixmapSize.toSize());
pm.fill(QColor(0, 0, 0, 0)); pm.fill(QColor(0, 0, 0, 0));
@ -577,8 +581,11 @@ void CDockOverlayCross::setupOverlayCross(CDockOverlay::eMode Mode)
areaWidgets.insert(BottomDockWidgetArea, d->createDropIndicatorWidget(BottomDockWidgetArea, Mode)); areaWidgets.insert(BottomDockWidgetArea, d->createDropIndicatorWidget(BottomDockWidgetArea, Mode));
areaWidgets.insert(LeftDockWidgetArea, d->createDropIndicatorWidget(LeftDockWidgetArea, Mode)); areaWidgets.insert(LeftDockWidgetArea, d->createDropIndicatorWidget(LeftDockWidgetArea, Mode));
areaWidgets.insert(CenterDockWidgetArea, d->createDropIndicatorWidget(CenterDockWidgetArea, Mode)); areaWidgets.insert(CenterDockWidgetArea, d->createDropIndicatorWidget(CenterDockWidgetArea, Mode));
#if QT_VERSION >= 0x050600
d->LastDevicePixelRatio = devicePixelRatioF(); d->LastDevicePixelRatio = devicePixelRatioF();
#else
d->LastDevicePixelRatio = devicePixelRatio();
#endif
setAreaWidgets(areaWidgets); setAreaWidgets(areaWidgets);
d->UpdateRequired = false; d->UpdateRequired = false;
} }
@ -596,7 +603,11 @@ void CDockOverlayCross::updateOverlayIcons()
{ {
d->updateDropIndicatorIcon(Widget); d->updateDropIndicatorIcon(Widget);
} }
#if QT_VESION >= 0x050600
d->LastDevicePixelRatio = devicePixelRatioF(); d->LastDevicePixelRatio = devicePixelRatioF();
#else
d->LastDevicePixelRatio = devicePixelRatio();
#endif
} }

View File

@ -214,7 +214,7 @@ CDockWidget::CDockWidget(const QString &title, QWidget *parent) :
setObjectName(title); setObjectName(title);
d->TabWidget = new CDockWidgetTab(this); d->TabWidget = new CDockWidgetTab(this);
d->ToggleViewAction = new QAction(title); d->ToggleViewAction = new QAction(title, nullptr);
d->ToggleViewAction->setCheckable(true); d->ToggleViewAction->setCheckable(true);
connect(d->ToggleViewAction, SIGNAL(triggered(bool)), this, connect(d->ToggleViewAction, SIGNAL(triggered(bool)), this,
SLOT(toggleView(bool))); SLOT(toggleView(bool)));
@ -282,7 +282,18 @@ void CDockWidget::setFeatures(DockWidgetFeatures features)
//============================================================================ //============================================================================
void CDockWidget::setFeature(DockWidgetFeature flag, bool on) void CDockWidget::setFeature(DockWidgetFeature flag, bool on)
{ {
#if QT_VERSION >= 0x050700
d->Features.setFlag(flag, on); d->Features.setFlag(flag, on);
#else
if(on)
{
d->Features |= flag;
}
else
{
d->Features &= ~flag;
}
#endif
} }

View File

@ -28,6 +28,10 @@ windows {
} }
} }
unix {
CONFIG += c++11
}
RESOURCES += ads.qrc RESOURCES += ads.qrc
HEADERS += \ HEADERS += \