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
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
return m_displayedDate.startOfDay();
#else
return QDateTime(m_displayedDate);
#endif
}
void Calendar::setDisplayedDate(const QDate &dateTime)
@ -65,11 +61,7 @@ void Calendar::setDisplayedDate(const QDateTime &dateTime)
QDateTime Calendar::today() const
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
return m_today.startOfDay();
#else
return QDateTime(m_today);
#endif
}
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"));
qmlRegisterType<CalendarData>(uri, 2, 0, "CalendarData");
qmlRegisterType<Calendar>(uri, 2, 0, "Calendar");
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
qmlRegisterAnonymousType<QAbstractItemModel>(uri, 1);
qmlRegisterAnonymousType<QAbstractListModel>(uri, 1);
#else
qmlRegisterType<QAbstractItemModel>();
qmlRegisterType<QAbstractListModel>();
#endif
qmlRegisterSingletonType<EventPluginsManager>(uri, 2, 0, "EventPluginsManager", event_plugins_manager_provider);
qmlRegisterUncreatableType<EventDataDecorator>(uri, 2, 0, "EventDataDecorator",
QStringLiteral("Unabel to create EventDataDecorator from QML"));

View File

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

View File

@ -121,15 +121,9 @@ QString ContainmentActions::eventToString(QEvent *event)
case QEvent::Wheel: {
QWheelEvent *e = static_cast<QWheelEvent *>(event);
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()
// To support both, should we just remove this orientation string?
trigger += QStringLiteral("Vertical");
#endif
modifiers = e->modifiers();
break;
}

View File

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

View File

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

View File

@ -1278,24 +1278,13 @@ bool Dialog::event(QEvent *event)
case QEvent::Wheel: {
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();
#endif
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),
d->positionAdjustedForMainItem(pos) + position(),
we->pixelDelta(), we->angleDelta(),
we->buttons(), we->modifiers(), we->phase(), false /*inverted*/);
#endif
if (isVisible()) {
QCoreApplication::sendEvent(this, &we2);

View File

@ -43,11 +43,7 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, const QVariant
m_dummyNativeInterface(nullptr),
m_positionBeforeRemoval(QPointF(-1, -1))
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
qmlRegisterAnonymousType<QAction>("org.kde.plasma.plasmoid", 1);
#else
qmlRegisterType<QAction>();
#endif
connect(this, &AppletInterface::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"))) {
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);
#else
const QStringList appletNames = data.split(QLatin1Char('\n'), QString::SkipEmptyParts);
#endif
for (const QString &appletName : appletNames) {
qDebug() << "adding" << appletName;

View File

@ -49,11 +49,7 @@ DeclarativeAppletScript::DeclarativeAppletScript(QObject *parent, const QVariant
qmlRegisterUncreatableType<WallpaperInterface>("org.kde.plasma.plasmoid", 2, 0, "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);
#else
qmlRegisterType<KDeclarative::ConfigPropertyMap>();
#endif
}
DeclarativeAppletScript::~DeclarativeAppletScript()