Remove ifdefs, we require Qt 5.14 now

This commit is contained in:
Albert Astals Cid 2020-12-18 21:46:01 +01:00
parent c20f93d26e
commit ec41734969
10 changed files with 0 additions and 58 deletions

View File

@ -28,11 +28,7 @@ Calendar::Calendar(QObject *parent)
QDateTime Calendar::displayedDate() const QDateTime Calendar::displayedDate() const
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
return m_displayedDate.startOfDay(); return m_displayedDate.startOfDay();
#else
return QDateTime(m_displayedDate);
#endif
} }
void Calendar::setDisplayedDate(const QDate &dateTime) void Calendar::setDisplayedDate(const QDate &dateTime)
@ -65,11 +61,7 @@ void Calendar::setDisplayedDate(const QDateTime &dateTime)
QDateTime Calendar::today() const QDateTime Calendar::today() const
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
return m_today.startOfDay(); return m_today.startOfDay();
#else
return QDateTime(m_today);
#endif
} }
void Calendar::setToday(const QDateTime &dateTime) void Calendar::setToday(const QDateTime &dateTime)

View File

@ -27,13 +27,8 @@ void CalendarPlugin::registerTypes(const char *uri)
Q_ASSERT(uri == QByteArray("org.kde.plasma.calendar")); Q_ASSERT(uri == QByteArray("org.kde.plasma.calendar"));
qmlRegisterType<CalendarData>(uri, 2, 0, "CalendarData"); qmlRegisterType<CalendarData>(uri, 2, 0, "CalendarData");
qmlRegisterType<Calendar>(uri, 2, 0, "Calendar"); qmlRegisterType<Calendar>(uri, 2, 0, "Calendar");
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
qmlRegisterAnonymousType<QAbstractItemModel>(uri, 1); qmlRegisterAnonymousType<QAbstractItemModel>(uri, 1);
qmlRegisterAnonymousType<QAbstractListModel>(uri, 1); qmlRegisterAnonymousType<QAbstractListModel>(uri, 1);
#else
qmlRegisterType<QAbstractItemModel>();
qmlRegisterType<QAbstractListModel>();
#endif
qmlRegisterSingletonType<EventPluginsManager>(uri, 2, 0, "EventPluginsManager", event_plugins_manager_provider); qmlRegisterSingletonType<EventPluginsManager>(uri, 2, 0, "EventPluginsManager", event_plugins_manager_provider);
qmlRegisterUncreatableType<EventDataDecorator>(uri, 2, 0, "EventDataDecorator", qmlRegisterUncreatableType<EventDataDecorator>(uri, 2, 0, "EventDataDecorator",
QStringLiteral("Unabel to create EventDataDecorator from QML")); QStringLiteral("Unabel to create EventDataDecorator from QML"));

View File

@ -110,17 +110,9 @@ QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations")
QT_WARNING_POP QT_WARNING_POP
qmlRegisterType<ServiceOperationStatus>(uri, 2, 0, "ServiceOperationStatus"); qmlRegisterType<ServiceOperationStatus>(uri, 2, 0, "ServiceOperationStatus");
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
qmlRegisterAnonymousType<QAbstractItemModel>(uri, 1); qmlRegisterAnonymousType<QAbstractItemModel>(uri, 1);
#else
qmlRegisterType<QAbstractItemModel>();
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
qmlRegisterAnonymousType<QQmlPropertyMap>(uri, 1); qmlRegisterAnonymousType<QQmlPropertyMap>(uri, 1);
#else
qmlRegisterType<QQmlPropertyMap>();
#endif
qmlRegisterType<IconItem>(uri, 2, 0, "IconItem"); qmlRegisterType<IconItem>(uri, 2, 0, "IconItem");
qmlRegisterType<Plasma::WindowThumbnail>(uri, 2, 0, "WindowThumbnail"); qmlRegisterType<Plasma::WindowThumbnail>(uri, 2, 0, "WindowThumbnail");

View File

@ -121,15 +121,9 @@ QString ContainmentActions::eventToString(QEvent *event)
case QEvent::Wheel: { case QEvent::Wheel: {
QWheelEvent *e = static_cast<QWheelEvent *>(event); QWheelEvent *e = static_cast<QWheelEvent *>(event);
trigger = QStringLiteral("wheel:"); trigger = QStringLiteral("wheel:");
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
const int o = QObject::staticQtMetaObject.indexOfEnumerator("Orientations");
QMetaEnum orient = QObject::staticQtMetaObject.enumerator(o);
trigger += QString::fromLatin1(orient.valueToKey(e->orientation()));
#else
// ContainmentInterface::wheelEvent uses angleDelta.y() // ContainmentInterface::wheelEvent uses angleDelta.y()
// To support both, should we just remove this orientation string? // To support both, should we just remove this orientation string?
trigger += QStringLiteral("Vertical"); trigger += QStringLiteral("Vertical");
#endif
modifiers = e->modifiers(); modifiers = e->modifiers();
break; break;
} }

View File

