mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-12 16:20:25 +08:00
Qt 5.5.1 (ubuntu 16.04) compatibility buildfixes
This commit is contained in:
parent
48382ccd82
commit
88d4bea2c1
@ -38,7 +38,9 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#if QT_VERSION >= 0x050600
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
std::shared_ptr<int> b;
|
||||
QApplication a(argc, argv);
|
||||
a.setQuitOnLastWindowClosed(true);
|
||||
|
@ -49,6 +49,32 @@
|
||||
|
||||
#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
|
||||
{
|
||||
@ -1182,7 +1208,11 @@ void CDockContainerWidget::saveState(QXmlStreamWriter& s) const
|
||||
{
|
||||
CFloatingDockContainer* FloatingWidget = floatingWidget();
|
||||
QByteArray Geometry = FloatingWidget->saveGeometry();
|
||||
#if QT_VERSION < 0x050900
|
||||
s.writeTextElement("Geometry", qByteArrayToHex(Geometry, ' '));
|
||||
#else
|
||||
s.writeTextElement("Geometry", Geometry.toHex(' '));
|
||||
#endif
|
||||
}
|
||||
d->saveChildNodesState(s, d->RootSplitter);
|
||||
s.writeEndElement();
|
||||
|
@ -168,7 +168,11 @@ struct DockOverlayCrossPrivate
|
||||
QColor borderColor = iconColor(CDockOverlayCross::FrameColor);
|
||||
QColor backgroundColor = iconColor(CDockOverlayCross::WindowBackgroundColor);
|
||||
|
||||
#if QT_VERSION >= 0x050600
|
||||
double DevicePixelRatio = _this->window()->devicePixelRatioF();
|
||||
#else
|
||||
double DevicePixelRatio = _this->window()->devicePixelRatio();
|
||||
#endif
|
||||
QSizeF PixmapSize = size * DevicePixelRatio;
|
||||
QPixmap pm(PixmapSize.toSize());
|
||||
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(LeftDockWidgetArea, d->createDropIndicatorWidget(LeftDockWidgetArea, Mode));
|
||||
areaWidgets.insert(CenterDockWidgetArea, d->createDropIndicatorWidget(CenterDockWidgetArea, Mode));
|
||||
#if QT_VERSION >= 0x050600
|
||||
d->LastDevicePixelRatio = devicePixelRatioF();
|
||||
|
||||
#else
|
||||
d->LastDevicePixelRatio = devicePixelRatio();
|
||||
#endif
|
||||
setAreaWidgets(areaWidgets);
|
||||
d->UpdateRequired = false;
|
||||
}
|
||||
@ -596,7 +603,11 @@ void CDockOverlayCross::updateOverlayIcons()
|
||||
{
|
||||
d->updateDropIndicatorIcon(Widget);
|
||||
}
|
||||
#if QT_VESION >= 0x050600
|
||||
d->LastDevicePixelRatio = devicePixelRatioF();
|
||||
#else
|
||||
d->LastDevicePixelRatio = devicePixelRatio();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -214,7 +214,7 @@ CDockWidget::CDockWidget(const QString &title, QWidget *parent) :
|
||||
setObjectName(title);
|
||||
|
||||
d->TabWidget = new CDockWidgetTab(this);
|
||||
d->ToggleViewAction = new QAction(title);
|
||||
d->ToggleViewAction = new QAction(title, nullptr);
|
||||
d->ToggleViewAction->setCheckable(true);
|
||||
connect(d->ToggleViewAction, SIGNAL(triggered(bool)), this,
|
||||
SLOT(toggleView(bool)));
|
||||
@ -282,7 +282,18 @@ void CDockWidget::setFeatures(DockWidgetFeatures features)
|
||||
//============================================================================
|
||||
void CDockWidget::setFeature(DockWidgetFeature flag, bool on)
|
||||
{
|
||||
#if QT_VERSION >= 0x050700
|
||||
d->Features.setFlag(flag, on);
|
||||
#else
|
||||
if(on)
|
||||
{
|
||||
d->Features |= flag;
|
||||
}
|
||||
else
|
||||
{
|
||||
d->Features &= ~flag;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,6 +28,10 @@ windows {
|
||||
}
|
||||
}
|
||||
|
||||
unix {
|
||||
CONFIG += c++11
|
||||
}
|
||||
|
||||
RESOURCES += ads.qrc
|
||||
|
||||
HEADERS += \
|
||||
|
Loading…
Reference in New Issue
Block a user