@ -646,11 +646,7 @@ QStringList PluginLoader::listAppletCategories(const QString &parentApp, bool vi
void PluginLoader::setCustomAppletCategories(const QStringList &categories) void PluginLoader::setCustomAppletCategories(const QStringList &categories)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
PluginLoaderPrivate::s_customCategories = QSet<QString>(categories.begin(), categories.end()); PluginLoaderPrivate::s_customCategories = QSet<QString>(categories.begin(), categories.end());
#else
PluginLoaderPrivate::s_customCategories = QSet<QString>::fromList(categories);
#endif
} }
QStringList PluginLoader::customAppletCategories() const QStringList PluginLoader::customAppletCategories() const

View File

@ -680,11 +680,7 @@ void SvgPrivate::createRenderer()
void SvgPrivate::eraseRenderer() void SvgPrivate::eraseRenderer()
{ {
if (renderer && if (renderer &&
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
renderer->ref.loadRelaxed() == 2) { renderer->ref.loadRelaxed() == 2) {
#else
renderer->ref.load() == 2) {
#endif
// this and the cache reference it // this and the cache reference it
s_renderers.erase(s_renderers.find(styleCrc + path)); s_renderers.erase(s_renderers.find(styleCrc + path));
} }

View File

@ -1278,24 +1278,13 @@ bool Dialog::event(QEvent *event)
case QEvent::Wheel: { case QEvent::Wheel: {
QWheelEvent *we = static_cast<QWheelEvent *>(event); QWheelEvent *we = static_cast<QWheelEvent *>(event);
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
const QPoint pos = we->pos();
#else
const QPoint pos = we->position().toPoint(); const QPoint pos = we->position().toPoint();
#endif
if (!d->mainItemContainsPosition(pos)) { if (!d->mainItemContainsPosition(pos)) {
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QWheelEvent we2(d->positionAdjustedForMainItem(pos),
d->positionAdjustedForMainItem(pos) + position(),
we->pixelDelta(), we->angleDelta(), we->angleDelta().y(),
we->orientation(), we->buttons(), we->modifiers(), we->phase());
#else
QWheelEvent we2(d->positionAdjustedForMainItem(pos), QWheelEvent we2(d->positionAdjustedForMainItem(pos),
d->positionAdjustedForMainItem(pos) + position(), d->positionAdjustedForMainItem(pos) + position(),
we->pixelDelta(), we->angleDelta(), we->pixelDelta(), we->angleDelta(),
we->buttons(), we->modifiers(), we->phase(), false /*inverted*/); we->buttons(), we->modifiers(), we->phase(), false /*inverted*/);
#endif
if (isVisible()) { if (isVisible()) {
QCoreApplication::sendEvent(this, &we2); QCoreApplication::sendEvent(this, &we2);

View File

@ -43,11 +43,7 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, const QVariant
m_dummyNativeInterface(nullptr), m_dummyNativeInterface(nullptr),
m_positionBeforeRemoval(QPointF(-1, -1)) m_positionBeforeRemoval(QPointF(-1, -1))
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
qmlRegisterAnonymousType<QAction>("org.kde.plasma.plasmoid", 1); qmlRegisterAnonymousType<QAction>("org.kde.plasma.plasmoid", 1);
#else
qmlRegisterType<QAction>();
#endif
connect(this, &AppletInterface::configNeedsSaving, connect(this, &AppletInterface::configNeedsSaving,
applet(), &Plasma::Applet::configNeedsSaving); applet(), &Plasma::Applet::configNeedsSaving);

View File

@ -445,11 +445,7 @@ void ContainmentInterface::processMimeData(QMimeData *mimeData, int x, int y, KI
if (mimeData->hasFormat(QStringLiteral("text/x-plasmoidservicename"))) { if (mimeData->hasFormat(QStringLiteral("text/x-plasmoidservicename"))) {
QString data = QString::fromUtf8( mimeData->data(QStringLiteral("text/x-plasmoidservicename")) ); QString data = QString::fromUtf8( mimeData->data(QStringLiteral("text/x-plasmoidservicename")) );
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QStringList appletNames = data.split(QLatin1Char('\n'), Qt::SkipEmptyParts); const QStringList appletNames = data.split(QLatin1Char('\n'), Qt::SkipEmptyParts);
#else
const QStringList appletNames = data.split(QLatin1Char('\n'), QString::SkipEmptyParts);
#endif
for (const QString &appletName : appletNames) { for (const QString &appletName : appletNames) {
qDebug() << "adding" << appletName; qDebug() << "adding" << appletName;

View File

@ -49,11 +49,7 @@ DeclarativeAppletScript::DeclarativeAppletScript(QObject *parent, const QVariant
qmlRegisterUncreatableType<WallpaperInterface>("org.kde.plasma.plasmoid", 2, 0, "Wallpaper", qmlRegisterUncreatableType<WallpaperInterface>("org.kde.plasma.plasmoid", 2, 0, "Wallpaper",
QStringLiteral("Do not create objects of type Wallpaper")); QStringLiteral("Do not create objects of type Wallpaper"));
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
qmlRegisterAnonymousType<KDeclarative::ConfigPropertyMap>("org.kde.plasma.plasmoid", 1); qmlRegisterAnonymousType<KDeclarative::ConfigPropertyMap>("org.kde.plasma.plasmoid", 1);
#else
qmlRegisterType<KDeclarative::ConfigPropertyMap>();
#endif
} }
DeclarativeAppletScript::~DeclarativeAppletScript() DeclarativeAppletScript::~DeclarativeAppletScript()