From e579076bb36e6594003b2ade7f3d062944ef6f47 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 16 Nov 2016 14:22:36 +0100 Subject: Get rid of most QT_NO_FOO usages Instead use QT_CONFIG(foo). This change actually detected a few mis-spelled macros and invalid usages. Change-Id: I06ac327098dd1a458e6bc379d637b8e2dac52f85 Reviewed-by: Simon Hausmann --- src/imports/folderlistmodel/fileinfothread.cpp | 16 +-- src/imports/folderlistmodel/fileinfothread_p.h | 4 +- src/imports/folderlistmodel/plugin.cpp | 2 - src/imports/localstorage/plugin.cpp | 6 +- .../qmldbg_inspector/qquickwindowinspector.cpp | 2 +- src/qml/compiler/qqmlpropertyvalidator.cpp | 4 +- src/qml/compiler/qv4compileddata.cpp | 2 +- src/qml/debugger/qqmlmemoryprofiler.cpp | 4 +- src/qml/qml/qqmlapplicationengine.cpp | 6 +- src/qml/qml/qqmlapplicationengine_p.h | 2 +- src/qml/qml/qqmlerror.cpp | 2 +- src/qml/qml/qqmlglobal.cpp | 2 - src/qml/qml/qqmlglobal_p.h | 2 - src/qml/qml/qqmlimport.cpp | 14 +- src/qml/qml/qqmlmetatype.cpp | 2 +- src/qml/qml/qqmlobjectcreator.cpp | 4 +- src/qml/qml/qqmlstringconverters.cpp | 12 +- src/qml/qml/qqmlstringconverters_p.h | 2 +- src/qml/qml/qqmlxmlhttprequest.cpp | 10 +- src/qml/qml/qqmlxmlhttprequest_p.h | 4 +- src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 10 +- src/qml/qml/v8/qqmlbuiltinfunctions_p.h | 4 +- src/qml/qml/v8/qv8engine.cpp | 4 +- src/qmltest/quicktest.cpp | 2 +- src/qmltest/quicktestevent.cpp | 4 +- src/qmltest/quicktestevent_p.h | 2 +- src/quick/accessible/qaccessiblequickitem.cpp | 4 +- src/quick/accessible/qaccessiblequickitem_p.h | 4 +- src/quick/accessible/qaccessiblequickview.cpp | 4 +- src/quick/accessible/qaccessiblequickview_p.h | 4 +- src/quick/accessible/qquickaccessiblefactory.cpp | 2 +- src/quick/accessible/qquickaccessiblefactory_p.h | 2 +- src/quick/designer/qquickdesignersupport.cpp | 2 +- src/quick/designer/qquickdesignerwindowmanager.cpp | 4 +- src/quick/designer/qquickdesignerwindowmanager_p.h | 4 +- src/quick/items/context2d/qquickcanvasitem.cpp | 2 +- src/quick/items/context2d/qquickcontext2d.cpp | 14 +- .../context2d/qquickcontext2dcommandbuffer.cpp | 2 +- .../items/context2d/qquickcontext2dtexture.cpp | 10 +- .../items/context2d/qquickcontext2dtexture_p.h | 8 +- src/quick/items/context2d/qquickcontext2dtile.cpp | 4 +- src/quick/items/context2d/qquickcontext2dtile_p.h | 4 +- src/quick/items/qquickaccessibleattached.cpp | 2 +- src/quick/items/qquickaccessibleattached_p.h | 4 +- src/quick/items/qquickdrag.cpp | 4 +- src/quick/items/qquickdrag_p.h | 4 +- src/quick/items/qquickdroparea.cpp | 4 +- src/quick/items/qquickdroparea_p.h | 4 +- src/quick/items/qquickflickable.cpp | 2 +- src/quick/items/qquickflickable_p.h | 2 +- src/quick/items/qquickgraphicsinfo.cpp | 2 +- src/quick/items/qquickitem.cpp | 68 ++++----- src/quick/items/qquickitem.h | 14 +- src/quick/items/qquickitem_p.h | 10 +- src/quick/items/qquickitemsmodule.cpp | 8 +- src/quick/items/qquickmousearea.cpp | 30 ++-- src/quick/items/qquickmousearea_p.h | 12 +- src/quick/items/qquickmousearea_p_p.h | 4 +- src/quick/items/qquickpainteditem.cpp | 2 +- src/quick/items/qquickpincharea.cpp | 4 +- src/quick/items/qquickrendercontrol.cpp | 8 +- src/quick/items/qquickshadereffect.cpp | 48 +++---- src/quick/items/qquickshadereffect_p.h | 2 +- src/quick/items/qquicktext.cpp | 6 +- src/quick/items/qquicktextcontrol.cpp | 89 ++++++------ src/quick/items/qquicktextcontrol_p.h | 6 +- src/quick/items/qquicktextcontrol_p_p.h | 8 +- src/quick/items/qquicktextdocument.cpp | 2 +- src/quick/items/qquicktextedit.cpp | 72 +++++----- src/quick/items/qquicktextedit_p.h | 6 +- src/quick/items/qquicktextedit_p_p.h | 6 +- src/quick/items/qquicktextinput.cpp | 152 ++++++++++----------- src/quick/items/qquicktextinput_p.h | 8 +- src/quick/items/qquicktextinput_p_p.h | 26 ++-- src/quick/items/qquicktextnode.cpp | 4 +- src/quick/items/qquicktextnodeengine.cpp | 6 +- src/quick/items/qquickwindow.cpp | 58 ++++---- src/quick/items/qquickwindow.h | 8 +- src/quick/items/qquickwindow_p.h | 12 +- src/quick/qtquick2.cpp | 2 +- src/quick/scenegraph/coreapi/qsggeometry.cpp | 4 +- src/quick/scenegraph/coreapi/qsgmaterial.cpp | 10 +- src/quick/scenegraph/coreapi/qsgmaterial.h | 12 +- src/quick/scenegraph/coreapi/qsgmaterialshader_p.h | 2 +- src/quick/scenegraph/coreapi/qsgrenderer.cpp | 12 +- src/quick/scenegraph/coreapi/qsgrenderer_p.h | 2 +- src/quick/scenegraph/qsgadaptationlayer.cpp | 2 +- src/quick/scenegraph/qsgcontextplugin.cpp | 12 +- src/quick/scenegraph/qsgrenderloop.cpp | 12 +- src/quick/scenegraph/util/qsgdistancefieldutil.cpp | 2 +- src/quick/scenegraph/util/qsgengine.cpp | 6 +- src/quick/scenegraph/util/qsgflatcolormaterial.cpp | 10 +- src/quick/scenegraph/util/qsgsimplematerial.h | 4 +- src/quick/scenegraph/util/qsgtexture.cpp | 18 +-- src/quick/scenegraph/util/qsgtexture_p.h | 2 +- src/quick/scenegraph/util/qsgtexturematerial.cpp | 18 +-- .../scenegraph/util/qsgvertexcolormaterial.cpp | 10 +- src/quick/util/qquickanimatorjob_p.h | 2 +- src/quick/util/qquickglobal.cpp | 2 +- src/quick/util/qquickutilmodule.cpp | 4 +- src/quick/util/qquickvalidator.cpp | 4 +- src/quick/util/qquickvalidator_p.h | 4 +- src/quickwidgets/qquickwidget.cpp | 42 +++--- src/quickwidgets/qquickwidget.h | 4 +- src/quickwidgets/qquickwidget_p.h | 4 +- 105 files changed, 550 insertions(+), 565 deletions(-) (limited to 'src') diff --git a/src/imports/folderlistmodel/fileinfothread.cpp b/src/imports/folderlistmodel/fileinfothread.cpp index 0b62935f87..d3e256bb7e 100644 --- a/src/imports/folderlistmodel/fileinfothread.cpp +++ b/src/imports/folderlistmodel/fileinfothread.cpp @@ -46,7 +46,7 @@ FileInfoThread::FileInfoThread(QObject *parent) : QThread(parent), abort(false), -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) watcher(0), #endif sortFlags(QDir::Name), @@ -61,11 +61,11 @@ FileInfoThread::FileInfoThread(QObject *parent) showOnlyReadable(false), caseSensitive(true) { -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) watcher = new QFileSystemWatcher(this); connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(dirChanged(QString))); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(updateFile(QString))); -#endif // !QT_NO_FILESYSTEMWATCHER +#endif // filesystemwatcher } FileInfoThread::~FileInfoThread() @@ -80,7 +80,7 @@ FileInfoThread::~FileInfoThread() void FileInfoThread::clear() { QMutexLocker locker(&mutex); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) watcher->removePaths(watcher->files()); watcher->removePaths(watcher->directories()); #endif @@ -89,7 +89,7 @@ void FileInfoThread::clear() void FileInfoThread::removePath(const QString &path) { QMutexLocker locker(&mutex); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) if (!path.startsWith(QLatin1Char(':'))) watcher->removePath(path); #else @@ -103,7 +103,7 @@ void FileInfoThread::setPath(const QString &path) Q_ASSERT(!path.isEmpty()); QMutexLocker locker(&mutex); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) if (!path.startsWith(QLatin1Char(':'))) watcher->addPath(path); #endif @@ -120,7 +120,7 @@ void FileInfoThread::setRootPath(const QString &path) rootPath = path; } -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) void FileInfoThread::dirChanged(const QString &directoryPath) { Q_UNUSED(directoryPath); @@ -204,7 +204,7 @@ void FileInfoThread::setCaseSensitive(bool on) condition.wakeAll(); } -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) void FileInfoThread::updateFile(const QString &path) { Q_UNUSED(path); diff --git a/src/imports/folderlistmodel/fileinfothread_p.h b/src/imports/folderlistmodel/fileinfothread_p.h index 8a154f264e..75da12a421 100644 --- a/src/imports/folderlistmodel/fileinfothread_p.h +++ b/src/imports/folderlistmodel/fileinfothread_p.h @@ -88,7 +88,7 @@ public: void setCaseSensitive(bool on); public Q_SLOTS: -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) void dirChanged(const QString &directoryPath); void updateFile(const QString &path); #endif @@ -103,7 +103,7 @@ private: QWaitCondition condition; volatile bool abort; -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) QFileSystemWatcher *watcher; #endif QList currentFileList; diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp index affde1c3aa..ef719109bd 100644 --- a/src/imports/folderlistmodel/plugin.cpp +++ b/src/imports/folderlistmodel/plugin.cpp @@ -62,12 +62,10 @@ public: void registerTypes(const char *uri) Q_DECL_OVERRIDE { Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.folderlistmodel")); -#ifndef QT_NO_DIRMODEL qmlRegisterType(uri,1,0,"FolderListModel"); qmlRegisterType(uri,2,0,"FolderListModel"); qmlRegisterType(uri,2,1,"FolderListModel"); qmlRegisterType(uri,2,2,"FolderListModel"); -#endif } }; //![class decl] diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index bf70fd1050..cd6d37ea5a 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -449,7 +449,7 @@ static ReturnedValue qmlsqldatabase_changeVersion(CallContext *ctx) if (ok) { *w->d()->version = to_version; -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) QSettings ini(qmlsqldatabase_databaseFile(db.connectionName(), scope.engine) + QLatin1String(".ini"), QSettings::IniFormat); ini.setValue(QLatin1String("Version"), to_version); #endif @@ -700,7 +700,7 @@ public: void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args) { -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) QV4::Scope scope(args->v4engine()); if (scope.engine->qmlEngine()->offlineStoragePath().isEmpty()) V4THROW_SQL2(SQLEXCEPTION_DATABASE_ERR, QQmlEngine::tr("SQL: can't create database, offline storage is disabled.")); @@ -770,7 +770,7 @@ void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args) } args->setReturnValue(db.asReturnedValue()); -#endif // QT_NO_SETTINGS +#endif // settings } static QObject *module_api_factory(QQmlEngine *engine, QJSEngine *scriptEngine) diff --git a/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.cpp index 2525500e65..7d260a4d2a 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.cpp @@ -153,7 +153,7 @@ bool QQuickWindowInspector::eventFilter(QObject *obj, QEvent *event) case QEvent::MouseButtonDblClick: m_tool->mouseDoubleClickEvent(static_cast(event)); return true; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: return true; #endif diff --git a/src/qml/compiler/qqmlpropertyvalidator.cpp b/src/qml/compiler/qqmlpropertyvalidator.cpp index 45379d5155..383c20239f 100644 --- a/src/qml/compiler/qqmlpropertyvalidator.cpp +++ b/src/qml/compiler/qqmlpropertyvalidator.cpp @@ -412,7 +412,7 @@ QQmlCompileError QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache } } break; -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) case QVariant::Date: { bool ok = false; QQmlStringConverters::dateFromString(binding->valueAsString(qmlUnit), &ok); @@ -437,7 +437,7 @@ QQmlCompileError QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache } } break; -#endif // QT_NO_DATESTRING +#endif // datestring case QVariant::Point: { bool ok = false; QQmlStringConverters::pointFFromString(binding->valueAsString(qmlUnit), &ok); diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index f8668b48e4..8586c84c3d 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -471,7 +471,7 @@ QString Binding::valueAsString(const Unit *unit) const return QString::number(valueAsNumber()); case Type_Invalid: return QString(); -#ifdef QT_NO_TRANSLATION +#if !QT_CONFIG(translation) case Type_TranslationById: case Type_Translation: return unit->stringAt(stringIndex); diff --git a/src/qml/debugger/qqmlmemoryprofiler.cpp b/src/qml/debugger/qqmlmemoryprofiler.cpp index 53d4e7ab21..b89dbfd02d 100644 --- a/src/qml/debugger/qqmlmemoryprofiler.cpp +++ b/src/qml/debugger/qqmlmemoryprofiler.cpp @@ -62,13 +62,13 @@ static qmlmemprofile_pop_location *memprofile_pop_location; static qmlmemprofile_save *memprofile_save; static qmlmemprofile_is_enabled *memprofile_is_enabled; -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) extern QFunctionPointer qt_linux_find_symbol_sys(const char *symbol); #endif bool QQmlMemoryScope::doOpenLibrary() { -#if defined(Q_OS_LINUX) && !defined(QT_NO_LIBRARY) +#if defined(Q_OS_LINUX) && QT_CONFIG(library) if (state == Unloaded) { memprofile_stats = (qmlmemprofile_stats *) qt_linux_find_symbol_sys("qmlmemprofile_stats"); memprofile_clear = (qmlmemprofile_clear *) qt_linux_find_symbol_sys("qmlmemprofile_clear"); diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp index fef2da753b..21a1a13687 100644 --- a/src/qml/qml/qqmlapplicationengine.cpp +++ b/src/qml/qml/qqmlapplicationengine.cpp @@ -58,7 +58,7 @@ QQmlApplicationEnginePrivate::~QQmlApplicationEnginePrivate() void QQmlApplicationEnginePrivate::cleanUp() { qDeleteAll(objects); -#ifndef QT_NO_TRANSLATION +#if QT_CONFIG(translation) qDeleteAll(translators); #endif } @@ -70,7 +70,7 @@ void QQmlApplicationEnginePrivate::init() q, SLOT(_q_finishLoad(QObject*))); q->connect(q, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit())); q->connect(q, &QQmlApplicationEngine::exit, QCoreApplication::instance(), &QCoreApplication::exit); -#ifndef QT_NO_TRANSLATION +#if QT_CONFIG(translation) QTranslator* qtTranslator = new QTranslator; if (qtTranslator->load(QLatin1String("qt_") + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) QCoreApplication::installTranslator(qtTranslator); @@ -82,7 +82,7 @@ void QQmlApplicationEnginePrivate::init() void QQmlApplicationEnginePrivate::loadTranslations(const QUrl &rootFile) { -#ifndef QT_NO_TRANSLATION +#if QT_CONFIG(translation) if (rootFile.scheme() != QLatin1String("file") && rootFile.scheme() != QLatin1String("qrc")) return; diff --git a/src/qml/qml/qqmlapplicationengine_p.h b/src/qml/qml/qqmlapplicationengine_p.h index e1d1b4a7bb..8c342a43a9 100644 --- a/src/qml/qml/qqmlapplicationengine_p.h +++ b/src/qml/qml/qqmlapplicationengine_p.h @@ -78,7 +78,7 @@ public: QSignalMapper statusMapper; QObject *appObj; -#ifndef QT_NO_TRANSLATIONS +#if QT_CONFIG(translation) QList translators; #endif }; diff --git a/src/qml/qml/qqmlerror.cpp b/src/qml/qml/qqmlerror.cpp index b309550ca8..0a6c7b4960 100644 --- a/src/qml/qml/qqmlerror.cpp +++ b/src/qml/qml/qqmlerror.cpp @@ -285,7 +285,7 @@ QDebug operator<<(QDebug debug, const QQmlError &error) if (f.open(QIODevice::ReadOnly)) { QByteArray data = f.readAll(); QTextStream stream(data, QIODevice::ReadOnly); -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) stream.setCodec("UTF-8"); #endif const QString code = stream.readAll(); diff --git a/src/qml/qml/qqmlglobal.cpp b/src/qml/qml/qqmlglobal.cpp index 722527a546..f967dacd34 100644 --- a/src/qml/qml/qqmlglobal.cpp +++ b/src/qml/qml/qqmlglobal.cpp @@ -326,7 +326,6 @@ QObject *QQmlGuiProvider::application(QObject *) { return new QQmlApplication(); QStringList QQmlGuiProvider::fontFamilies() { return QStringList(); } bool QQmlGuiProvider::openUrlExternally(QUrl &) { return false; } -#ifndef QT_NO_IM QObject *QQmlGuiProvider::inputMethod() { // We don't have any input method code by default @@ -335,7 +334,6 @@ QObject *QQmlGuiProvider::inputMethod() QQmlEngine::setObjectOwnership(o, QQmlEngine::JavaScriptOwnership); return o; } -#endif QObject *QQmlGuiProvider::styleHints() { diff --git a/src/qml/qml/qqmlglobal_p.h b/src/qml/qml/qqmlglobal_p.h index 0f5cf3a392..707814e781 100644 --- a/src/qml/qml/qqmlglobal_p.h +++ b/src/qml/qml/qqmlglobal_p.h @@ -307,9 +307,7 @@ class Q_QML_PRIVATE_EXPORT QQmlGuiProvider public: virtual ~QQmlGuiProvider(); virtual QObject *application(QObject *parent); -#ifndef QT_NO_IM virtual QObject *inputMethod(); -#endif virtual QObject *styleHints(); virtual QStringList fontFamilies(); virtual bool openUrlExternally(QUrl &); diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index 98e2f9eefd..f2cbf5a94f 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -176,7 +176,7 @@ QQmlType *getTypeForUrl(const QString &urlString, const QHashedStringRef& typeNa } // namespace -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) struct RegisteredPlugin { QString uri; QPluginLoader* loader; @@ -301,7 +301,7 @@ public: const QString &uri, const QString &url, int vmaj, int vmin, QV4::CompiledData::Import::ImportType type, QList *errors, bool lowPrecedence = false); -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) bool populatePluginPairVector(QVector &result, const QString &uri, const QStringList &versionUris, const QString &qmldirPath, QList *errors); #endif @@ -897,7 +897,7 @@ static QStringList versionUriList(const QString &uri, int vmaj, int vmin) return result; } -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) /*! Get all static plugins that are QML plugins and has a meta data URI that matches with one of \a versionUris, which is a list of all possible versioned URI combinations - see versionUriList() @@ -960,7 +960,7 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath, const QQmlTypeLoader::QmldirContent *qmldir, QList *errors) { -#if !defined(QT_NO_LIBRARY) +#if QT_CONFIG(library) Q_ASSERT(qmldir); if (qmlImportTrace()) @@ -1087,7 +1087,7 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath, } return false; -#endif // QT_NO_LIBRARY +#endif // library return true; } @@ -1948,7 +1948,7 @@ bool QQmlImportDatabase::registerPluginTypes(QObject *instance, const QString &b bool QQmlImportDatabase::importStaticPlugin(QObject *instance, const QString &basePath, const QString &uri, const QString &typeNamespace, int vmaj, QList *errors) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) // Dynamic plugins are differentiated by their filepath. For static plugins we // don't have that information so we use their address as key instead. const QString uniquePluginID = QString::asprintf("%p", instance); @@ -2001,7 +2001,7 @@ bool QQmlImportDatabase::importStaticPlugin(QObject *instance, const QString &ba bool QQmlImportDatabase::importDynamicPlugin(const QString &filePath, const QString &uri, const QString &typeNamespace, int vmaj, QList *errors) { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QFileInfo fileInfo(filePath); const QString absoluteFilePath = fileInfo.absoluteFilePath(); diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index ce0f4b798a..51964a7d11 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -1158,7 +1158,7 @@ void qmlClearTypeRegistrations() // Declared in qqml.h data->uriToModule.clear(); QQmlEnginePrivate::baseModulesUninitialized = true; //So the engine re-registers its types -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) qmlClearEnginePlugins(); #endif } diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 2218f277d6..115925e34a 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -402,7 +402,7 @@ void QQmlObjectCreator::setPropertyValue(const QQmlPropertyData *property, const } } break; -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) case QVariant::Date: { bool ok = false; QDate value = QQmlStringConverters::dateFromString(binding->valueAsString(qmlUnit), &ok); @@ -430,7 +430,7 @@ void QQmlObjectCreator::setPropertyValue(const QQmlPropertyData *property, const property->writeProperty(_qobject, &value, propertyWriteFlags); } break; -#endif // QT_NO_DATESTRING +#endif // datestring case QVariant::Point: { bool ok = false; QPoint value = QQmlStringConverters::pointFFromString(binding->valueAsString(qmlUnit), &ok).toPoint(); diff --git a/src/qml/qml/qqmlstringconverters.cpp b/src/qml/qml/qqmlstringconverters.cpp index d2b3577a1f..e53f90b45b 100644 --- a/src/qml/qml/qqmlstringconverters.cpp +++ b/src/qml/qml/qqmlstringconverters.cpp @@ -71,14 +71,14 @@ QVariant QQmlStringConverters::variantFromString(const QString &s, int preferred return QVariant(int(qRound(s.toDouble(ok)))); case QMetaType::UInt: return QVariant(uint(qRound(s.toDouble(ok)))); -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) case QMetaType::QDate: return QVariant::fromValue(dateFromString(s, ok)); case QMetaType::QTime: return QVariant::fromValue(timeFromString(s, ok)); case QMetaType::QDateTime: return QVariant::fromValue(dateTimeFromString(s, ok)); -#endif // QT_NO_DATESTRING +#endif // datestring case QMetaType::QPointF: return QVariant::fromValue(pointFFromString(s, ok)); case QMetaType::QPoint: @@ -106,7 +106,7 @@ unsigned QQmlStringConverters::rgbaFromString(const QString &s, bool *ok) return QQml_colorProvider()->rgbaFromString(s, ok); } -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) QDate QQmlStringConverters::dateFromString(const QString &s, bool *ok) { QDate d = QDate::fromString(s, Qt::ISODate); @@ -130,7 +130,7 @@ QDateTime QQmlStringConverters::dateTimeFromString(const QString &s, bool *ok) d.setTimeSpec(Qt::UTC); return d; } -#endif // QT_NO_DATESTRING +#endif // datestring //expects input of "x,y" QPointF QQmlStringConverters::pointFFromString(const QString &s, bool *ok) @@ -229,7 +229,7 @@ bool QQmlStringConverters::createFromString(int type, const QString &s, void *da *p = uint(qRound(s.toDouble(&ok))); return ok; } -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) case QMetaType::QDate: { Q_ASSERT(n >= sizeof(QDate)); @@ -251,7 +251,7 @@ bool QQmlStringConverters::createFromString(int type, const QString &s, void *da *p = dateTimeFromString(s, &ok); return ok; } -#endif // QT_NO_DATESTRING +#endif // datestring case QMetaType::QPointF: { Q_ASSERT(n >= sizeof(QPointF)); diff --git a/src/qml/qml/qqmlstringconverters_p.h b/src/qml/qml/qqmlstringconverters_p.h index b67cefaf35..af344e3344 100644 --- a/src/qml/qml/qqmlstringconverters_p.h +++ b/src/qml/qml/qqmlstringconverters_p.h @@ -72,7 +72,7 @@ namespace QQmlStringConverters Q_QML_PRIVATE_EXPORT QVariant colorFromString(const QString &, bool *ok = 0); Q_QML_PRIVATE_EXPORT unsigned rgbaFromString(const QString &, bool *ok = 0); -#ifndef QT_NO_DATESTRING +#if QT_CONFIG(datestring) Q_QML_PRIVATE_EXPORT QDate dateFromString(const QString &, bool *ok = 0); Q_QML_PRIVATE_EXPORT QTime timeFromString(const QString &, bool *ok = 0); Q_QML_PRIVATE_EXPORT QDateTime dateTimeFromString(const QString &, bool *ok = 0); diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 10b1cbcfd4..6b86e38f19 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -70,7 +70,7 @@ using namespace QV4; -#if !defined(QT_NO_XMLSTREAMREADER) && QT_CONFIG(qml_network) +#if QT_CONFIG(xmlstreamreader) && QT_CONFIG(qml_network) #define V4THROW_REFERENCE(string) { \ ScopedObject error(scope, ctx->engine()->newReferenceErrorObject(QStringLiteral(string))); \ @@ -1068,7 +1068,7 @@ private: QByteArray m_mime; QByteArray m_charset; QTextCodec *m_textCodec; -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) QTextCodec* findTextCodec() const; #endif void readEncoding(); @@ -1510,7 +1510,7 @@ QV4::ReturnedValue QQmlXMLHttpRequest::xmlResponseBody(QV4::ExecutionEngine* eng return m_parsedDocument.value(); } -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) QTextCodec* QQmlXMLHttpRequest::findTextCodec() const { QTextCodec *codec = 0; @@ -1539,7 +1539,7 @@ QTextCodec* QQmlXMLHttpRequest::findTextCodec() const QString QQmlXMLHttpRequest::responseBody() { -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) if (!m_textCodec) m_textCodec = findTextCodec(); if (m_textCodec) @@ -2056,6 +2056,6 @@ void *qt_add_qmlxmlhttprequest(ExecutionEngine *v4) QT_END_NAMESPACE -#endif // QT_NO_XMLSTREAMREADER && qml_network +#endif // xmlstreamreader && qml_network #include diff --git a/src/qml/qml/qqmlxmlhttprequest_p.h b/src/qml/qml/qqmlxmlhttprequest_p.h index fdb6194537..f2836d8301 100644 --- a/src/qml/qml/qqmlxmlhttprequest_p.h +++ b/src/qml/qml/qqmlxmlhttprequest_p.h @@ -55,7 +55,7 @@ #include #include -#if !defined(QT_NO_XMLSTREAMREADER) && QT_CONFIG(qml_network) +#if QT_CONFIG(xmlstreamreader) && QT_CONFIG(qml_network) QT_BEGIN_NAMESPACE @@ -64,7 +64,7 @@ void qt_rem_qmlxmlhttprequest(QV4::ExecutionEngine *engine, void *); QT_END_NAMESPACE -#endif // QT_NO_XMLSTREAMREADER && qml_network +#endif // xmlstreamreader && qml_network #endif // QQMLXMLHTTPREQUEST_P_H diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index c8a0463a2d..7bab2415c5 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -148,9 +148,7 @@ void Heap::QtObject::init(QQmlEngine *qmlEngine) o->defineAccessorProperty(QStringLiteral("platform"), QV4::QtObject::method_get_platform, 0); o->defineAccessorProperty(QStringLiteral("application"), QV4::QtObject::method_get_application, 0); -#ifndef QT_NO_IM o->defineAccessorProperty(QStringLiteral("inputMethod"), QV4::QtObject::method_get_inputMethod, 0); -#endif o->defineAccessorProperty(QStringLiteral("styleHints"), QV4::QtObject::method_get_styleHints, 0); o->defineDefaultProperty(QStringLiteral("callLater"), QV4::QtObject::method_callLater); @@ -1423,13 +1421,11 @@ ReturnedValue QtObject::method_get_application(CallContext *ctx) return QV4::QObjectWrapper::wrap(ctx->d()->engine, qt->d()->application); } -#ifndef QT_NO_IM ReturnedValue QtObject::method_get_inputMethod(CallContext *ctx) { QObject *o = QQml_guiProvider()->inputMethod(); return QV4::QObjectWrapper::wrap(ctx->d()->engine, o); } -#endif ReturnedValue QtObject::method_get_styleHints(CallContext *ctx) { @@ -1740,7 +1736,7 @@ void QV4::GlobalExtensions::init(Object *globalObject, QJSEngine::Extensions ext Scope scope(v4); if (extensions.testFlag(QJSEngine::TranslationExtension)) { - #ifndef QT_NO_TRANSLATION + #if QT_CONFIG(translation) globalObject->defineDefaultProperty(QStringLiteral("qsTranslate"), QV4::GlobalExtensions::method_qsTranslate); globalObject->defineDefaultProperty(QStringLiteral("QT_TRANSLATE_NOOP"), QV4::GlobalExtensions::method_qsTranslateNoOp); globalObject->defineDefaultProperty(QStringLiteral("qsTr"), QV4::GlobalExtensions::method_qsTr); @@ -1767,7 +1763,7 @@ void QV4::GlobalExtensions::init(Object *globalObject, QJSEngine::Extensions ext } -#ifndef QT_NO_TRANSLATION +#if QT_CONFIG(translation) /*! \qmlmethod string Qt::qsTranslate(string context, string sourceText, string disambiguation, int n) @@ -2015,7 +2011,7 @@ ReturnedValue GlobalExtensions::method_qsTrIdNoOp(CallContext *ctx) return QV4::Encode::undefined(); return ctx->args()[0].asReturnedValue(); } -#endif // QT_NO_TRANSLATION +#endif // translation QV4::ReturnedValue GlobalExtensions::method_gc(CallContext *ctx) diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h index f428e377d7..f84c819e6a 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h +++ b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h @@ -135,9 +135,7 @@ struct QtObject : Object static ReturnedValue method_get_platform(CallContext *ctx); static ReturnedValue method_get_application(CallContext *ctx); -#ifndef QT_NO_IM static ReturnedValue method_get_inputMethod(CallContext *ctx); -#endif static ReturnedValue method_get_styleHints(CallContext *ctx); static ReturnedValue method_callLater(CallContext *ctx); @@ -169,7 +167,7 @@ struct ConsoleObject : Object struct Q_QML_PRIVATE_EXPORT GlobalExtensions { static void init(Object *globalObject, QJSEngine::Extensions extensions); -#ifndef QT_NO_TRANSLATION +#if QT_CONFIG(translation) static ReturnedValue method_qsTranslate(CallContext *ctx); static ReturnedValue method_qsTranslateNoOp(CallContext *ctx); static ReturnedValue method_qsTr(CallContext *ctx); diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index b0599dd0a2..1df468dd49 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -160,7 +160,7 @@ QV8Engine::~QV8Engine() qDeleteAll(m_extensionData); m_extensionData.clear(); -#if !defined(QT_NO_XMLSTREAMREADER) && QT_CONFIG(qml_network) +#if QT_CONFIG(xmlstreamreader) && QT_CONFIG(qml_network) qt_rem_qmlxmlhttprequest(m_v4Engine, m_xmlHttpRequestData); m_xmlHttpRequestData = 0; #endif @@ -195,7 +195,7 @@ void QV8Engine::initializeGlobal() QQmlDateExtension::registerExtension(m_v4Engine); QQmlNumberExtension::registerExtension(m_v4Engine); -#if !defined(QT_NO_XMLSTREAMREADER) && QT_CONFIG(qml_network) +#if QT_CONFIG(xmlstreamreader) && QT_CONFIG(qml_network) qt_add_domexceptions(m_v4Engine); m_xmlHttpRequestData = qt_add_qmlxmlhttprequest(m_v4Engine); #endif diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index 0e348eee11..70733da121 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -266,7 +266,7 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD QuickTestResult::parseArgs(testArgC, testArgV.data()); -#ifndef QT_NO_TRANSLATION +#if QT_CONFIG(translation) QTranslator translator; if (!translationFile.isEmpty()) { if (translator.load(translationFile)) { diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp index 32cc5eefd7..3d6365503d 100644 --- a/src/qmltest/quicktestevent.cpp +++ b/src/qmltest/quicktestevent.cpp @@ -197,7 +197,7 @@ namespace QtQuickTest } } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) static void mouseWheel(QWindow* window, QObject* item, Qt::MouseButtons buttons, Qt::KeyboardModifiers stateKey, QPointF _pos, int xDelta, int yDelta, int delay = -1) @@ -241,7 +241,7 @@ bool QuickTestEvent::mousePress return true; } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) bool QuickTestEvent::mouseWheel( QObject *item, qreal x, qreal y, int buttons, int modifiers, int xDelta, int yDelta, int delay) diff --git a/src/qmltest/quicktestevent_p.h b/src/qmltest/quicktestevent_p.h index 1adf8f3317..1f6de7ed28 100644 --- a/src/qmltest/quicktestevent_p.h +++ b/src/qmltest/quicktestevent_p.h @@ -86,7 +86,7 @@ public Q_SLOTS: int modifiers, int delay); bool mouseMove(QObject *item, qreal x, qreal y, int delay, int buttons); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) bool mouseWheel(QObject *item, qreal x, qreal y, int buttons, int modifiers, int xDelta, int yDelta, int delay); #endif diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp index 1626aaac2d..897e1143d5 100644 --- a/src/quick/accessible/qaccessiblequickitem.cpp +++ b/src/quick/accessible/qaccessiblequickitem.cpp @@ -47,7 +47,7 @@ #include "QtQuick/qquicktextdocument.h" QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QAccessibleQuickItem::QAccessibleQuickItem(QQuickItem *item) : QAccessibleObject(item), m_doc(textDocument()) @@ -591,6 +591,6 @@ void QAccessibleQuickItem::setSelection(int /* selectionIndex */, int /* startOf } -#endif // QT_NO_ACCESSIBILITY +#endif // accessibility QT_END_NAMESPACE diff --git a/src/quick/accessible/qaccessiblequickitem_p.h b/src/quick/accessible/qaccessiblequickitem_p.h index 7445fd1400..577a105627 100644 --- a/src/quick/accessible/qaccessiblequickitem_p.h +++ b/src/quick/accessible/qaccessiblequickitem_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) class QTextDocument; @@ -141,7 +141,7 @@ private: QRect itemScreenRect(QQuickItem *item); QList accessibleUnignoredChildren(QQuickItem *item, bool paintOrder = false); -#endif // QT_NO_ACCESSIBILITY +#endif // accessibility QT_END_NAMESPACE diff --git a/src/quick/accessible/qaccessiblequickview.cpp b/src/quick/accessible/qaccessiblequickview.cpp index edd39ed9db..222690e4f2 100644 --- a/src/quick/accessible/qaccessiblequickview.cpp +++ b/src/quick/accessible/qaccessiblequickview.cpp @@ -46,7 +46,7 @@ #include "qaccessiblequickitem_p.h" -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QT_BEGIN_NAMESPACE @@ -145,4 +145,4 @@ int QAccessibleQuickWindow::indexOfChild(const QAccessibleInterface *iface) cons QT_END_NAMESPACE -#endif // QT_NO_ACCESSIBILITY +#endif // accessibility diff --git a/src/quick/accessible/qaccessiblequickview_p.h b/src/quick/accessible/qaccessiblequickview_p.h index 457e8b456b..007a6fd990 100644 --- a/src/quick/accessible/qaccessiblequickview_p.h +++ b/src/quick/accessible/qaccessiblequickview_p.h @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) class QAccessibleQuickWindow : public QAccessibleObject { @@ -80,7 +80,7 @@ private: QList rootItems() const; }; -#endif // QT_NO_ACCESSIBILITY +#endif // accessibility QT_END_NAMESPACE diff --git a/src/quick/accessible/qquickaccessiblefactory.cpp b/src/quick/accessible/qquickaccessiblefactory.cpp index 69a74f2b3d..a1fa695e5a 100644 --- a/src/quick/accessible/qquickaccessiblefactory.cpp +++ b/src/quick/accessible/qquickaccessiblefactory.cpp @@ -44,7 +44,7 @@ #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QAccessibleInterface *qQuickAccessibleFactory(const QString &classname, QObject *object) { diff --git a/src/quick/accessible/qquickaccessiblefactory_p.h b/src/quick/accessible/qquickaccessiblefactory_p.h index 6407b70223..ab8eb12ca4 100644 --- a/src/quick/accessible/qquickaccessiblefactory_p.h +++ b/src/quick/accessible/qquickaccessiblefactory_p.h @@ -54,7 +54,7 @@ #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QAccessibleInterface *qQuickAccessibleFactory(const QString &classname, QObject *object); diff --git a/src/quick/designer/qquickdesignersupport.cpp b/src/quick/designer/qquickdesignersupport.cpp index 3ff5a3ce96..749ece8221 100644 --- a/src/quick/designer/qquickdesignersupport.cpp +++ b/src/quick/designer/qquickdesignersupport.cpp @@ -95,7 +95,7 @@ void QQuickDesignerSupport::refFromEffectItem(QQuickItem *referencedItem, bool h texture->setRect(referencedItem->boundingRect()); texture->setSize(referencedItem->boundingRect().size().toSize()); texture->setRecursive(true); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) #ifndef QT_OPENGL_ES if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) texture->setFormat(GL_RGBA8); diff --git a/src/quick/designer/qquickdesignerwindowmanager.cpp b/src/quick/designer/qquickdesignerwindowmanager.cpp index 2d37db08e7..e2d7b98c33 100644 --- a/src/quick/designer/qquickdesignerwindowmanager.cpp +++ b/src/quick/designer/qquickdesignerwindowmanager.cpp @@ -39,7 +39,7 @@ #include "qquickdesignerwindowmanager_p.h" #include "private/qquickwindow_p.h" -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include #endif #include @@ -67,7 +67,7 @@ void QQuickDesignerWindowManager::windowDestroyed(QQuickWindow *) void QQuickDesignerWindowManager::makeOpenGLContext(QQuickWindow *window) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (!m_openGlContext) { m_openGlContext.reset(new QOpenGLContext()); m_openGlContext->setFormat(window->requestedFormat()); diff --git a/src/quick/designer/qquickdesignerwindowmanager_p.h b/src/quick/designer/qquickdesignerwindowmanager_p.h index a50f8aa49f..09e15dad73 100644 --- a/src/quick/designer/qquickdesignerwindowmanager_p.h +++ b/src/quick/designer/qquickdesignerwindowmanager_p.h @@ -57,7 +57,7 @@ #include #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include #endif @@ -97,7 +97,7 @@ public: static void createOpenGLContext(QQuickWindow *window); private: -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QScopedPointer m_openGlContext; #endif QScopedPointer m_sgContext; diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index 3b2b125c63..212148b754 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -802,7 +802,7 @@ QSGTextureProvider *QQuickCanvasItem::textureProvider() const return QQuickItem::textureProvider(); Q_D(const QQuickCanvasItem); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QQuickWindow *w = window(); if (!w || !w->isSceneGraphInitialized() || QThread::currentThread() != QQuickWindowPrivate::get(w)->context->thread()) { diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 2483a8eadb..bcaedd67b4 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -75,7 +75,7 @@ #include #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include #endif @@ -3997,7 +3997,7 @@ public: ~QQuickContext2DThreadCleanup() { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) context->makeCurrent(surface); delete texture; context->doneCurrent(); @@ -4038,7 +4038,7 @@ QQuickContext2D::~QQuickContext2D() delete m_buffer; if (m_renderTarget == QQuickCanvasItem::FramebufferObject) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_renderStrategy == QQuickCanvasItem::Immediate && m_glContext) { Q_ASSERT(QThread::currentThread() == m_glContext->thread()); m_glContext->makeCurrent(m_surface.data()); @@ -4115,7 +4115,7 @@ void QQuickContext2D::init(QQuickCanvasItem *canvasItem, const QVariantMap &args m_texture = new QQuickContext2DImageTexture; break; case QQuickCanvasItem::FramebufferObject: -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) m_texture = new QQuickContext2DFBOTexture; #else // It shouldn't be possible to use a FramebufferObject without OpenGL @@ -4134,7 +4134,7 @@ void QQuickContext2D::init(QQuickCanvasItem *canvasItem, const QVariantMap &args m_thread = QThread::currentThread(); QThread *renderThread = m_thread; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QQuickWindow *window = canvasItem->window(); QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window); QThread *sceneGraphThread = wd->context->thread(); @@ -4151,7 +4151,7 @@ void QQuickContext2D::init(QQuickCanvasItem *canvasItem, const QVariantMap &args if (renderThread && renderThread != QThread::currentThread()) m_texture->moveToThread(renderThread); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_renderTarget == QQuickCanvasItem::FramebufferObject && renderThread != sceneGraphThread) { auto openglRenderContext = static_cast(QQuickWindowPrivate::get(window)->context); QOpenGLContext *cc = openglRenderContext->openglContext(); @@ -4212,7 +4212,7 @@ QImage QQuickContext2D::toImage(const QRectF& bounds) flush(); m_texture->grabImage(bounds); } else { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QQuickWindow *window = m_canvas->window(); QOpenGLContext *ctx = window ? window->openglContext() : 0; if (ctx && ctx->isValid()) { diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp index 8d659040b3..b985cb0ccc 100644 --- a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp +++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp @@ -43,7 +43,7 @@ #include #include #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include # include #endif diff --git a/src/quick/items/context2d/qquickcontext2dtexture.cpp b/src/quick/items/context2d/qquickcontext2dtexture.cpp index 4435c0c37b..38b5f054bf 100644 --- a/src/quick/items/context2d/qquickcontext2dtexture.cpp +++ b/src/quick/items/context2d/qquickcontext2dtexture.cpp @@ -44,7 +44,7 @@ #include #include "qquickcontext2dcommandbuffer_p.h" #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) #include #include #include @@ -53,7 +53,7 @@ #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) #define QT_MINIMUM_FBO_SIZE 64 static inline int qt_next_power_of_two(int v) @@ -90,7 +90,7 @@ struct GLAcquireContext { #endif QQuickContext2DTexture::QQuickContext2DTexture() : m_context(0) -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) , m_gl(0) #endif , m_surface(0) @@ -254,7 +254,7 @@ void QQuickContext2DTexture::paint(QQuickContext2DCommandBuffer *ccb) return; } QQuickContext2D::mutex.unlock(); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) GLAcquireContext currentContext(m_gl, m_surface); #endif if (!m_tiledCanvas) { @@ -383,7 +383,7 @@ bool QQuickContext2DTexture::event(QEvent *e) } return QObject::event(e); } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) static inline QSize npotAdjustedSize(const QSize &size) { static bool checked = false; diff --git a/src/quick/items/context2d/qquickcontext2dtexture_p.h b/src/quick/items/context2d/qquickcontext2dtexture_p.h index 6a5d4e8b09..04d7b40ab7 100644 --- a/src/quick/items/context2d/qquickcontext2dtexture_p.h +++ b/src/quick/items/context2d/qquickcontext2dtexture_p.h @@ -58,7 +58,7 @@ QT_REQUIRE_CONFIG(quick_canvas); #include #include "qquickcanvasitem_p.h" #include "qquickcontext2d_p.h" -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include # include #endif @@ -125,7 +125,7 @@ public: // Called during sync() on the scene graph thread while GUI is blocked. virtual QSGTexture *textureForNextFrame(QSGTexture *lastFrame, QQuickWindow *window) = 0; bool event(QEvent *e); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) void initializeOpenGL(QOpenGLContext *gl, QOffscreenSurface *s) { m_gl = gl; m_surface = s; @@ -157,7 +157,7 @@ protected: QList m_tiles; QQuickContext2D *m_context; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QOpenGLContext *m_gl; #endif QSurface *m_surface; @@ -180,7 +180,7 @@ protected: uint m_painting : 1; uint m_onCustomThread : 1; // Not GUI and not SGRender }; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) class QQuickContext2DFBOTexture : public QQuickContext2DTexture { Q_OBJECT diff --git a/src/quick/items/context2d/qquickcontext2dtile.cpp b/src/quick/items/context2d/qquickcontext2dtile.cpp index 95b6c9d961..d31fee7f91 100644 --- a/src/quick/items/context2d/qquickcontext2dtile.cpp +++ b/src/quick/items/context2d/qquickcontext2dtile.cpp @@ -38,7 +38,7 @@ ****************************************************************************/ #include "qquickcontext2dtile_p.h" -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include # include # include @@ -97,7 +97,7 @@ QPainter* QQuickContext2DTile::createPainter(bool smooth, bool antialiasing) return 0; } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QQuickContext2DFBOTile::QQuickContext2DFBOTile() : QQuickContext2DTile() , m_fbo(0) diff --git a/src/quick/items/context2d/qquickcontext2dtile_p.h b/src/quick/items/context2d/qquickcontext2dtile_p.h index 2f3fdeb54f..e7eed7b086 100644 --- a/src/quick/items/context2d/qquickcontext2dtile_p.h +++ b/src/quick/items/context2d/qquickcontext2dtile_p.h @@ -56,7 +56,7 @@ QT_REQUIRE_CONFIG(quick_canvas); #include "qquickcontext2d_p.h" -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include #endif QT_BEGIN_NAMESPACE @@ -87,7 +87,7 @@ protected: QPainter m_painter; }; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) class QQuickContext2DFBOTile : public QQuickContext2DTile { public: diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp index 41c036c7a8..4e918802d1 100644 --- a/src/quick/items/qquickaccessibleattached.cpp +++ b/src/quick/items/qquickaccessibleattached.cpp @@ -39,7 +39,7 @@ #include "qquickaccessibleattached_p.h" -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) #include "private/qquickitem_p.h" diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h index 2c209ae664..c8538745cc 100644 --- a/src/quick/items/qquickaccessibleattached_p.h +++ b/src/quick/items/qquickaccessibleattached_p.h @@ -56,7 +56,7 @@ #include #include -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) #include #include @@ -265,6 +265,6 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickAccessibleAttached) QML_DECLARE_TYPEINFO(QQuickAccessibleAttached, QML_HAS_ATTACHED_PROPERTIES) -#endif // QT_NO_ACCESSIBILITY +#endif // accessibility #endif diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index cbb052856e..7a112e840a 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -55,7 +55,7 @@ #include #include -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE @@ -995,4 +995,4 @@ QQuickDragAttached *QQuickDrag::qmlAttachedProperties(QObject *obj) QT_END_NAMESPACE -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop diff --git a/src/quick/items/qquickdrag_p.h b/src/quick/items/qquickdrag_p.h index 17721251d9..cc6318a4a3 100644 --- a/src/quick/items/qquickdrag_p.h +++ b/src/quick/items/qquickdrag_p.h @@ -60,7 +60,7 @@ #include #include -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE @@ -318,6 +318,6 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickDrag) QML_DECLARE_TYPEINFO(QQuickDrag, QML_HAS_ATTACHED_PROPERTIES) -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop #endif diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp index 8dcc13971e..84c44c6541 100644 --- a/src/quick/items/qquickdroparea.cpp +++ b/src/quick/items/qquickdroparea.cpp @@ -43,7 +43,7 @@ #include -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE @@ -618,4 +618,4 @@ void QQuickDropEvent::accept(QQmlV4Function *args) QT_END_NAMESPACE -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop diff --git a/src/quick/items/qquickdroparea_p.h b/src/quick/items/qquickdroparea_p.h index d3b37979da..ccde2bcd19 100644 --- a/src/quick/items/qquickdroparea_p.h +++ b/src/quick/items/qquickdroparea_p.h @@ -55,7 +55,7 @@ #include -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QT_BEGIN_NAMESPACE @@ -190,6 +190,6 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickDropEvent) QML_DECLARE_TYPE(QQuickDropArea) -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop #endif // QQUICKDROPAREA_P_H diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 12b01b8aaf..1e778306e0 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1404,7 +1404,7 @@ void QQuickFlickable::mouseReleaseEvent(QMouseEvent *event) } } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QQuickFlickable::wheelEvent(QWheelEvent *event) { Q_D(QQuickFlickable); diff --git a/src/quick/items/qquickflickable_p.h b/src/quick/items/qquickflickable_p.h index 610bfd1427..62733bda1c 100644 --- a/src/quick/items/qquickflickable_p.h +++ b/src/quick/items/qquickflickable_p.h @@ -249,7 +249,7 @@ protected: void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; #endif void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE; diff --git a/src/quick/items/qquickgraphicsinfo.cpp b/src/quick/items/qquickgraphicsinfo.cpp index 761d0c3cad..f735f17a4d 100644 --- a/src/quick/items/qquickgraphicsinfo.cpp +++ b/src/quick/items/qquickgraphicsinfo.cpp @@ -257,7 +257,7 @@ void QQuickGraphicsInfo::updateInfo() } QSurfaceFormat format = QSurfaceFormat::defaultFormat(); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_window && m_window->isSceneGraphInitialized()) { QOpenGLContext *context = m_window->openglContext(); if (context) diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 13b75c0482..cbfd776941 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -73,7 +73,7 @@ #include #include -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) # include #endif @@ -317,7 +317,7 @@ void QQuickItemKeyFilter::keyReleased(QKeyEvent *event, bool post) if (m_next) m_next->keyReleased(event, post); } -#ifndef QT_NO_IM +#if QT_CONFIG(im) void QQuickItemKeyFilter::inputMethodEvent(QInputMethodEvent *event, bool post) { if (m_next) @@ -331,7 +331,7 @@ QVariant QQuickItemKeyFilter::inputMethodQuery(Qt::InputMethodQuery query) const if (m_next) return m_next->inputMethodQuery(query); return QVariant(); } -#endif // QT_NO_IM +#endif // im void QQuickItemKeyFilter::componentComplete() { @@ -1298,7 +1298,7 @@ void QQuickKeysAttached::setPriority(Priority order) void QQuickKeysAttached::componentComplete() { -#ifndef QT_NO_IM +#if QT_CONFIG(im) Q_D(QQuickKeysAttached); if (d->item) { for (QQuickItem *targetItem : qAsConst(d->targets)) { @@ -1387,7 +1387,7 @@ void QQuickKeysAttached::keyReleased(QKeyEvent *event, bool post) if (!event->isAccepted()) QQuickItemKeyFilter::keyReleased(event, post); } -#ifndef QT_NO_IM +#if QT_CONFIG(im) void QQuickKeysAttached::inputMethodEvent(QInputMethodEvent *event, bool post) { Q_D(QQuickKeysAttached); @@ -1424,7 +1424,7 @@ QVariant QQuickKeysAttached::inputMethodQuery(Qt::InputMethodQuery query) const } return QQuickItemKeyFilter::inputMethodQuery(query); } -#endif // QT_NO_IM +#endif // im QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj) { @@ -1675,7 +1675,7 @@ void QQuickEnterKeyAttached::setType(Qt::EnterKeyType type) { if (keyType != type) { keyType = type; -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (itemPrivate && itemPrivate->activeFocus) QGuiApplication::inputMethod()->update(Qt::ImEnterKeyType); #endif @@ -2366,7 +2366,7 @@ bool QQuickItemPrivate::canAcceptTabFocus(QQuickItem *item) if (item == item->window()->contentItem()) return true; -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) if (QObject *acc = qmlAttachedPropertiesObject(item, false)) { int role = acc->property("role").toInt(); if (role == QAccessible::EditableText @@ -2855,7 +2855,7 @@ void QQuickItemPrivate::addChild(QQuickItem *child) childItems.append(child); -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child); // if the added child has a cursor and we do not currently have any children @@ -2883,7 +2883,7 @@ void QQuickItemPrivate::removeChild(QQuickItem *child) childItems.removeOne(child); Q_ASSERT(!childItems.contains(child)); -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child); // turn it off, if nothing else is using it @@ -2958,7 +2958,7 @@ void QQuickItemPrivate::derefWindow() if (polishScheduled) c->itemsToPolish.removeOne(q); c->removeGrabber(q); -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) if (c->cursorItem == q) { c->cursorItem = 0; window->unsetCursor(); @@ -3842,7 +3842,7 @@ void QQuickItem::keyReleaseEvent(QKeyEvent *event) event->ignore(); } -#ifndef QT_NO_IM +#if QT_CONFIG(im) /*! This event handler can be reimplemented in a subclass to receive input method events for an item. The event information is provided by the @@ -3852,7 +3852,7 @@ void QQuickItem::inputMethodEvent(QInputMethodEvent *event) { event->ignore(); } -#endif // QT_NO_IM +#endif // im /*! This event handler can be reimplemented in a subclass to receive focus-in @@ -3861,7 +3861,7 @@ void QQuickItem::inputMethodEvent(QInputMethodEvent *event) */ void QQuickItem::focusInEvent(QFocusEvent * /*event*/) { -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) if (QAccessible::isActive()) { if (QObject *acc = QQuickAccessibleAttached::findAccessible(this)) { QAccessibleEvent ev(acc, QAccessible::Focus); @@ -3939,7 +3939,7 @@ void QQuickItem::touchUngrabEvent() // XXX todo } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) /*! This event handler can be reimplemented in a subclass to receive wheel events for an item. The event information is provided by the @@ -3997,7 +3997,7 @@ void QQuickItem::hoverLeaveEvent(QHoverEvent *event) Q_UNUSED(event); } -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) /*! This event handler can be reimplemented in a subclass to receive drag-enter events for an item. The event information is provided by the @@ -4057,7 +4057,7 @@ void QQuickItem::dropEvent(QDropEvent *event) { Q_UNUSED(event); } -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop /*! Reimplement this method to filter the mouse events that are received by @@ -4088,7 +4088,7 @@ void QQuickItem::windowDeactivateEvent() } } -#ifndef QT_NO_IM +#if QT_CONFIG(im) /*! This method is only relevant for input items. @@ -4146,7 +4146,7 @@ QVariant QQuickItem::inputMethodQuery(Qt::InputMethodQuery query) const return v; } -#endif // QT_NO_IM +#endif // im QQuickAnchorLine QQuickItemPrivate::left() const { @@ -4991,7 +4991,7 @@ void QQuickItemPrivate::deliverKeyEvent(QKeyEvent *e) } } -#ifndef QT_NO_IM +#if QT_CONFIG(im) void QQuickItemPrivate::deliverInputMethodEvent(QInputMethodEvent *e) { Q_Q(QQuickItem); @@ -5017,7 +5017,7 @@ void QQuickItemPrivate::deliverInputMethodEvent(QInputMethodEvent *e) extra->keyHandler->inputMethodEvent(e, true); } } -#endif // QT_NO_IM +#endif // im /*! Called when \a change occurs for this item. @@ -5038,7 +5038,7 @@ void QQuickItem::itemChange(ItemChange change, const ItemChangeData &value) emit windowChanged(value.window); } -#ifndef QT_NO_IM +#if QT_CONFIG(im) /*! Notify input method on updated query values if needed. \a queries indicates the changed attributes. @@ -5048,7 +5048,7 @@ void QQuickItem::updateInputMethod(Qt::InputMethodQueries queries) if (hasActiveFocus()) QGuiApplication::inputMethod()->update(queries); } -#endif // QT_NO_IM +#endif // im /*! \internal */ // XXX todo - do we want/need this anymore? @@ -5790,7 +5790,7 @@ bool QQuickItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible) } itemChange(QQuickItem::ItemVisibleHasChanged, effectiveVisible); -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) if (isAccessible) { QAccessibleEvent ev(q, effectiveVisible ? QAccessible::ObjectShow : QAccessible::ObjectHide); QAccessible::updateAccessibility(&ev); @@ -7074,7 +7074,7 @@ void QQuickItem::setAcceptHoverEvents(bool enabled) void QQuickItemPrivate::setHasCursorInChild(bool hasCursor) { -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) Q_Q(QQuickItem); // if we're asked to turn it off (because of an unsetcursor call, or a node @@ -7123,7 +7123,7 @@ void QQuickItemPrivate::setHasHoverInChild(bool hasHover) } } -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) /*! Returns the cursor shape for this item. @@ -7609,7 +7609,7 @@ bool QQuickItem::event(QEvent *ev) updatePolish(); break; #endif -#ifndef QT_NO_IM +#if QT_CONFIG(im) case QEvent::InputMethodQuery: { QInputMethodQueryEvent *query = static_cast(ev); Qt::InputMethodQueries queries = query->queries(); @@ -7626,7 +7626,7 @@ bool QQuickItem::event(QEvent *ev) case QEvent::InputMethod: inputMethodEvent(static_cast(ev)); break; -#endif // QT_NO_IM +#endif // im case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: @@ -7670,12 +7670,12 @@ bool QQuickItem::event(QEvent *ev) case QEvent::MouseButtonDblClick: mouseDoubleClickEvent(static_cast(ev)); break; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) case QEvent::Wheel: wheelEvent(static_cast(ev)); break; #endif -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) case QEvent::DragEnter: dragEnterEvent(static_cast(ev)); break; @@ -7688,12 +7688,12 @@ bool QQuickItem::event(QEvent *ev) case QEvent::Drop: dropEvent(static_cast(ev)); break; -#endif // QT_NO_DRAGANDDROP -#ifndef QT_NO_GESTURES +#endif // draganddrop +#if QT_CONFIG(gestures) case QEvent::NativeGesture: ev->ignore(); break; -#endif // QT_NO_GESTURES +#endif // gestures default: return QObject::event(ev); } @@ -8291,7 +8291,7 @@ QQuickItemPrivate::ExtraData::ExtraData() } -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QAccessible::Role QQuickItemPrivate::accessibleRole() const { Q_Q(const QQuickItem); diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index b1b1d627b1..c9494d91bd 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -153,7 +153,7 @@ class Q_QUICK_EXPORT QQuickItem : public QObject, public QQmlParserStatus public: enum Flag { ItemClipsChildrenToShape = 0x01, -#ifndef QT_NO_IM +#if QT_CONFIG(im) ItemAcceptsInputMethod = 0x02, #endif ItemIsFocusScope = 0x04, @@ -292,7 +292,7 @@ public: bool acceptHoverEvents() const; void setAcceptHoverEvents(bool enabled); -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) QCursor cursor() const; void setCursor(const QCursor &cursor); void unsetCursor(); @@ -340,7 +340,7 @@ public: Q_REVISION(1) Q_INVOKABLE QQuickItem *nextItemInFocusChain(bool forward = true); Q_INVOKABLE QQuickItem *childAt(qreal x, qreal y) const; -#ifndef QT_NO_IM +#if QT_CONFIG(im) virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; #endif @@ -393,7 +393,7 @@ protected: bool isComponentComplete() const; virtual void itemChange(ItemChange, const ItemChangeData &); -#ifndef QT_NO_IM +#if QT_CONFIG(im) void updateInputMethod(Qt::InputMethodQueries queries = Qt::ImQueryInput); #endif @@ -406,7 +406,7 @@ protected: virtual void keyPressEvent(QKeyEvent *event); virtual void keyReleaseEvent(QKeyEvent *event); -#ifndef QT_NO_IM +#if QT_CONFIG(im) virtual void inputMethodEvent(QInputMethodEvent *); #endif virtual void focusInEvent(QFocusEvent *); @@ -417,14 +417,14 @@ protected: virtual void mouseDoubleClickEvent(QMouseEvent *event); virtual void mouseUngrabEvent(); // XXX todo - params? virtual void touchUngrabEvent(); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) virtual void wheelEvent(QWheelEvent *event); #endif virtual void touchEvent(QTouchEvent *event); virtual void hoverEnterEvent(QHoverEvent *event); virtual void hoverMoveEvent(QHoverEvent *event); virtual void hoverLeaveEvent(QHoverEvent *event); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) virtual void dragEnterEvent(QDragEnterEvent *); virtual void dragMoveEvent(QDragMoveEvent *); virtual void dragLeaveEvent(QDragLeaveEvent *); diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index 4bff293657..45674a106d 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -347,7 +347,7 @@ public: #if QT_CONFIG(quick_shadereffect) mutable QQuickItemLayer *layer; #endif -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) QCursor cursor; #endif QPointF userTransformOriginPoint; @@ -534,7 +534,7 @@ public: virtual void implicitWidthChanged(); virtual void implicitHeightChanged(); -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) virtual QAccessible::Role accessibleRole() const; #endif @@ -556,7 +556,7 @@ public: virtual void transformChanged(); void deliverKeyEvent(QKeyEvent *); -#ifndef QT_NO_IM +#if QT_CONFIG(im) void deliverInputMethodEvent(QInputMethodEvent *); #endif @@ -618,7 +618,7 @@ public: virtual void keyPressed(QKeyEvent *event, bool post); virtual void keyReleased(QKeyEvent *event, bool post); -#ifndef QT_NO_IM +#if QT_CONFIG(im) virtual void inputMethodEvent(QInputMethodEvent *event, bool post); virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; #endif @@ -857,7 +857,7 @@ Q_SIGNALS: private: void keyPressed(QKeyEvent *event, bool post) Q_DECL_OVERRIDE; void keyReleased(QKeyEvent *event, bool post) Q_DECL_OVERRIDE; -#ifndef QT_NO_IM +#if QT_CONFIG(im) void inputMethodEvent(QInputMethodEvent *, bool post) Q_DECL_OVERRIDE; QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE; #endif diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index 0705d9b504..8dd4a96b62 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -96,7 +96,7 @@ #include "qquickspritesequence_p.h" #include "qquickanimatedsprite_p.h" #endif -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include "qquickopenglinfo_p.h" #endif #include "qquickgraphicsinfo_p.h" @@ -278,7 +278,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType("QtQuick",2,0,"PathInterpolator"); #endif -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) qmlRegisterType("QtQuick", 2, 0, "DropArea"); qmlRegisterType(); qmlRegisterType(); @@ -289,7 +289,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType("QtQuick", 2, 0, "TouchPoint"); qmlRegisterType(); -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) qmlRegisterUncreatableType("QtQuick", 2, 0, "Accessible",QQuickAccessibleAttached::tr("Accessible is only available via attached properties")); #endif @@ -325,7 +325,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(uri, 2, 4, "ShaderEffect"); #endif -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) qmlRegisterUncreatableType(uri, 2, 4,"OpenGLInfo", QQuickOpenGLInfo::tr("OpenGLInfo is only available via attached properties")); #endif qmlRegisterType(uri, 2, 5,"PinchArea"); diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index 6bd83dd808..5e30bf9e0a 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -61,10 +61,10 @@ QQuickMouseAreaPrivate::QQuickMouseAreaPrivate() : enabled(true), scrollGestureEnabled(true), hovered(false), longPress(false), moved(false), stealMouse(false), doubleClick(false), preventStealing(false), propagateComposedEvents(false), overThreshold(false), pressed(0) -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) , drag(0) #endif -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) , cursor(0) #endif { @@ -72,10 +72,10 @@ QQuickMouseAreaPrivate::QQuickMouseAreaPrivate() QQuickMouseAreaPrivate::~QQuickMouseAreaPrivate() { -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) delete drag; #endif -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) delete cursor; #endif } @@ -435,7 +435,7 @@ QQuickMouseArea::QQuickMouseArea(QQuickItem *parent) { Q_D(QQuickMouseArea); d->init(); -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) // Explcitly call setCursor on QQuickItem since // it internally keeps a boolean hasCursor that doesn't // get set to true unless you call setCursor @@ -679,7 +679,7 @@ void QQuickMouseArea::mousePressEvent(QMouseEvent *event) } else { d->longPress = false; d->saveEvent(event); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) if (d->drag) d->drag->setActive(false); #endif @@ -705,7 +705,7 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event) // ### can GV handle this for us? setHovered(contains(d->lastPos)); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) if (d->drag && d->drag->target()) { if (!d->moved) { d->targetStartPos = d->drag->target()->parentItem() @@ -788,7 +788,7 @@ void QQuickMouseArea::mouseReleaseEvent(QMouseEvent *event) setPressed(event->button(), false, event->source()); if (!d->pressed) { // no other buttons are pressed -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) if (d->drag) d->drag->setActive(false); #endif @@ -866,7 +866,7 @@ void QQuickMouseArea::hoverLeaveEvent(QHoverEvent *event) setHovered(false); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void QQuickMouseArea::wheelEvent(QWheelEvent *event) { Q_D(QQuickMouseArea); @@ -897,7 +897,7 @@ void QQuickMouseArea::ungrabMouse() d->overThreshold = false; setKeepMouseGrab(false); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) if (d->drag) d->drag->setActive(false); #endif @@ -980,7 +980,7 @@ bool QQuickMouseArea::childMouseEventFilter(QQuickItem *i, QEvent *e) Q_D(QQuickMouseArea); if (!d->pressed && (!d->enabled || !isVisible() -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) || !d->drag || !d->drag->filterChildren() #endif ) @@ -1003,7 +1003,7 @@ void QQuickMouseArea::timerEvent(QTimerEvent *event) Q_D(QQuickMouseArea); if (event->timerId() == d->pressAndHoldTimer.timerId()) { d->pressAndHoldTimer.stop(); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) bool dragged = d->drag && d->drag->active(); #else bool dragged = false; @@ -1179,7 +1179,7 @@ bool QQuickMouseArea::setPressed(Qt::MouseButton button, bool p, Qt::MouseEventS { Q_D(QQuickMouseArea); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) bool dragged = d->drag && d->drag->active(); #else bool dragged = false; @@ -1276,7 +1276,7 @@ bool QQuickMouseArea::setPressed(Qt::MouseButton button, bool p, Qt::MouseEventS \sa Qt::CursorShape */ -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) Qt::CursorShape QQuickMouseArea::cursorShape() const { return cursor().shape(); @@ -1343,7 +1343,7 @@ void QQuickMouseArea::setCursorShape(Qt::CursorShape shape) */ -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QQuickDrag *QQuickMouseArea::drag() { Q_D(QQuickMouseArea); diff --git a/src/quick/items/qquickmousearea_p.h b/src/quick/items/qquickmousearea_p.h index 5cd86541d4..d90c8e1baa 100644 --- a/src/quick/items/qquickmousearea_p.h +++ b/src/quick/items/qquickmousearea_p.h @@ -75,12 +75,12 @@ class Q_QUICK_PRIVATE_EXPORT QQuickMouseArea : public QQuickItem Q_PROPERTY(Qt::MouseButtons pressedButtons READ pressedButtons NOTIFY pressedButtonsChanged) Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged) Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged) -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) Q_PROPERTY(QQuickDrag *drag READ drag CONSTANT) //### add flicking to QQuickDrag or add a QQuickFlick ??? #endif Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged) Q_PROPERTY(bool propagateComposedEvents READ propagateComposedEvents WRITE setPropagateComposedEvents NOTIFY propagateComposedEventsChanged) -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) Q_PROPERTY(Qt::CursorShape cursorShape READ cursorShape WRITE setCursorShape RESET unsetCursor NOTIFY cursorShapeChanged) #endif Q_PROPERTY(bool containsPress READ containsPress NOTIFY containsPressChanged REVISION 1) @@ -110,7 +110,7 @@ public: bool hoverEnabled() const; void setHoverEnabled(bool h); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QQuickDrag *drag(); #endif @@ -120,7 +120,7 @@ public: bool propagateComposedEvents() const; void setPropagateComposedEvents(bool propagate); -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) Qt::CursorShape cursorShape() const; void setCursorShape(Qt::CursorShape shape); #endif @@ -133,7 +133,7 @@ Q_SIGNALS: void pressedButtonsChanged(); void acceptedButtonsChanged(); void hoverEnabledChanged(); -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) void cursorShapeChanged(); #endif void positionChanged(QQuickMouseEvent *mouse); @@ -166,7 +166,7 @@ protected: void hoverEnterEvent(QHoverEvent *event) Q_DECL_OVERRIDE; void hoverMoveEvent(QHoverEvent *event) Q_DECL_OVERRIDE; void hoverLeaveEvent(QHoverEvent *event) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; #endif bool childMouseEventFilter(QQuickItem *i, QEvent *e) Q_DECL_OVERRIDE; diff --git a/src/quick/items/qquickmousearea_p_p.h b/src/quick/items/qquickmousearea_p_p.h index b59e02910f..456b1866a3 100644 --- a/src/quick/items/qquickmousearea_p_p.h +++ b/src/quick/items/qquickmousearea_p_p.h @@ -95,7 +95,7 @@ public: bool propagateComposedEvents : 1; bool overThreshold : 1; Qt::MouseButtons pressed; -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QQuickDrag *drag; #endif QPointF startScene; @@ -106,7 +106,7 @@ public: Qt::MouseButtons lastButtons; Qt::KeyboardModifiers lastModifiers; QBasicTimer pressAndHoldTimer; -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) QCursor *cursor; #endif QQuickMouseEvent quickMouseEvent; diff --git a/src/quick/items/qquickpainteditem.cpp b/src/quick/items/qquickpainteditem.cpp index 1ef8de753d..c5155c9c35 100644 --- a/src/quick/items/qquickpainteditem.cpp +++ b/src/quick/items/qquickpainteditem.cpp @@ -662,7 +662,7 @@ QSGTextureProvider *QQuickPaintedItem::textureProvider() const return QQuickItem::textureProvider(); Q_D(const QQuickPaintedItem); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QQuickWindow *w = window(); if (!w || !w->openglContext() || QThread::currentThread() != w->openglContext()->thread()) { qWarning("QQuickPaintedItem::textureProvider: can only be queried on the rendering thread of an exposed window"); diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp index fd8971c845..6295aa1932 100644 --- a/src/quick/items/qquickpincharea.cpp +++ b/src/quick/items/qquickpincharea.cpp @@ -682,7 +682,7 @@ bool QQuickPinchArea::event(QEvent *event) return QQuickItem::event(event); switch (event->type()) { -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) case QEvent::NativeGesture: { QNativeGestureEvent *gesture = static_cast(event); switch (gesture->gestureType()) { @@ -775,7 +775,7 @@ bool QQuickPinchArea::event(QEvent *event) return QQuickItem::event(event); } } break; -#endif // QT_NO_GESTURES +#endif // gestures case QEvent::Wheel: event->ignore(); return false; diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp index 74aa2da9e0..13e13890b7 100644 --- a/src/quick/items/qquickrendercontrol.cpp +++ b/src/quick/items/qquickrendercontrol.cpp @@ -44,7 +44,7 @@ #include #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include # include #if QT_CONFIG(quick_shadereffect) @@ -62,7 +62,7 @@ #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha); #endif /*! @@ -227,7 +227,7 @@ void QQuickRenderControl::initialize(QOpenGLContext *gl) { Q_D(QQuickRenderControl); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (!d->window) { qWarning("QQuickRenderControl::initialize called with no associated window"); return; @@ -379,7 +379,7 @@ QImage QQuickRenderControl::grab() QImage grabContent; if (d->window->rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) render(); grabContent = qt_gl_read_framebuffer(d->window->size() * d->window->effectiveDevicePixelRatio(), false, false); #endif diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp index 5670696ce2..7926607e33 100644 --- a/src/quick/items/qquickshadereffect.cpp +++ b/src/quick/items/qquickshadereffect.cpp @@ -40,7 +40,7 @@ #include #include #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) #include #endif #include @@ -499,14 +499,14 @@ QSGContextFactoryInterface::Flags qsg_backend_flags(); QQuickShaderEffect::QQuickShaderEffect(QQuickItem *parent) : QQuickItem(*new QQuickShaderEffectPrivate, parent), -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) m_glImpl(nullptr), #endif m_impl(nullptr) { setFlag(QQuickItem::ItemHasContents); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (!qsg_backend_flags().testFlag(QSGContextFactoryInterface::SupportsShaderEffectNode)) m_glImpl = new QQuickOpenGLShaderEffect(this, this); @@ -539,7 +539,7 @@ QQuickShaderEffect::QQuickShaderEffect(QQuickItem *parent) QByteArray QQuickShaderEffect::fragmentShader() const { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) return m_glImpl->fragmentShader(); #endif @@ -548,7 +548,7 @@ QByteArray QQuickShaderEffect::fragmentShader() const void QQuickShaderEffect::setFragmentShader(const QByteArray &code) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) { m_glImpl->setFragmentShader(code); return; @@ -578,7 +578,7 @@ void QQuickShaderEffect::setFragmentShader(const QByteArray &code) QByteArray QQuickShaderEffect::vertexShader() const { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) return m_glImpl->vertexShader(); #endif @@ -587,7 +587,7 @@ QByteArray QQuickShaderEffect::vertexShader() const void QQuickShaderEffect::setVertexShader(const QByteArray &code) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) { m_glImpl->setVertexShader(code); return; @@ -607,7 +607,7 @@ void QQuickShaderEffect::setVertexShader(const QByteArray &code) bool QQuickShaderEffect::blending() const { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) return m_glImpl->blending(); #endif @@ -616,7 +616,7 @@ bool QQuickShaderEffect::blending() const void QQuickShaderEffect::setBlending(bool enable) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) { m_glImpl->setBlending(enable); return; @@ -640,7 +640,7 @@ void QQuickShaderEffect::setBlending(bool enable) QVariant QQuickShaderEffect::mesh() const { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) return m_glImpl->mesh(); #endif @@ -649,7 +649,7 @@ QVariant QQuickShaderEffect::mesh() const void QQuickShaderEffect::setMesh(const QVariant &mesh) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) { m_glImpl->setMesh(mesh); return; @@ -674,7 +674,7 @@ void QQuickShaderEffect::setMesh(const QVariant &mesh) QQuickShaderEffect::CullMode QQuickShaderEffect::cullMode() const { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) return m_glImpl->cullMode(); #endif @@ -683,7 +683,7 @@ QQuickShaderEffect::CullMode QQuickShaderEffect::cullMode() const void QQuickShaderEffect::setCullMode(CullMode face) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) { m_glImpl->setCullMode(face); return; @@ -715,7 +715,7 @@ void QQuickShaderEffect::setCullMode(CullMode face) bool QQuickShaderEffect::supportsAtlasTextures() const { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) return m_glImpl->supportsAtlasTextures(); #endif @@ -724,7 +724,7 @@ bool QQuickShaderEffect::supportsAtlasTextures() const void QQuickShaderEffect::setSupportsAtlasTextures(bool supports) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) { m_glImpl->setSupportsAtlasTextures(supports); return; @@ -771,7 +771,7 @@ void QQuickShaderEffect::setSupportsAtlasTextures(bool supports) QString QQuickShaderEffect::log() const { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) return m_glImpl->log(); #endif @@ -780,7 +780,7 @@ QString QQuickShaderEffect::log() const QQuickShaderEffect::Status QQuickShaderEffect::status() const { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) return m_glImpl->status(); #endif @@ -789,7 +789,7 @@ QQuickShaderEffect::Status QQuickShaderEffect::status() const bool QQuickShaderEffect::event(QEvent *e) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) { m_glImpl->handleEvent(e); return QQuickItem::event(e); @@ -801,7 +801,7 @@ bool QQuickShaderEffect::event(QEvent *e) void QQuickShaderEffect::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) { m_glImpl->handleGeometryChanged(newGeometry, oldGeometry); QQuickItem::geometryChanged(newGeometry, oldGeometry); @@ -814,7 +814,7 @@ void QQuickShaderEffect::geometryChanged(const QRectF &newGeometry, const QRectF QSGNode *QQuickShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) return m_glImpl->handleUpdatePaintNode(oldNode, updatePaintNodeData); #endif @@ -823,7 +823,7 @@ QSGNode *QQuickShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa void QQuickShaderEffect::componentComplete() { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) { m_glImpl->maybeUpdateShaders(); QQuickItem::componentComplete(); @@ -836,7 +836,7 @@ void QQuickShaderEffect::componentComplete() void QQuickShaderEffect::itemChange(ItemChange change, const ItemChangeData &value) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) { m_glImpl->handleItemChange(change, value); QQuickItem::itemChange(change, value); @@ -854,7 +854,7 @@ bool QQuickShaderEffect::isComponentComplete() const QString QQuickShaderEffect::parseLog() // for OpenGL-based autotests { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_glImpl) return m_glImpl->parseLog(); #endif @@ -864,7 +864,7 @@ QString QQuickShaderEffect::parseLog() // for OpenGL-based autotests void QQuickShaderEffectPrivate::updatePolish() { Q_Q(QQuickShaderEffect); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (q->m_glImpl) { q->m_glImpl->maybeUpdateShaders(); return; diff --git a/src/quick/items/qquickshadereffect_p.h b/src/quick/items/qquickshadereffect_p.h index 2b7ff4cf6e..7885daffbb 100644 --- a/src/quick/items/qquickshadereffect_p.h +++ b/src/quick/items/qquickshadereffect_p.h @@ -135,7 +135,7 @@ protected: void itemChange(ItemChange change, const ItemChangeData &value) override; private: -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QQuickOpenGLShaderEffect *m_glImpl; #endif QQuickGenericShaderEffect *m_impl; diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 2bfb4501fc..e37a7e6d5e 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -1819,7 +1819,7 @@ bool QQuickTextPrivate::setHAlign(QQuickText::HAlignment alignment, bool forceAl bool QQuickTextPrivate::determineHorizontalAlignment() { if (hAlignImplicit) { -#ifndef QT_NO_IM +#if QT_CONFIG(im) bool alignToRight = text.isEmpty() ? QGuiApplication::inputMethod()->inputDirection() == Qt::RightToLeft : rightToLeftText; #else bool alignToRight = rightToLeftText; @@ -2713,12 +2713,12 @@ QString QQuickText::hoveredLink() const if (d->extra.isAllocated()) return d->extra->hoveredLink; } else { -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) if (QQuickWindow *wnd = window()) { QPointF pos = QCursor::pos(wnd->screen()) - wnd->position() - mapToScene(QPointF(0, 0)); return d->anchorAt(pos); } -#endif // QT_NO_CURSOR +#endif // cursor } return QString(); } diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp index ef7485a8e9..887cc6fea7 100644 --- a/src/quick/items/qquicktextcontrol.cpp +++ b/src/quick/items/qquicktextcontrol.cpp @@ -79,9 +79,6 @@ const int textCursorWidth = 1; QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(DBG_HOVER_TRACE) -#ifndef QT_NO_CONTEXTMENU -#endif - // could go into QTextCursor... static QTextLine currentTextLine(const QTextCursor &cursor) { @@ -99,7 +96,7 @@ static QTextLine currentTextLine(const QTextCursor &cursor) QQuickTextControlPrivate::QQuickTextControlPrivate() : doc(0), -#ifndef QT_NO_IM +#if QT_CONFIG(im) preeditCursor(0), #endif interactionFlags(Qt::TextEditorInteraction), @@ -123,7 +120,7 @@ QQuickTextControlPrivate::QQuickTextControlPrivate() bool QQuickTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e) { -#ifdef QT_NO_SHORTCUT +#if !QT_CONFIG(shortcut) Q_UNUSED(e); #endif @@ -139,7 +136,7 @@ bool QQuickTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e) if (false) { } -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) if (e == QKeySequence::MoveToNextChar) { op = QTextCursor::Right; } @@ -232,7 +229,7 @@ bool QQuickTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e) else if (e == QKeySequence::MoveToEndOfDocument) { op = QTextCursor::End; } -#endif // QT_NO_SHORTCUT +#endif // shortcut else { return false; } @@ -290,7 +287,7 @@ void QQuickTextControlPrivate::setContent(Qt::TextFormat format, const QString & { Q_Q(QQuickTextControl); -#ifndef QT_NO_IM +#if QT_CONFIG(im) cancelPreedit(); #endif @@ -326,7 +323,7 @@ void QQuickTextControlPrivate::setContent(Qt::TextFormat format, const QString & formatCursor.setCharFormat(charFormatForInsertion); formatCursor.endEditBlock(); } else { -#ifndef QT_NO_TEXTHTMLPARSER +#if QT_CONFIG(texthtmlparser) doc->setHtml(text); #else doc->setPlainText(text); @@ -407,7 +404,7 @@ void QQuickTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged / { Q_Q(QQuickTextControl); if (forceEmitSelectionChanged) { -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (hasFocus) qGuiApp->inputMethod()->update(Qt::ImCurrentSelection); #endif @@ -429,7 +426,7 @@ void QQuickTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged / lastSelectionEnd = selectionEnd; if (!forceEmitSelectionChanged) { -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (hasFocus) qGuiApp->inputMethod()->update(Qt::ImCurrentSelection); #endif @@ -443,7 +440,7 @@ void QQuickTextControlPrivate::_q_updateCurrentCharFormatAndSelection() selectionChanged(); } -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) void QQuickTextControlPrivate::setClipboardSelection() { QClipboard *clipboard = QGuiApplication::clipboard(); @@ -544,7 +541,7 @@ void QQuickTextControlPrivate::extendWordwiseSelection(int suggestedNewPosition, } if (interactionFlags & Qt::TextSelectableByMouse) { -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) setClipboardSelection(); #endif selectionChanged(true); @@ -574,7 +571,7 @@ void QQuickTextControlPrivate::extendBlockwiseSelection(int suggestedNewPosition } if (interactionFlags & Qt::TextSelectableByMouse) { -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) setClipboardSelection(); #endif selectionChanged(true); @@ -656,7 +653,7 @@ void QQuickTextControl::updateCursorRectangle(bool force) void QQuickTextControl::setTextCursor(const QTextCursor &cursor) { Q_D(QQuickTextControl); -#ifndef QT_NO_IM +#if QT_CONFIG(im) d->commitPreedit(); #endif d->cursorIsFocusIndicator = false; @@ -677,7 +674,7 @@ QTextCursor QQuickTextControl::textCursor() const return d->cursor; } -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) void QQuickTextControl::cut() { @@ -759,7 +756,7 @@ void QQuickTextControl::processEvent(QEvent *e, const QMatrix &matrix) QHoverEvent *ev = static_cast(e); d->hoverEvent(ev, matrix.map(ev->posF())); break; } -#ifndef QT_NO_IM +#if QT_CONFIG(im) case QEvent::InputMethod: d->inputMethodEvent(static_cast(e)); break; @@ -795,7 +792,7 @@ void QQuickTextControl::processEvent(QEvent *e, const QMatrix &matrix) break; } } -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) } else if (ke == QKeySequence::Copy || ke == QKeySequence::Paste || ke == QKeySequence::Cut @@ -873,20 +870,20 @@ void QQuickTextControlPrivate::keyPressEvent(QKeyEvent *e) return; } -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) if (e == QKeySequence::SelectAll) { e->accept(); q->selectAll(); return; } -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) else if (e == QKeySequence::Copy) { e->accept(); q->copy(); return; } #endif -#endif // QT_NO_SHORTCUT +#endif // shortcut if (interactionFlags & Qt::TextSelectableByKeyboard && cursorMoveKeyEvent(e)) @@ -924,7 +921,7 @@ void QQuickTextControlPrivate::keyPressEvent(QKeyEvent *e) } goto accept; } -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) else if (e == QKeySequence::InsertParagraphSeparator) { cursor.insertBlock(); e->accept(); @@ -937,14 +934,14 @@ void QQuickTextControlPrivate::keyPressEvent(QKeyEvent *e) #endif if (false) { } -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) else if (e == QKeySequence::Undo) { q->undo(); } else if (e == QKeySequence::Redo) { q->redo(); } -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) else if (e == QKeySequence::Cut) { q->cut(); } @@ -975,7 +972,7 @@ void QQuickTextControlPrivate::keyPressEvent(QKeyEvent *e) cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); cursor.removeSelectedText(); } -#endif // QT_NO_SHORTCUT +#endif // shortcut else { goto process; } @@ -1019,7 +1016,7 @@ QRectF QQuickTextControlPrivate::rectForPosition(int position) const const QTextLayout *layout = block.layout(); const QPointF layoutPos = q->blockBoundingRect(block).topLeft(); int relativePos = position - block.position(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (preeditCursor != 0) { int preeditPos = layout->preeditAreaPosition(); if (relativePos == preeditPos) @@ -1083,7 +1080,7 @@ void QQuickTextControlPrivate::mousePressEvent(QMouseEvent *e, const QPointF &po const QTextCursor oldSelection = cursor; const int oldCursorPos = cursor.position(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) commitPreedit(); #endif @@ -1157,7 +1154,7 @@ void QQuickTextControlPrivate::mouseMoveEvent(QMouseEvent *e, const QPointF &mou int newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit); -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (isPreediting()) { // note: oldCursorPos not including preedit int selectionStartPos = q->hitTest(mousePressPos, Qt::FuzzyHit); @@ -1183,7 +1180,7 @@ void QQuickTextControlPrivate::mouseMoveEvent(QMouseEvent *e, const QPointF &mou extendBlockwiseSelection(newCursorPos); else if (selectedWordOnDoubleClick.hasSelection()) extendWordwiseSelection(newCursorPos, mouseX); -#ifndef QT_NO_IM +#if QT_CONFIG(im) else if (!isPreediting()) setCursorPosition(newCursorPos, QTextCursor::KeepAnchor); #endif @@ -1194,7 +1191,7 @@ void QQuickTextControlPrivate::mouseMoveEvent(QMouseEvent *e, const QPointF &mou q->updateCursorRectangle(true); } _q_updateCurrentCharFormatAndSelection(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (qGuiApp) qGuiApp->inputMethod()->update(Qt::ImQueryInput); #endif @@ -1221,7 +1218,7 @@ void QQuickTextControlPrivate::mouseReleaseEvent(QMouseEvent *e, const QPointF & if (mousePressed) { mousePressed = false; -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) setClipboardSelection(); selectionChanged(true); } else if (e->button() == Qt::MidButton @@ -1270,7 +1267,7 @@ void QQuickTextControlPrivate::mouseDoubleClickEvent(QMouseEvent *e, const QPoin Q_Q(QQuickTextControl); if (e->button() == Qt::LeftButton && (interactionFlags & Qt::TextSelectableByMouse)) { -#ifndef QT_NO_IM +#if QT_CONFIG(im) commitPreedit(); #endif @@ -1291,7 +1288,7 @@ void QQuickTextControlPrivate::mouseDoubleClickEvent(QMouseEvent *e, const QPoin tripleClickTimer.start(QGuiApplication::styleHints()->mouseDoubleClickInterval(), q); if (doEmit) { selectionChanged(); -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) setClipboardSelection(); #endif emit q->cursorPositionChanged(); @@ -1304,7 +1301,7 @@ void QQuickTextControlPrivate::mouseDoubleClickEvent(QMouseEvent *e, const QPoin bool QQuickTextControlPrivate::sendMouseEventToInputContext(QMouseEvent *e, const QPointF &pos) { -#if !defined(QT_NO_IM) +#if QT_CONFIG(im) Q_Q(QQuickTextControl); Q_UNUSED(e); @@ -1328,7 +1325,7 @@ bool QQuickTextControlPrivate::sendMouseEventToInputContext(QMouseEvent *e, cons return false; } -#ifndef QT_NO_IM +#if QT_CONFIG(im) void QQuickTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) { Q_Q(QQuickTextControl); @@ -1481,7 +1478,7 @@ QVariant QQuickTextControl::inputMethodQuery(Qt::InputMethodQuery property, QVar return QVariant(); } } -#endif // QT_NO_IM +#endif // im void QQuickTextControlPrivate::focusEvent(QFocusEvent *e) { @@ -1611,7 +1608,7 @@ void QQuickTextControl::moveCursor(QTextCursor::MoveOperation op, QTextCursor::M bool QQuickTextControl::canPaste() const { -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) Q_D(const QQuickTextControl); if (d->interactionFlags & Qt::TextEditable) { const QMimeData *md = QGuiApplication::clipboard()->mimeData(); @@ -1661,7 +1658,7 @@ void QQuickTextControl::insertFromMimeData(const QMimeData *source) bool hasData = false; QTextDocumentFragment fragment; -#ifndef QT_NO_TEXTHTMLPARSER +#if QT_CONFIG(texthtmlparser) if (source->hasFormat(QLatin1String("application/x-qrichtext")) && d->acceptRichText) { // x-qrichtext is always UTF-8 (taken from Qt3 since we don't use it anymore). QString richtext = QString::fromUtf8(source->data(QLatin1String("application/x-qrichtext"))); @@ -1680,7 +1677,7 @@ void QQuickTextControl::insertFromMimeData(const QMimeData *source) } #else fragment = QTextDocumentFragment::fromPlainText(source->text()); -#endif // QT_NO_TEXTHTMLPARSER +#endif // texthtmlparser if (hasData) d->cursor.insertFragment(fragment); @@ -1751,7 +1748,7 @@ void QQuickTextControlPrivate::activateLinkUnderCursor(QString href) emit q_func()->linkActivated(href); } -#ifndef QT_NO_IM +#if QT_CONFIG(im) bool QQuickTextControlPrivate::isPreediting() const { QTextLayout *layout = cursor.block().layout(); @@ -1789,7 +1786,7 @@ void QQuickTextControlPrivate::cancelPreedit() QInputMethodEvent event; QCoreApplication::sendEvent(q->parent(), &event); } -#endif // QT_NO_IM +#endif // im void QQuickTextControl::setTextInteractionFlags(Qt::TextInteractionFlags flags) { @@ -1813,7 +1810,7 @@ QString QQuickTextControl::toPlainText() const return document()->toPlainText(); } -#ifndef QT_NO_TEXTHTMLPARSER +#if QT_CONFIG(texthtmlparser) QString QQuickTextControl::toHtml() const { return document()->toHtml(); @@ -1840,7 +1837,7 @@ QRectF QQuickTextControl::blockBoundingRect(const QTextBlock &block) const QString QQuickTextControl::preeditText() const { -#ifndef QT_NO_IM +#if QT_CONFIG(im) Q_D(const QQuickTextControl); QTextLayout *layout = d->cursor.block().layout(); if (!layout) @@ -1857,7 +1854,7 @@ QStringList QQuickTextEditMimeData::formats() const { if (!fragment.isEmpty()) return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") -#ifndef QT_NO_TEXTODFWRITER +#if QT_CONFIG(textodfwriter) << QString::fromLatin1("application/vnd.oasis.opendocument.text") #endif ; @@ -1875,10 +1872,10 @@ QVariant QQuickTextEditMimeData::retrieveData(const QString &mimeType, QVariant: void QQuickTextEditMimeData::setup() const { QQuickTextEditMimeData *that = const_cast(this); -#ifndef QT_NO_TEXTHTMLPARSER +#if QT_CONFIG(texthtmlparser) that->setData(QLatin1String("text/html"), fragment.toHtml("utf-8").toUtf8()); #endif -#ifndef QT_NO_TEXTODFWRITER +#if QT_CONFIG(textodfwriter) { QBuffer buffer; QTextDocumentWriter writer(&buffer, "ODF"); diff --git a/src/quick/items/qquicktextcontrol_p.h b/src/quick/items/qquicktextcontrol_p.h index 602e457cb8..7992d2943b 100644 --- a/src/quick/items/qquicktextcontrol_p.h +++ b/src/quick/items/qquicktextcontrol_p.h @@ -89,7 +89,7 @@ public: QString toPlainText() const; -#ifndef QT_NO_TEXTHTMLPARSER +#if QT_CONFIG(texthtmlparser) QString toHtml() const; #endif @@ -129,7 +129,7 @@ public Q_SLOTS: void setPlainText(const QString &text); void setHtml(const QString &text); -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) void cut(); void copy(); void paste(QClipboard::Mode mode = QClipboard::Clipboard); @@ -164,7 +164,7 @@ public: virtual void processEvent(QEvent *e, const QMatrix &matrix); void processEvent(QEvent *e, const QPointF &coordinateOffset = QPointF()); -#ifndef QT_NO_IM +#if QT_CONFIG(im) virtual QVariant inputMethodQuery(Qt::InputMethodQuery property) const; Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const; #endif diff --git a/src/quick/items/qquicktextcontrol_p_p.h b/src/quick/items/qquicktextcontrol_p_p.h index 0f78feb5de..0582e6d113 100644 --- a/src/quick/items/qquicktextcontrol_p_p.h +++ b/src/quick/items/qquicktextcontrol_p_p.h @@ -90,7 +90,7 @@ public: void _q_updateCurrentCharFormatAndSelection(); -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) void setClipboardSelection(); #endif @@ -114,14 +114,14 @@ public: void mouseDoubleClickEvent(QMouseEvent *event, const QPointF &pos); bool sendMouseEventToInputContext(QMouseEvent *event, const QPointF &pos); void focusEvent(QFocusEvent *e); -#ifndef QT_NO_IM +#if QT_CONFIG(im) void inputMethodEvent(QInputMethodEvent *); #endif void hoverEvent(QHoverEvent *e, const QPointF &pos); void activateLinkUnderCursor(QString href = QString()); -#ifndef QT_NO_IM +#if QT_CONFIG(im) bool isPreediting() const; void commitPreedit(); void cancelPreedit(); @@ -143,7 +143,7 @@ public: QBasicTimer cursorBlinkTimer; QBasicTimer tripleClickTimer; -#ifndef QT_NO_IM +#if QT_CONFIG(im) int preeditCursor; #endif diff --git a/src/quick/items/qquicktextdocument.cpp b/src/quick/items/qquicktextdocument.cpp index 1dc54eb107..e7492b97ae 100644 --- a/src/quick/items/qquicktextdocument.cpp +++ b/src/quick/items/qquicktextdocument.cpp @@ -230,7 +230,7 @@ void QQuickTextDocumentWithImageResources::setText(const QString &text) { clearResources(); -#ifndef QT_NO_TEXTHTMLPARSER +#if QT_CONFIG(texthtmlparser) setHtml(text); #else setPlainText(text); diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 3389a608bf..b99e53b6c8 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -190,7 +190,7 @@ QString QQuickTextEdit::text() const Q_D(const QQuickTextEdit); if (!d->textCached && isComponentComplete()) { QQuickTextEditPrivate *d = const_cast(d_func()); -#ifndef QT_NO_TEXTHTMLPARSER +#if QT_CONFIG(texthtmlparser) if (d->richText) d->text = d->control->toHtml(); else @@ -381,7 +381,7 @@ void QQuickTextEdit::setText(const QString &text) if (!isComponentComplete()) { d->text = text; } else if (d->richText) { -#ifndef QT_NO_TEXTHTMLPARSER +#if QT_CONFIG(texthtmlparser) d->control->setHtml(text); #else d->control->setPlainText(text); @@ -458,7 +458,7 @@ void QQuickTextEdit::setTextFormat(TextFormat format) bool wasRich = d->richText; d->richText = format == RichText || (format == AutoText && (wasRich || Qt::mightBeRichText(text()))); -#ifndef QT_NO_TEXTHTMLPARSER +#if QT_CONFIG(texthtmlparser) if (isComponentComplete()) { if (wasRich && !d->richText) { d->control->setPlainText(!d->textCached ? d->control->toHtml() : d->text); @@ -540,7 +540,7 @@ void QQuickTextEdit::setFont(const QFont &font) } updateSize(); updateWholeDocument(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) updateInputMethod(Qt::ImCursorRectangle | Qt::ImAnchorRectangle | Qt::ImFont); #endif } @@ -738,7 +738,7 @@ bool QQuickTextEditPrivate::determineHorizontalAlignment() Q_Q(QQuickTextEdit); if (hAlignImplicit && q->isComponentComplete()) { Qt::LayoutDirection direction = contentDirection; -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (direction == Qt::LayoutDirectionAuto) { const QString preeditText = control->textCursor().block().layout()->preeditAreaText(); direction = textDirection(preeditText); @@ -764,7 +764,7 @@ void QQuickTextEditPrivate::mirrorChange() } } -#ifndef QT_NO_IM +#if QT_CONFIG(im) Qt::InputMethodHints QQuickTextEditPrivate::effectiveInputMethodHints() const { return inputMethodHints | Qt::ImhMultiLine; @@ -1012,7 +1012,7 @@ int QQuickTextEdit::positionAt(qreal x, qreal y) const y -= d->yoff; int r = d->document->documentLayout()->hitTest(QPointF(x, y), Qt::FuzzyHit); -#ifndef QT_NO_IM +#if QT_CONFIG(im) QTextCursor cursor = d->control->textCursor(); if (r > cursor.position()) { // The cursor position includes positions within the preedit text, but only positions in the @@ -1261,7 +1261,7 @@ int QQuickTextEdit::selectionEnd() const QString QQuickTextEdit::selectedText() const { Q_D(const QQuickTextEdit); -#ifndef QT_NO_TEXTHTMLPARSER +#if QT_CONFIG(texthtmlparser) return d->richText ? d->control->textCursor().selectedText() : d->control->textCursor().selection().toPlainText(); @@ -1379,17 +1379,17 @@ void QQuickTextEdit::setTextMargin(qreal margin) Qt::InputMethodHints QQuickTextEdit::inputMethodHints() const { -#ifdef QT_NO_IM +#if !QT_CONFIG(im) return Qt::ImhNone; #else Q_D(const QQuickTextEdit); return d->inputMethodHints; -#endif // QT_NO_IM +#endif // im } void QQuickTextEdit::setInputMethodHints(Qt::InputMethodHints hints) { -#ifdef QT_NO_IM +#if !QT_CONFIG(im) Q_UNUSED(hints); #else Q_D(QQuickTextEdit); @@ -1400,7 +1400,7 @@ void QQuickTextEdit::setInputMethodHints(Qt::InputMethodHints hints) d->inputMethodHints = hints; updateInputMethod(Qt::ImHints); emit inputMethodHintsChanged(); -#endif // QT_NO_IM +#endif // im } void QQuickTextEdit::geometryChanged(const QRectF &newGeometry, @@ -1427,7 +1427,7 @@ void QQuickTextEdit::componentComplete() QQuickImplicitSizeItem::componentComplete(); d->document->setBaseUrl(baseUrl()); -#ifndef QT_NO_TEXTHTML_PARSER +#if QT_CONFIG(texthtmlparser) if (d->richText) d->control->setHtml(d->text); else @@ -1554,7 +1554,7 @@ void QQuickTextEdit::setReadOnly(bool r) if (r == isReadOnly()) return; -#ifndef QT_NO_IM +#if QT_CONFIG(im) setFlag(QQuickItem::ItemAcceptsInputMethod, !r); #endif Qt::TextInteractionFlags flags = Qt::LinksAccessibleByMouse; @@ -1569,7 +1569,7 @@ void QQuickTextEdit::setReadOnly(bool r) d->control->setTextInteractionFlags(flags); d->control->moveCursor(QTextCursor::End); -#ifndef QT_NO_IM +#if QT_CONFIG(im) updateInputMethod(Qt::ImEnabled); #endif q_canPasteChanged(); @@ -1748,7 +1748,7 @@ bool QQuickTextEdit::isRightToLeft(int start, int end) } } -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) /*! \qmlmethod QtQuick::TextEdit::cut() @@ -1781,7 +1781,7 @@ void QQuickTextEdit::paste() Q_D(QQuickTextEdit); d->control->paste(); } -#endif // QT_NO_CLIPBOARD +#endif // clipboard /*! @@ -1822,7 +1822,7 @@ void QQuickTextEdit::mousePressEvent(QMouseEvent *event) bool hadActiveFocus = hasActiveFocus(); forceActiveFocus(Qt::MouseFocusReason); // re-open input panel on press if already focused -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (hasActiveFocus() && hadActiveFocus && !isReadOnly()) qGuiApp->inputMethod()->show(); #else @@ -1870,7 +1870,7 @@ void QQuickTextEdit::mouseMoveEvent(QMouseEvent *event) QQuickImplicitSizeItem::mouseMoveEvent(event); } -#ifndef QT_NO_IM +#if QT_CONFIG(im) /*! \overload Handles the given input method \a event. @@ -1923,7 +1923,7 @@ QVariant QQuickTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const { return inputMethodQuery(property, QVariant()); } -#endif // QT_NO_IM +#endif // im void QQuickTextEdit::triggerPreprocess() { @@ -2197,12 +2197,12 @@ bool QQuickTextEdit::canRedo() const */ bool QQuickTextEdit::isInputMethodComposing() const { -#ifdef QT_NO_IM +#if !QT_CONFIG(im) return false; #else Q_D(const QQuickTextEdit); return d->control->hasImState(); -#endif // QT_NO_IM +#endif // im } QQuickTextEditPrivate::ExtraData::ExtraData() @@ -2223,14 +2223,14 @@ void QQuickTextEditPrivate::init() { Q_Q(QQuickTextEdit); -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) if (QGuiApplication::clipboard()->supportsSelection()) q->setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton); else #endif q->setAcceptedMouseButtons(Qt::LeftButton); -#ifndef QT_NO_IM +#if QT_CONFIG(im) q->setFlag(QQuickItem::ItemAcceptsInputMethod); #endif q->setFlag(QQuickItem::ItemHasContents); @@ -2255,7 +2255,7 @@ void QQuickTextEditPrivate::init() qmlobject_connect(control, QQuickTextControl, SIGNAL(overwriteModeChanged(bool)), q, QQuickTextEdit, SIGNAL(overwriteModeChanged(bool))); qmlobject_connect(control, QQuickTextControl, SIGNAL(textChanged()), q, QQuickTextEdit, SLOT(q_textChanged())); qmlobject_connect(control, QQuickTextControl, SIGNAL(preeditTextChanged()), q, QQuickTextEdit, SIGNAL(preeditTextChanged())); -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) qmlobject_connect(QGuiApplication::clipboard(), QClipboard, SIGNAL(dataChanged()), q, QQuickTextEdit, SLOT(q_canPasteChanged())); #endif qmlobject_connect(document, QQuickTextDocumentWithImageResources, SIGNAL(undoAvailable(bool)), q, QQuickTextEdit, SIGNAL(canUndoChanged())); @@ -2341,7 +2341,7 @@ void QQuickTextEdit::q_contentsChange(int pos, int charsRemoved, int charsAdded) void QQuickTextEdit::moveCursorDelegate() { Q_D(QQuickTextEdit); -#ifndef QT_NO_IM +#if QT_CONFIG(im) updateInputMethod(); #endif emit cursorRectangleChanged(); @@ -2582,7 +2582,7 @@ void QQuickTextEditPrivate::updateDefaultTextOption() else opt.setAlignment(Qt::Alignment(vAlign)); -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (contentDirection == Qt::LayoutDirectionAuto) { opt.setTextDirection(qGuiApp->inputMethod()->inputDirection()); } else @@ -2627,14 +2627,14 @@ void QQuickTextEditPrivate::handleFocusEvent(QFocusEvent *event) control->processEvent(event, QPointF(-xoff, -yoff)); if (focus) { q->q_updateAlignment(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (focusOnPress && !q->isReadOnly()) qGuiApp->inputMethod()->show(); q->connect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)), q, SLOT(q_updateAlignment())); #endif } else { -#ifndef QT_NO_IM +#if QT_CONFIG(im) q->disconnect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)), q, SLOT(q_updateAlignment())); #endif @@ -2685,7 +2685,7 @@ QString QQuickTextEdit::getText(int start, int end) const QTextCursor cursor(d->document); cursor.setPosition(start, QTextCursor::MoveAnchor); cursor.setPosition(end, QTextCursor::KeepAnchor); -#ifndef QT_NO_TEXTHTMLPARSER +#if QT_CONFIG(texthtmlparser) return d->richText ? cursor.selectedText() : cursor.selection().toPlainText(); @@ -2714,7 +2714,7 @@ QString QQuickTextEdit::getFormattedText(int start, int end) const cursor.setPosition(end, QTextCursor::KeepAnchor); if (d->richText) { -#ifndef QT_NO_TEXTHTMLPARSER +#if QT_CONFIG(texthtmlparser) return cursor.selection().toHtml(); #else return cursor.selection().toPlainText(); @@ -2738,7 +2738,7 @@ void QQuickTextEdit::insert(int position, const QString &text) cursor.setPosition(position); d->richText = d->richText || (d->format == AutoText && Qt::mightBeRichText(text)); if (d->richText) { -#ifndef QT_NO_TEXTHTMLPARSER +#if QT_CONFIG(texthtmlparser) cursor.insertHtml(text); #else cursor.insertText(text); @@ -2831,12 +2831,12 @@ QString QQuickTextEdit::hoveredLink() const if (const_cast(d)->isLinkHoveredConnected()) { return d->control->hoveredLink(); } else { -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) if (QQuickWindow *wnd = window()) { QPointF pos = QCursor::pos(wnd->screen()) - wnd->position() - mapToScene(QPointF(0, 0)); return d->control->anchorAt(pos); } -#endif // QT_NO_CURSOR +#endif // cursor } return QString(); } @@ -2881,7 +2881,7 @@ void QQuickTextEdit::append(const QString &text) if (!d->document->isEmpty()) cursor.insertBlock(); -#ifndef QT_NO_TEXTHTMLPARSER +#if QT_CONFIG(texthtmlparser) if (d->format == RichText || (d->format == AutoText && Qt::mightBeRichText(text))) { cursor.insertHtml(text); } else { @@ -2889,7 +2889,7 @@ void QQuickTextEdit::append(const QString &text) } #else cursor.insertText(text); -#endif // QT_NO_TEXTHTMLPARSER +#endif // texthtmlparser cursor.endEditBlock(); d->control->updateCursorRectangle(false); diff --git a/src/quick/items/qquicktextedit_p.h b/src/quick/items/qquicktextedit_p.h index 42c9064860..c8d3515be1 100644 --- a/src/quick/items/qquicktextedit_p.h +++ b/src/quick/items/qquicktextedit_p.h @@ -242,7 +242,7 @@ public: QRectF cursorRectangle() const; -#ifndef QT_NO_IM +#if QT_CONFIG(im) QVariant inputMethodQuery(Qt::InputMethodQuery property) const Q_DECL_OVERRIDE; Q_REVISION(4) Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const; #endif @@ -347,7 +347,7 @@ public Q_SLOTS: void select(int start, int end); void deselect(); bool isRightToLeft(int start, int end); -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) void cut(); void copy(); void paste(); @@ -399,7 +399,7 @@ protected: void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; -#ifndef QT_NO_IM +#if QT_CONFIG(im) void inputMethodEvent(QInputMethodEvent *e) Q_DECL_OVERRIDE; #endif QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) Q_DECL_OVERRIDE; diff --git a/src/quick/items/qquicktextedit_p_p.h b/src/quick/items/qquicktextedit_p_p.h index 1613dd7676..03bce00cb0 100644 --- a/src/quick/items/qquicktextedit_p_p.h +++ b/src/quick/items/qquicktextedit_p_p.h @@ -119,7 +119,7 @@ public: #endif , contentDirection(Qt::LayoutDirectionAuto) , mouseSelectionMode(QQuickTextEdit::SelectCharacters) -#ifndef QT_NO_IM +#if QT_CONFIG(im) , inputMethodHints(Qt::ImhNone) #endif , updateType(UpdatePaintNode) @@ -156,7 +156,7 @@ public: void addCurrentTextNodeToRoot(QQuickTextNodeEngine *, QSGTransformNode *, QQuickTextNode*, TextNodeIterator&, int startPos); QQuickTextNode* createTextNode(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) Qt::InputMethodHints effectiveInputMethodHints() const; #endif @@ -208,7 +208,7 @@ public: QQuickTextEdit::RenderType renderType; Qt::LayoutDirection contentDirection; QQuickTextEdit::SelectionMode mouseSelectionMode; -#ifndef QT_NO_IM +#if QT_CONFIG(im) Qt::InputMethodHints inputMethodHints; #endif UpdateType updateType; diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index dc4aecbbeb..96a46df2f4 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -57,7 +57,7 @@ #include #include -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) #include "qaccessible.h" #include "qquickaccessibleattached_p.h" #endif @@ -142,7 +142,7 @@ void QQuickTextInput::setText(const QString &s) if (s == text()) return; -#ifndef QT_NO_IM +#if QT_CONFIG(im) d->cancelPreedit(); #endif d->internalSetText(s, -1, false); @@ -400,7 +400,7 @@ void QQuickTextInput::setFont(const QFont &font) if (oldFont != d->font) { d->updateLayout(); updateCursorRectangle(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) updateInputMethod(Qt::ImCursorRectangle | Qt::ImFont | Qt::ImAnchorRectangle); #endif } @@ -575,7 +575,7 @@ bool QQuickTextInputPrivate::setHAlign(QQuickTextInput::HAlignment alignment, bo Qt::LayoutDirection QQuickTextInputPrivate::textDirection() const { QString text = m_text; -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (text.isEmpty()) text = m_textLayout.preeditAreaText(); #endif @@ -602,7 +602,7 @@ Qt::LayoutDirection QQuickTextInputPrivate::layoutDirection() const Qt::LayoutDirection direction = m_layoutDirection; if (direction == Qt::LayoutDirectionAuto) { direction = textDirection(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (direction == Qt::LayoutDirectionAuto) direction = QGuiApplication::inputMethod()->inputDirection(); #endif @@ -615,7 +615,7 @@ bool QQuickTextInputPrivate::determineHorizontalAlignment() if (hAlignImplicit) { // if no explicit alignment has been set, follow the natural layout direction of the text Qt::LayoutDirection direction = textDirection(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (direction == Qt::LayoutDirectionAuto) direction = QGuiApplication::inputMethod()->inputDirection(); #endif @@ -707,12 +707,12 @@ void QQuickTextInput::setReadOnly(bool ro) if (d->m_readOnly == ro) return; -#ifndef QT_NO_IM +#if QT_CONFIG(im) setFlag(QQuickItem::ItemAcceptsInputMethod, !ro); #endif d->m_readOnly = ro; d->setCursorPosition(d->end()); -#ifndef QT_NO_IM +#if QT_CONFIG(im) updateInputMethod(Qt::ImEnabled); #endif q_canPasteChanged(); @@ -830,7 +830,7 @@ QRectF QQuickTextInput::cursorRectangle() const Q_D(const QQuickTextInput); int c = d->m_cursor; -#ifndef QT_NO_IM +#if QT_CONFIG(im) c += d->m_preeditCursor; #endif if (d->m_echoMode == NoEcho) @@ -994,17 +994,17 @@ void QQuickTextInput::setAutoScroll(bool b) QValidator* QQuickTextInput::validator() const { -#ifdef QT_NO_VALIDATOR +#if !QT_CONFIG(validator) return 0; #else Q_D(const QQuickTextInput); return d->m_validator; -#endif // QT_NO_VALIDATOR +#endif // validator } void QQuickTextInput::setValidator(QValidator* v) { -#ifdef QT_NO_VALIDATOR +#if !QT_CONFIG(validator) Q_UNUSED(v); #else Q_D(QQuickTextInput); @@ -1029,16 +1029,16 @@ void QQuickTextInput::setValidator(QValidator* v) d->checkIsValid(); emit validatorChanged(); -#endif // QT_NO_VALIDATOR +#endif // validator } -#ifndef QT_NO_VALIDATOR +#if QT_CONFIG(validator) void QQuickTextInput::q_validatorChanged() { Q_D(QQuickTextInput); d->checkIsValid(); } -#endif // QT_NO_VALIDATOR +#endif // validator QRectF QQuickTextInputPrivate::anchorRectangle() const { @@ -1056,7 +1056,7 @@ QRectF QQuickTextInputPrivate::anchorRectangle() const else a = m_selstart == m_cursor ? m_selend : m_selstart; if (a >= 0) { -#ifndef QT_NO_IM +#if QT_CONFIG(im) a += m_preeditCursor; #endif if (m_echoMode == QQuickTextInput::NoEcho) @@ -1151,7 +1151,7 @@ bool QQuickTextInput::hasAcceptableInput() const The corresponding handler is \c onEditingFinished. */ -#ifndef QT_NO_IM +#if QT_CONFIG(im) Qt::InputMethodHints QQuickTextInputPrivate::effectiveInputMethodHints() const { Qt::InputMethodHints hints = inputMethodHints; @@ -1192,7 +1192,7 @@ void QQuickTextInput::setEchoMode(QQuickTextInput::EchoMode echo) d->cancelPasswordEchoTimer(); d->m_echoMode = echo; d->m_passwordEchoEditing = false; -#ifndef QT_NO_IM +#if QT_CONFIG(im) updateInputMethod(Qt::ImHints); #endif d->updateDisplayText(); @@ -1249,17 +1249,17 @@ void QQuickTextInput::setEchoMode(QQuickTextInput::EchoMode echo) Qt::InputMethodHints QQuickTextInput::inputMethodHints() const { -#ifdef QT_NO_IM +#if !QT_CONFIG(im) return Qt::ImhNone; #else Q_D(const QQuickTextInput); return d->inputMethodHints; -#endif // QT_NO_IM +#endif // im } void QQuickTextInput::setInputMethodHints(Qt::InputMethodHints hints) { -#ifdef QT_NO_IM +#if !QT_CONFIG(im) Q_UNUSED(hints); #else Q_D(QQuickTextInput); @@ -1270,7 +1270,7 @@ void QQuickTextInput::setInputMethodHints(Qt::InputMethodHints hints) d->inputMethodHints = hints; updateInputMethod(Qt::ImHints); emit inputMethodHintsChanged(); -#endif // QT_NO_IM +#endif // im } /*! @@ -1319,7 +1319,7 @@ QRectF QQuickTextInput::positionToRectangle(int pos) const Q_D(const QQuickTextInput); if (d->m_echoMode == NoEcho) pos = 0; -#ifndef QT_NO_IM +#if QT_CONFIG(im) else if (pos > d->m_cursor) pos += d->preeditAreaText().length(); #endif @@ -1389,7 +1389,7 @@ void QQuickTextInput::positionAt(QQmlV4Function *args) const int pos = d->positionAt(x, y, position); const int cursor = d->m_cursor; if (pos > cursor) { -#ifndef QT_NO_IM +#if QT_CONFIG(im) const int preeditLength = d->preeditAreaText().length(); pos = pos > cursor + preeditLength ? pos - preeditLength @@ -1470,7 +1470,7 @@ void QQuickTextInput::keyPressEvent(QKeyEvent* ev) QQuickImplicitSizeItem::keyPressEvent(ev); } -#ifndef QT_NO_IM +#if QT_CONFIG(im) void QQuickTextInput::inputMethodEvent(QInputMethodEvent *ev) { Q_D(QQuickTextInput); @@ -1493,7 +1493,7 @@ void QQuickTextInput::mouseDoubleClickEvent(QMouseEvent *event) Q_D(QQuickTextInput); if (d->selectByMouse && event->button() == Qt::LeftButton) { -#ifndef QT_NO_IM +#if QT_CONFIG(im) d->commitPreedit(); #endif int cursor = d->positionAt(event->localPos()); @@ -1549,7 +1549,7 @@ void QQuickTextInput::mouseMoveEvent(QMouseEvent *event) if (qAbs(int(event->localPos().x() - d->pressPos.x())) > QGuiApplication::styleHints()->startDragDistance()) setKeepMouseGrab(true); -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (d->composeMode()) { // start selection int startPos = d->positionAt(d->pressPos); @@ -1576,7 +1576,7 @@ void QQuickTextInput::mouseReleaseEvent(QMouseEvent *event) d->selectPressed = false; setKeepMouseGrab(false); } -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) if (QGuiApplication::clipboard()->supportsSelection()) { if (event->button() == Qt::LeftButton) { d->copy(QClipboard::Selection); @@ -1596,7 +1596,7 @@ void QQuickTextInput::mouseReleaseEvent(QMouseEvent *event) bool QQuickTextInputPrivate::sendMouseEventToInputContext(QMouseEvent *event) { -#if !defined QT_NO_IM +#if QT_CONFIG(im) if (composeMode()) { int tmp_cursor = positionAt(event->localPos()); int mousePos = tmp_cursor - m_cursor; @@ -1623,7 +1623,7 @@ void QQuickTextInput::mouseUngrabEvent() bool QQuickTextInput::event(QEvent* ev) { -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) Q_D(QQuickTextInput); if (ev->type() == QEvent::ShortcutOverride) { if (d->m_readOnly) @@ -1723,7 +1723,7 @@ void QQuickTextInputPrivate::ensureVisible(int position, int preeditCursor, int // left hscroll = width - widthUsed; } -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (preeditLength > 0) { // check to ensure long pre-edit text doesn't push the cursor // off to the left @@ -1740,7 +1740,7 @@ void QQuickTextInputPrivate::ensureVisible(int position, int preeditCursor, int void QQuickTextInputPrivate::updateHorizontalScroll() { if (autoScroll && m_echoMode != QQuickTextInput::NoEcho) { -#ifndef QT_NO_IM +#if QT_CONFIG(im) const int preeditLength = m_textLayout.preeditAreaText().length(); ensureVisible(m_cursor, m_preeditCursor, preeditLength); #else @@ -1754,7 +1754,7 @@ void QQuickTextInputPrivate::updateHorizontalScroll() void QQuickTextInputPrivate::updateVerticalScroll() { Q_Q(QQuickTextInput); -#ifndef QT_NO_IM +#if QT_CONFIG(im) const int preeditLength = m_textLayout.preeditAreaText().length(); #endif const qreal height = qMax(0, q->height() - q->topPadding() - q->bottomPadding()); @@ -1766,7 +1766,7 @@ void QQuickTextInputPrivate::updateVerticalScroll() vscroll = -QQuickTextUtil::alignedY( heightUsed, height, vAlign & ~(Qt::AlignAbsolute|Qt::AlignHorizontal_Mask)); } else { -#ifndef QT_NO_IM +#if QT_CONFIG(im) QTextLine currentLine = m_textLayout.lineForTextPosition(m_cursor + preeditLength); #else QTextLine currentLine = m_textLayout.lineForTextPosition(m_cursor); @@ -1786,7 +1786,7 @@ void QQuickTextInputPrivate::updateVerticalScroll() // right vscroll = heightUsed - height; } -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (preeditLength > 0) { // check to ensure long pre-edit text doesn't push the cursor // off the top @@ -1827,7 +1827,7 @@ void QQuickTextInput::ensureActiveFocus() { bool hadActiveFocus = hasActiveFocus(); forceActiveFocus(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) Q_D(QQuickTextInput); // re-open input panel on press if already focused if (hasActiveFocus() && hadActiveFocus && !d->m_readOnly) @@ -1877,7 +1877,7 @@ QSGNode *QQuickTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData } if (!d->m_textLayout.text().isEmpty() -#ifndef QT_NO_IM +#if QT_CONFIG(im) || !d->m_textLayout.preeditAreaText().isEmpty() #endif ) { @@ -1900,7 +1900,7 @@ QSGNode *QQuickTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData return node; } -#ifndef QT_NO_IM +#if QT_CONFIG(im) QVariant QQuickTextInput::inputMethodQuery(Qt::InputMethodQuery property) const { return inputMethodQuery(property, QVariant()); @@ -1957,7 +1957,7 @@ QVariant QQuickTextInput::inputMethodQuery(Qt::InputMethodQuery property, QVaria return QQuickItem::inputMethodQuery(property); } } -#endif // QT_NO_IM +#endif // im /*! \qmlmethod QtQuick::TextInput::deselect() @@ -1997,7 +1997,7 @@ bool QQuickTextInput::isRightToLeft(int start, int end) } } -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) /*! \qmlmethod QtQuick::TextInput::cut() @@ -2042,7 +2042,7 @@ void QQuickTextInput::paste() if (!d->m_readOnly) d->paste(); } -#endif // QT_NO_CLIPBOARD +#endif // clipboard /*! \qmlmethod QtQuick::TextInput::undo() @@ -2416,7 +2416,7 @@ void QQuickTextInput::setPersistentSelection(bool on) */ bool QQuickTextInput::canPaste() const { -#if !defined(QT_NO_CLIPBOARD) +#if QT_CONFIG(clipboard) Q_D(const QQuickTextInput); if (!d->canPasteValid) { if (const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData()) @@ -2597,7 +2597,7 @@ void QQuickTextInputPrivate::handleFocusEvent(QFocusEvent *event) } if (focus) { q->q_updateAlignment(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (focusOnPress && !m_readOnly) qGuiApp->inputMethod()->show(); q->connect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)), @@ -2617,7 +2617,7 @@ void QQuickTextInputPrivate::handleFocusEvent(QFocusEvent *event) if (hasAcceptableInput(m_text) == AcceptableInput || fixup()) emit q->editingFinished(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) q->disconnect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)), q, SLOT(q_updateAlignment())); #endif @@ -2645,7 +2645,7 @@ void QQuickTextInput::focusOutEvent(QFocusEvent *event) */ bool QQuickTextInput::isInputMethodComposing() const { -#ifdef QT_NO_IM +#if !QT_CONFIG(im) return false; #else Q_D(const QQuickTextInput); @@ -2670,21 +2670,21 @@ QQuickTextInputPrivate::ExtraData::ExtraData() void QQuickTextInputPrivate::init() { Q_Q(QQuickTextInput); -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) if (QGuiApplication::clipboard()->supportsSelection()) q->setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton); else #endif q->setAcceptedMouseButtons(Qt::LeftButton); -#ifndef QT_NO_IM +#if QT_CONFIG(im) q->setFlag(QQuickItem::ItemAcceptsInputMethod); #endif q->setFlag(QQuickItem::ItemHasContents); -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) qmlobject_connect(QGuiApplication::clipboard(), QClipboard, SIGNAL(dataChanged()), q, QQuickTextInput, SLOT(q_canPasteChanged())); -#endif // QT_NO_CLIPBOARD +#endif // clipboard lastSelectionStart = 0; lastSelectionEnd = 0; @@ -2723,7 +2723,7 @@ void QQuickTextInput::updateCursorRectangle(bool scroll) d->cursorItem->setPosition(r.topLeft()); d->cursorItem->setHeight(r.height()); } -#ifndef QT_NO_IM +#if QT_CONFIG(im) updateInputMethod(Qt::ImCursorRectangle | Qt::ImAnchorRectangle); #endif } @@ -2783,7 +2783,7 @@ void QQuickTextInput::q_canPasteChanged() { Q_D(QQuickTextInput); bool old = d->canPaste; -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) if (const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData()) d->canPaste = !d->m_readOnly && mimeData->hasText(); else @@ -2877,7 +2877,7 @@ qreal QQuickTextInputPrivate::getImplicitWidth() const option.setAlignment(Qt::Alignment(q->effectiveHAlign())); layout.setTextOption(option); layout.setFont(font); -#ifndef QT_NO_IM +#if QT_CONFIG(im) layout.setPreeditArea(m_textLayout.preeditAreaPosition(), m_textLayout.preeditAreaText()); #endif layout.beginLayout(); @@ -3054,7 +3054,7 @@ void QQuickTextInputPrivate::updateBaselineOffset() q->setBaselineOffset(fm.ascent() + yoff + q->topPadding()); } -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) /*! \internal @@ -3091,9 +3091,9 @@ void QQuickTextInputPrivate::paste(QClipboard::Mode clipboardMode) } } -#endif // !QT_NO_CLIPBOARD +#endif // clipboard -#ifndef QT_NO_IM +#if QT_CONFIG(im) /*! \internal */ @@ -3125,7 +3125,7 @@ void QQuickTextInputPrivate::cancelPreedit() QInputMethodEvent ev; QCoreApplication::sendEvent(q, &ev); } -#endif // QT_NO_IM +#endif // im /*! \internal @@ -3225,7 +3225,7 @@ void QQuickTextInputPrivate::clear() void QQuickTextInputPrivate::setSelection(int start, int length) { Q_Q(QQuickTextInput); -#ifndef QT_NO_IM +#if QT_CONFIG(im) commitPreedit(); #endif @@ -3257,7 +3257,7 @@ void QQuickTextInputPrivate::setSelection(int start, int length) } emit q->selectionChanged(); emitCursorPositionChanged(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) q->updateInputMethod(Qt::ImCursorRectangle | Qt::ImAnchorRectangle | Qt::ImCursorPosition | Qt::ImAnchorPosition | Qt::ImCurrentSelection); #endif @@ -3287,7 +3287,7 @@ void QQuickTextInputPrivate::updatePasswordEchoEditing(bool editing) */ bool QQuickTextInputPrivate::fixup() // this function assumes that validate currently returns != Acceptable { -#ifndef QT_NO_VALIDATOR +#if QT_CONFIG(validator) if (m_validator) { QString textCopy = m_text; int cursorCopy = m_cursor; @@ -3311,7 +3311,7 @@ bool QQuickTextInputPrivate::fixup() // this function assumes that validate curr void QQuickTextInputPrivate::moveCursor(int pos, bool mark) { Q_Q(QQuickTextInput); -#ifndef QT_NO_IM +#if QT_CONFIG(im) commitPreedit(); #endif @@ -3339,12 +3339,12 @@ void QQuickTextInputPrivate::moveCursor(int pos, bool mark) emit q->selectionChanged(); } emitCursorPositionChanged(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) q->updateInputMethod(); #endif } -#ifndef QT_NO_IM +#if QT_CONFIG(im) /*! \internal @@ -3461,7 +3461,7 @@ void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event) | Qt::ImCurrentSelection); } } -#endif // QT_NO_IM +#endif // im /*! \internal @@ -3501,7 +3501,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo Q_Q(QQuickTextInput); Q_UNUSED(update) -#ifndef QT_NO_IM +#if QT_CONFIG(im) bool inputMethodAttributesChanged = m_textDirty || m_selDirty; #endif bool alignmentChanged = false; @@ -3513,7 +3513,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo bool wasAcceptable = m_acceptableInput; m_validInput = true; m_acceptableInput = true; -#ifndef QT_NO_VALIDATOR +#if QT_CONFIG(validator) if (m_validator) { QString textCopy = m_text; int cursorCopy = m_cursor; @@ -3563,7 +3563,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo if (m_textDirty) { textChanged = true; m_textDirty = false; -#ifndef QT_NO_IM +#if QT_CONFIG(im) m_preeditDirty = false; #endif alignmentChanged = determineHorizontalAlignment(); @@ -3575,7 +3575,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo if (m_acceptableInput != wasAcceptable) emit q->acceptableInputChanged(); } -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (m_preeditDirty) { m_preeditDirty = false; if (determineHorizontalAlignment()) { @@ -3590,7 +3590,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo emit q->selectionChanged(); } -#ifndef QT_NO_IM +#if QT_CONFIG(im) inputMethodAttributesChanged |= (m_cursor != m_lastCursorPos); if (inputMethodAttributesChanged) q->updateInputMethod(); @@ -3624,7 +3624,7 @@ void QQuickTextInputPrivate::internalSetText(const QString &txt, int pos, bool e m_textDirty = (oldText != m_text); bool changed = finishChange(-1, true, edited); -#ifdef QT_NO_ACCESSIBILITY +#if !QT_CONFIG(accessibility) Q_UNUSED(changed) #else Q_Q(QQuickTextInput); @@ -3969,7 +3969,7 @@ bool QQuickTextInputPrivate::isValidInput(QChar key, QChar mask) const */ QQuickTextInputPrivate::ValidatorState QQuickTextInputPrivate::hasAcceptableInput(const QString &str) const { -#ifndef QT_NO_VALIDATOR +#if QT_CONFIG(validator) QString textCopy = str; int cursorCopy = m_cursor; if (m_validator) { @@ -4279,7 +4279,7 @@ bool QQuickTextInputPrivate::emitCursorPositionChanged() } } -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) if (QAccessible::isActive()) { if (QObject *acc = QQuickAccessibleAttached::findAccessible(q, QAccessible::EditableText)) { QAccessibleTextCursorEvent ev(acc, m_cursor); @@ -4390,7 +4390,7 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event) if (false) { } -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) else if (event == QKeySequence::Undo) { q->undo(); } @@ -4400,7 +4400,7 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event) else if (event == QKeySequence::SelectAll) { selectAll(); } -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) else if (event == QKeySequence::Copy) { copy(); } @@ -4417,7 +4417,7 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event) if (!m_readOnly) deleteEndOfLine(); } -#endif //QT_NO_CLIPBOARD +#endif // clipboard else if (event == QKeySequence::MoveToStartOfLine || event == QKeySequence::MoveToStartOfBlock) { home(0); } @@ -4489,13 +4489,13 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event) } else if (event == QKeySequence::DeleteCompleteLine) { if (!m_readOnly) { selectAll(); -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) copy(); #endif del(); } } -#endif // QT_NO_SHORTCUT +#endif // shortcut else { bool handled = false; if (event->modifiers() & Qt::ControlModifier) { diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h index d0461f551e..f4545e1574 100644 --- a/src/quick/items/qquicktextinput_p.h +++ b/src/quick/items/qquicktextinput_p.h @@ -266,7 +266,7 @@ public: bool hasAcceptableInput() const; -#ifndef QT_NO_IM +#if QT_CONFIG(im) QVariant inputMethodQuery(Qt::InputMethodQuery property) const Q_DECL_OVERRIDE; Q_REVISION(3) Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const; #endif @@ -372,7 +372,7 @@ protected: void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void keyPressEvent(QKeyEvent* ev) Q_DECL_OVERRIDE; -#ifndef QT_NO_IM +#if QT_CONFIG(im) void inputMethodEvent(QInputMethodEvent *) Q_DECL_OVERRIDE; #endif void mouseUngrabEvent() Q_DECL_OVERRIDE; @@ -389,7 +389,7 @@ public Q_SLOTS: void select(int start, int end); void deselect(); bool isRightToLeft(int start, int end); -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) void cut(); void copy(); void paste(); @@ -409,7 +409,7 @@ private Q_SLOTS: void q_updateAlignment(); void triggerPreprocess(); -#ifndef QT_NO_VALIDATOR +#if QT_CONFIG(validator) void q_validatorChanged(); #endif diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h index 93a8778c40..d1aaefa6a7 100644 --- a/src/quick/items/qquicktextinput_p_p.h +++ b/src/quick/items/qquicktextinput_p_p.h @@ -104,7 +104,7 @@ public: , selectionColor(QRgb(0xFF000080)) , selectedTextColor(QRgb(0xFFFFFFFF)) , m_cursor(0) -#ifndef QT_NO_IM +#if QT_CONFIG(im) , m_preeditCursor(0) #endif , m_blinkEnabled(false) @@ -114,7 +114,7 @@ public: , m_undoState(0) , m_selstart(0) , m_selend(0) -#ifndef QT_NO_IM +#if QT_CONFIG(im) , inputMethodHints(Qt::ImhNone) #endif , hAlign(QQuickTextInput::AlignLeft) @@ -148,7 +148,7 @@ public: , m_separator(0) , m_readOnly(0) , m_textDirty(0) -#ifndef QT_NO_IM +#if QT_CONFIG(im) , m_preeditDirty(0) #endif , m_selDirty(0) @@ -176,7 +176,7 @@ public: bool setHAlign(QQuickTextInput::HAlignment, bool forceAlign = false); void mirrorChange() Q_DECL_OVERRIDE; bool sendMouseEventToInputContext(QMouseEvent *event); -#ifndef QT_NO_IM +#if QT_CONFIG(im) Qt::InputMethodHints effectiveInputMethodHints() const; #endif void handleFocusEvent(QFocusEvent *event); @@ -211,7 +211,7 @@ public: QPointF tripleClickStartPoint; QPointer cursorComponent; -#ifndef QT_NO_VALIDATOR +#if QT_CONFIG(validator) QPointer m_validator; #endif @@ -240,7 +240,7 @@ public: int lastSelectionStart; int lastSelectionEnd; int m_cursor; -#ifndef QT_NO_IM +#if QT_CONFIG(im) int m_preeditCursor; #endif bool m_blinkEnabled; @@ -257,7 +257,7 @@ public: UpdatePaintNode }; -#ifndef QT_NO_IM +#if QT_CONFIG(im) Qt::InputMethodHints inputMethodHints; #endif QQuickTextInput::HAlignment hAlign; @@ -290,7 +290,7 @@ public: bool m_separator : 1; bool m_readOnly : 1; bool m_textDirty : 1; -#ifndef QT_NO_IM +#if QT_CONFIG(im) bool m_preeditDirty : 1; #endif bool m_selDirty : 1; @@ -362,12 +362,12 @@ public: QString realText() const; -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) void copy(QClipboard::Mode mode = QClipboard::Clipboard) const; void paste(QClipboard::Mode mode = QClipboard::Clipboard); #endif -#ifndef QT_NO_IM +#if QT_CONFIG(im) void commitPreedit(); void cancelPreedit(); #endif @@ -419,7 +419,7 @@ public: } // input methods -#ifndef QT_NO_IM +#if QT_CONFIG(im) bool composeMode() const { return !m_textLayout.preeditAreaText().isEmpty(); } QString preeditAreaText() const { return m_textLayout.preeditAreaText(); } @@ -441,7 +441,7 @@ public: } } -#ifndef QT_NO_IM +#if QT_CONFIG(im) void processInputMethodEvent(QInputMethodEvent *event); #endif void processKeyEvent(QKeyEvent* ev); @@ -496,7 +496,7 @@ private: void deleteEndOfLine(); enum ValidatorState { -#ifndef QT_NO_VALIDATOR +#if QT_CONFIG(validator) InvalidInput = QValidator::Invalid, IntermediateInput = QValidator::Intermediate, AcceptableInput = QValidator::Acceptable diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp index e6ac9b603e..cf4e71adf5 100644 --- a/src/quick/items/qquicktextnode.cpp +++ b/src/quick/items/qquicktextnode.cpp @@ -237,7 +237,7 @@ void QQuickTextNode::addTextLayout(const QPointF &position, QTextLayout *textLay engine.setAnchorColor(anchorColor); engine.setPosition(position); -#ifndef QT_NO_IM +#if QT_CONFIG(im) int preeditLength = textLayout->preeditAreaText().length(); int preeditPosition = textLayout->preeditAreaPosition(); #endif @@ -256,7 +256,7 @@ void QQuickTextNode::addTextLayout(const QPointF &position, QTextLayout *textLay int length = line.textLength(); int end = start + length; -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (preeditPosition >= 0 && preeditPosition >= start && preeditPosition < end) { diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp index 538356e679..c179ab7163 100644 --- a/src/quick/items/qquicktextnodeengine.cpp +++ b/src/quick/items/qquicktextnodeengine.cpp @@ -950,7 +950,7 @@ void QQuickTextNodeEngine::mergeFormats(QTextLayout *textLayout, QVarLengthArray void QQuickTextNodeEngine::addTextBlock(QTextDocument *textDocument, const QTextBlock &block, const QPointF &position, const QColor &textColor, const QColor &anchorColor, int selectionStart, int selectionEnd) { Q_ASSERT(textDocument); -#ifndef QT_NO_IM +#if QT_CONFIG(im) int preeditLength = block.isValid() ? block.layout()->preeditAreaText().length() : 0; int preeditPosition = block.isValid() ? block.layout()->preeditAreaPosition() : -1; #endif @@ -1070,7 +1070,7 @@ void QQuickTextNodeEngine::addTextBlock(QTextDocument *textDocument, const QText setTextColor(textColor); int fragmentEnd = textPos + fragment.length(); -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (preeditPosition >= 0 && (preeditPosition + block.position()) >= textPos && (preeditPosition + block.position()) <= fragmentEnd) { @@ -1092,7 +1092,7 @@ void QQuickTextNodeEngine::addTextBlock(QTextDocument *textDocument, const QText ++blockIterator; } -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (preeditLength >= 0 && textPos <= block.position() + preeditPosition) { setPosition(blockPosition); textPos = block.position() + preeditPosition; diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 1297dded8c..ef079fdf92 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -74,7 +74,7 @@ #include #include #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include # include #endif @@ -95,7 +95,7 @@ bool QQuickWindowPrivate::defaultAlphaBuffer = false; void QQuickWindowPrivate::updateFocusItemTransform() { -#ifndef QT_NO_IM +#if QT_CONFIG(im) Q_Q(QQuickWindow); QQuickItem *focus = q->activeFocusItem(); if (focus && QGuiApplication::focusObject() == focus) { @@ -172,7 +172,7 @@ private: #include "qquickwindow.moc" -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) /*! Returns an accessibility interface for this window, or 0 if such an interface cannot be created. @@ -256,7 +256,7 @@ void QQuickWindow::focusInEvent(QFocusEvent *ev) d->updateFocusItemTransform(); } -#ifndef QT_NO_IM +#if QT_CONFIG(im) static bool transformDirtyOnItemOrAncestor(const QQuickItem *item) { while (item) { @@ -297,7 +297,7 @@ void QQuickWindowPrivate::polishItems() if (recursionSafeguard == 0) qWarning("QQuickWindow: possible QQuickItem::polish() loop"); -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (QQuickItem *focusItem = q_func()->activeFocusItem()) { // If the current focus item, or any of its anchestors, has changed location // inside the window, we need inform IM about it. This to ensure that overlays @@ -471,10 +471,10 @@ void QQuickWindowPrivate::renderSceneGraph(const QSize &size) QQuickWindowPrivate::QQuickWindowPrivate() : contentItem(0) , activeFocusItem(0) -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) , cursorItem(0) #endif -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) , dragGrabber(0) #endif , touchMouseId(-1) @@ -500,7 +500,7 @@ QQuickWindowPrivate::QQuickWindowPrivate() , vaoHelper(0) , incubationController(0) { -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) dragGrabber = new QQuickDragGrabber; #endif } @@ -894,7 +894,7 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, Q } if (oldActiveFocusItem) { -#ifndef QT_NO_IM +#if QT_CONFIG(im) QGuiApplication::inputMethod()->commit(); #endif @@ -1000,7 +1000,7 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item, oldActiveFocusItem = activeFocusItem; newActiveFocusItem = scope; -#ifndef QT_NO_IM +#if QT_CONFIG(im) QGuiApplication::inputMethod()->commit(); #endif @@ -1276,7 +1276,7 @@ QQuickWindow::~QQuickWindow() } delete d->incubationController; d->incubationController = 0; -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) delete d->dragGrabber; d->dragGrabber = 0; #endif delete d->contentItem; d->contentItem = 0; @@ -1545,7 +1545,7 @@ bool QQuickWindow::event(QEvent *e) d->clearHover(); d->lastMousePosition = QPointF(); break; -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) case QEvent::DragEnter: case QEvent::DragLeave: case QEvent::DragMove: @@ -1565,7 +1565,7 @@ bool QQuickWindow::event(QEvent *e) e->setAccepted(qev.isAccepted()); } break; case QEvent::FocusAboutToChange: -#ifndef QT_NO_IM +#if QT_CONFIG(im) if (d->activeFocusItem) qGuiApp->inputMethod()->commit(); #endif @@ -1577,7 +1577,7 @@ bool QQuickWindow::event(QEvent *e) d->windowManager->handleUpdateRequest(this); break; } -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) case QEvent::NativeGesture: d->deliverNativeGestureEvent(d->contentItem, static_cast(e)); break; @@ -1774,7 +1774,7 @@ bool QQuickWindowPrivate::deliverHoverEvent(QQuickItem *item, const QPointF &sce return false; } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) bool QQuickWindowPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event) { QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); @@ -1828,9 +1828,9 @@ void QQuickWindow::wheelEvent(QWheelEvent *event) d->deliverWheelEvent(d->contentItem, event); d->lastWheelEventAccepted = event->isAccepted(); } -#endif // QT_NO_WHEELEVENT +#endif // wheelevent -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) bool QQuickWindowPrivate::deliverNativeGestureEvent(QQuickItem *item, QNativeGestureEvent *event) { QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); @@ -1862,7 +1862,7 @@ bool QQuickWindowPrivate::deliverNativeGestureEvent(QQuickItem *item, QNativeGes return false; } -#endif // QT_NO_GESTURES +#endif // gestures bool QQuickWindowPrivate::deliverTouchCancelEvent(QTouchEvent *event) { @@ -2043,7 +2043,7 @@ void QQuickWindowPrivate::handleMouseEvent(QMouseEvent *event) qCDebug(DBG_HOVER_TRACE) << this; - #ifndef QT_NO_CURSOR + #if QT_CONFIG(cursor) updateCursor(event->windowPos()); #endif @@ -2358,7 +2358,7 @@ bool QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QQuickPo return eventAccepted; } -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) void QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QEvent *event) { grabber->resetTarget(); @@ -2479,9 +2479,9 @@ bool QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QQuickIte return accepted; } -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) void QQuickWindowPrivate::updateCursor(const QPointF &scenePos) { Q_Q(QQuickWindow); @@ -3184,7 +3184,7 @@ void QQuickWindow::maybeUpdate() void QQuickWindow::cleanupSceneGraph() { Q_D(QQuickWindow); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) delete d->vaoHelper; d->vaoHelper = 0; #endif @@ -3223,7 +3223,7 @@ void QQuickWindow::setTransientParent_helper(QQuickWindow *window) QOpenGLContext *QQuickWindow::openglContext() const { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) Q_D(const QQuickWindow); if (d->context && d->context->isValid()) { QSGRendererInterface *rif = d->context->sceneGraphContext()->rendererInterface(d->context); @@ -3351,7 +3351,7 @@ bool QQuickWindow::isSceneGraphInitialized() const The corresponding handler is \c onClosing. */ -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) /*! Sets the render target for this window to be \a fbo. @@ -3439,7 +3439,7 @@ QSize QQuickWindow::renderTargetSize() const -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) /*! Returns the render target for this window. @@ -3478,7 +3478,7 @@ QImage QQuickWindow::grabWindow() return d->windowManager->grab(this); } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (!isVisible() && !d->renderControl) { auto openglRenderContext = static_cast(d->context); if (!openglRenderContext->openglContext()) { @@ -3836,7 +3836,7 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image, CreateText */ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, CreateTextureOptions options) const { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (openglContext()) { QSGPlainTexture *texture = new QSGPlainTexture(); texture->setTextureId(id); @@ -3919,7 +3919,7 @@ void QQuickWindow::setDefaultAlphaBuffer(bool useAlpha) { QQuickWindowPrivate::defaultAlphaBuffer = useAlpha; } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) /*! \since 5.2 diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h index cfadadec2d..c1f690f325 100644 --- a/src/quick/items/qquickwindow.h +++ b/src/quick/items/qquickwindow.h @@ -114,19 +114,19 @@ public: bool sendEvent(QQuickItem *, QEvent *); QImage grabWindow(); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) void setRenderTarget(QOpenGLFramebufferObject *fbo); QOpenGLFramebufferObject *renderTarget() const; #endif void setRenderTarget(uint fboId, const QSize &size); uint renderTargetId() const; QSize renderTargetSize() const; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) void resetOpenGLState(); #endif QQmlIncubationController *incubationController() const; -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QAccessibleInterface *accessibleRoot() const Q_DECL_OVERRIDE; #endif @@ -208,7 +208,7 @@ protected: void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; void mouseDoubleClickEvent(QMouseEvent *) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE; #endif diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index 3328eb65c4..32a6939868 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -125,10 +125,10 @@ public: void deliverKeyEvent(QKeyEvent *e); // Keeps track of the item currently receiving mouse events -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) QQuickItem *cursorItem; #endif -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QQuickDragGrabber *dragGrabber; #endif int touchMouseId; @@ -146,10 +146,10 @@ public: static QMouseEvent *cloneMouseEvent(QMouseEvent *event, QPointF *transformedLocalPos = 0); void deliverMouseEvent(QQuickPointerMouseEvent *pointerEvent); bool sendFilteredMouseEvent(QQuickItem *, QQuickItem *, QEvent *, QSet *); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) bool deliverWheelEvent(QQuickItem *, QWheelEvent *); #endif -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) bool deliverNativeGestureEvent(QQuickItem *, QNativeGestureEvent *); #endif @@ -179,11 +179,11 @@ public: Qt::KeyboardModifiers modifiers, ulong timestamp, bool accepted); bool clearHover(ulong timestamp = 0); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) void deliverDragEvent(QQuickDragGrabber *, QEvent *); bool deliverDragEvent(QQuickDragGrabber *, QQuickItem *, QDragMoveEvent *); #endif -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) void updateCursor(const QPointF &scenePos); QQuickItem *findCursorItem(QQuickItem *item, const QPointF &scenePos); #endif diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp index 9a50250ebb..1f9305ccba 100644 --- a/src/quick/qtquick2.cpp +++ b/src/quick/qtquick2.cpp @@ -196,7 +196,7 @@ void QQmlQtQuick2Module::defineModule() QQuickValueTypes::registerValueTypes(); -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QAccessible::installFactory(&qQuickAccessibleFactory); #endif diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index b43a2bc2ba..a278c6079b 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -39,7 +39,7 @@ #include "qsggeometry.h" #include "qsggeometry_p.h" -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include # include # include @@ -441,7 +441,7 @@ QSGGeometry::QSGGeometry(const QSGGeometry::AttributeSet &attributes, Q_UNUSED(m_reserved_bits); Q_ASSERT(m_attributes.count > 0); Q_ASSERT(m_attributes.stride > 0); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) Q_ASSERT_X(indexType != GL_UNSIGNED_INT || static_cast(QOpenGLContext::currentContext()->functions()) ->hasOpenGLExtension(QOpenGLExtensions::ElementIndexUint), diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp index 13598bbe1d..d2d27cd9aa 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp +++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp @@ -40,7 +40,7 @@ #include "qsgmaterial.h" #include "qsgrenderer_p.h" #include "qsgmaterialshader_p.h" -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include # include # include @@ -64,7 +64,7 @@ void qsg_set_material_failure() qsg_material_failure = true; } #endif -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) const char *QSGMaterialShaderPrivate::loadShaderSource(QOpenGLShader::ShaderType type) const { const QStringList files = m_sourceFiles[type]; @@ -227,7 +227,7 @@ QSGMaterialShader::~QSGMaterialShader() defines the attribute register position in the vertex shader. */ -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) /*! \fn const char *QSGMaterialShader::vertexShader() const @@ -320,7 +320,7 @@ void QSGMaterialShader::updateState(const RenderState & /* state */, QSGMaterial { } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) /*! Sets the GLSL source file for the shader stage \a type to \a sourceFile. The default implementation of the vertexShader() and fragmentShader() functions @@ -550,7 +550,7 @@ QRect QSGMaterialShader::RenderState::deviceRect() const return static_cast(m_data)->deviceRect(); } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) /*! Returns the QOpenGLContext that is being used for rendering diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.h b/src/quick/scenegraph/coreapi/qsgmaterial.h index 114651653f..c002cd5d5e 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterial.h +++ b/src/quick/scenegraph/coreapi/qsgmaterial.h @@ -41,7 +41,7 @@ #define QSGMATERIAL_H #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include #endif #include @@ -84,7 +84,7 @@ public: QRect deviceRect() const; float determinant() const; float devicePixelRatio() const; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QOpenGLContext *context() const; #endif private: @@ -101,7 +101,7 @@ public: // First time a material is used, oldMaterial is null. virtual void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial); virtual char const *const *attributeNames() const = 0; // Array must end with null. -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) inline QOpenGLShaderProgram *program() { return &m_program; } #endif protected: @@ -110,19 +110,19 @@ protected: friend class QSGDefaultRenderContext; friend class QSGBatchRenderer::ShaderManager; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) void setShaderSourceFile(QOpenGLShader::ShaderType type, const QString &sourceFile); void setShaderSourceFiles(QOpenGLShader::ShaderType type, const QStringList &sourceFiles); virtual void compile(); #endif virtual void initialize() { } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) virtual const char *vertexShader() const; virtual const char *fragmentShader() const; #endif private: -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QOpenGLShaderProgram m_program; #endif QScopedPointer d_ptr; diff --git a/src/quick/scenegraph/coreapi/qsgmaterialshader_p.h b/src/quick/scenegraph/coreapi/qsgmaterialshader_p.h index 0dbce010db..47f5e5de09 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterialshader_p.h +++ b/src/quick/scenegraph/coreapi/qsgmaterialshader_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE class Q_QUICK_PRIVATE_EXPORT QSGMaterialShaderPrivate { public: -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) const char *loadShaderSource(QOpenGLShader::ShaderType type) const; QHash m_sourceFiles; diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp index 34cdfc0a6d..e5d464930c 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp @@ -39,7 +39,7 @@ #include "qsgrenderer_p.h" #include "qsgnodeupdater_p.h" -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include # include # include @@ -67,7 +67,7 @@ int qt_sg_envInt(const char *name, int defaultValue) void QSGBindable::clear(QSGAbstractRenderer::ClearMode mode) const { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) GLuint bits = 0; if (mode & QSGAbstractRenderer::ClearColorBuffer) bits |= GL_COLOR_BUFFER_BIT; if (mode & QSGAbstractRenderer::ClearDepthBuffer) bits |= GL_DEPTH_BUFFER_BIT; @@ -81,11 +81,11 @@ void QSGBindable::clear(QSGAbstractRenderer::ClearMode mode) const // Reactivate the color buffer after switching to the stencil. void QSGBindable::reactivate() const { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QOpenGLContext::currentContext()->functions()->glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); #endif } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QSGBindableFboId::QSGBindableFboId(GLuint id) : m_id(id) { @@ -181,7 +181,7 @@ bool QSGRenderer::isMirrored() const void QSGRenderer::renderScene(uint fboId) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (fboId) { QSGBindableFboId bindable(fboId); renderScene(bindable); @@ -223,7 +223,7 @@ void QSGRenderer::renderScene(const QSGBindable &bindable) Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame, QQuickProfiler::SceneGraphRendererBinding); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) // Sanity check that attribute registers are disabled if (qsg_sanity_check) { GLint count = 0; diff --git a/src/quick/scenegraph/coreapi/qsgrenderer_p.h b/src/quick/scenegraph/coreapi/qsgrenderer_p.h index 94b78a85b4..26e29d414d 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgrenderer_p.h @@ -133,7 +133,7 @@ public: virtual void clear(QSGAbstractRenderer::ClearMode mode) const; virtual void reactivate() const; }; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) class QSGBindableFboId : public QSGBindable { public: diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp index 84ca09285a..412023564f 100644 --- a/src/quick/scenegraph/qsgadaptationlayer.cpp +++ b/src/quick/scenegraph/qsgadaptationlayer.cpp @@ -73,7 +73,7 @@ QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(QSGDistanceFieldGlyphCach // this allows us to call pathForGlyph once and reuse the result. m_referenceFont.setPixelSize(QT_DISTANCEFIELD_BASEFONTSIZE(m_doubleGlyphResolution) * QT_DISTANCEFIELD_SCALE(m_doubleGlyphResolution)); Q_ASSERT(m_referenceFont.isValid()); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) m_coreProfile = (c->format().profile() == QSurfaceFormat::CoreProfile); #else Q_UNUSED(c) diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp index 7fab9aeae8..635308c38a 100644 --- a/src/quick/scenegraph/qsgcontextplugin.cpp +++ b/src/quick/scenegraph/qsgcontextplugin.cpp @@ -45,7 +45,7 @@ // Built-in adaptations #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) #include #endif @@ -62,7 +62,7 @@ QSGContextPlugin::~QSGContextPlugin() { } -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QSGContextFactoryInterface_iid, QLatin1String("/scenegraph"))) #endif @@ -128,7 +128,7 @@ QSGAdaptationBackendData *contextFactory() if (requestedBackend.isEmpty() && qEnvironmentVariableIsSet("QT_QUICK_BACKEND")) requestedBackend = QString::fromLocal8Bit(qgetenv("QT_QUICK_BACKEND")); -#ifdef QT_NO_OPENGL +#if !QT_CONFIG(opengl) // If this is a build without OpenGL, and no backend has been set // default to the software renderer if (requestedBackend.isEmpty()) @@ -148,7 +148,7 @@ QSGAdaptationBackendData *contextFactory() } } -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) // Then try the plugins. if (!backendData->factory) { const int index = loader()->indexOf(requestedBackend); @@ -165,7 +165,7 @@ QSGAdaptationBackendData *contextFactory() qPrintable(QLibraryInfo::location(QLibraryInfo::PluginsPath))); } } -#endif // QT_NO_LIBRARY +#endif // library } } @@ -185,7 +185,7 @@ QSGContext *QSGContext::createDefaultContext() QSGAdaptationBackendData *backendData = contextFactory(); if (backendData->factory) return backendData->factory->create(backendData->name); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) return new QSGDefaultContext(); #else return nullptr; diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 5bd1adc1f7..ec874f6ff0 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -58,7 +58,7 @@ #include #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include # include #if QT_CONFIG(quick_shadereffect) @@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE extern bool qsg_useConsistentTiming(); extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) /*! expectations for this manager to work: - one opengl context to render multiple windows @@ -119,7 +119,7 @@ void QSGRenderLoop::cleanup() void QSGRenderLoop::postJob(QQuickWindow *window, QRunnable *job) { Q_ASSERT(job); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) Q_ASSERT(window); if (window->openglContext()) { window->openglContext()->makeCurrent(window); @@ -131,7 +131,7 @@ void QSGRenderLoop::postJob(QQuickWindow *window, QRunnable *job) #endif delete job; } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) class QSGGuiThreadRenderLoop : public QSGRenderLoop { Q_OBJECT @@ -182,7 +182,7 @@ QSGRenderLoop *QSGRenderLoop::instance() const_cast(QSG_LOG_INFO()).setEnabled(QtDebugMsg, true); s_instance = QSGContext::createWindowManager(); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (!s_instance) { enum RenderLoopType { @@ -272,7 +272,7 @@ void QSGRenderLoop::handleContextCreationFailure(QQuickWindow *window, if (!signalEmitted) qFatal("%s", qPrintable(untranslatedMessage)); } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QSGGuiThreadRenderLoop::QSGGuiThreadRenderLoop() : gl(0) { diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp index 79e43e3820..9ca9cdb107 100644 --- a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp +++ b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp @@ -40,7 +40,7 @@ #include "qsgdistancefieldutil_p.h" #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include #endif #include diff --git a/src/quick/scenegraph/util/qsgengine.cpp b/src/quick/scenegraph/util/qsgengine.cpp index ad1fcfa470..09e4cdf5a7 100644 --- a/src/quick/scenegraph/util/qsgengine.cpp +++ b/src/quick/scenegraph/util/qsgengine.cpp @@ -44,7 +44,7 @@ #include #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include # include #endif @@ -116,7 +116,7 @@ QSGEngine::~QSGEngine() void QSGEngine::initialize(QOpenGLContext *context) { Q_D(QSGEngine); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (context && QOpenGLContext::currentContext() != context) { qWarning("WARNING: The context must be current before calling QSGEngine::initialize."); return; @@ -125,7 +125,7 @@ void QSGEngine::initialize(QOpenGLContext *context) if (d->sgRenderContext && !d->sgRenderContext->isValid()) { d->sgRenderContext->setAttachToGraphicsContext(false); d->sgRenderContext->initialize(context); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (context) connect(context, &QOpenGLContext::aboutToBeDestroyed, this, &QSGEngine::invalidate); #endif diff --git a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp index 2ce27275cd..8ab7669891 100644 --- a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp +++ b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp @@ -39,7 +39,7 @@ #include "qsgflatcolormaterial.h" #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include #endif @@ -57,7 +57,7 @@ public: private: virtual void initialize(); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) int m_matrix_id; int m_color_id; #endif @@ -68,7 +68,7 @@ QSGMaterialType FlatColorMaterialShader::type; FlatColorMaterialShader::FlatColorMaterialShader() : QSGMaterialShader(*new QSGMaterialShaderPrivate) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/flatcolor.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/flatcolor.frag")); #endif @@ -76,7 +76,7 @@ FlatColorMaterialShader::FlatColorMaterialShader() void FlatColorMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type()); QSGFlatColorMaterial *oldMaterial = static_cast(oldEffect); QSGFlatColorMaterial *newMaterial = static_cast(newEffect); @@ -109,7 +109,7 @@ char const *const *FlatColorMaterialShader::attributeNames() const void FlatColorMaterialShader::initialize() { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) m_matrix_id = program()->uniformLocation("matrix"); m_color_id = program()->uniformLocation("color"); #endif diff --git a/src/quick/scenegraph/util/qsgsimplematerial.h b/src/quick/scenegraph/util/qsgsimplematerial.h index d07a68e850..8f42599832 100644 --- a/src/quick/scenegraph/util/qsgsimplematerial.h +++ b/src/quick/scenegraph/util/qsgsimplematerial.h @@ -50,7 +50,7 @@ class QSGSimpleMaterialShader : public QSGMaterialShader public: void initialize() { QSGMaterialShader::initialize(); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) m_id_matrix = program()->uniformLocation(uniformMatrixName()); if (m_id_matrix < 0) { qFatal("QSGSimpleMaterialShader does not implement 'uniform highp mat4 %s;' in its vertex shader", @@ -197,7 +197,7 @@ QSGMaterialType QSGSimpleMaterial::m_type; template Q_INLINE_TEMPLATE void QSGSimpleMaterialShader::updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (state.isMatrixDirty()) program()->setUniformValue(m_id_matrix, state.combinedMatrix()); if (state.isOpacityDirty() && m_id_opacity >= 0) diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp index 436f97b1ff..47248f2f37 100644 --- a/src/quick/scenegraph/util/qsgtexture.cpp +++ b/src/quick/scenegraph/util/qsgtexture.cpp @@ -45,7 +45,7 @@ #include #include #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include # include # include @@ -70,7 +70,7 @@ #include #endif -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) static QElapsedTimer qsg_renderer_timer; #endif @@ -86,7 +86,7 @@ static const bool qsg_leak_check = !qEnvironmentVariableIsEmpty("QML_LEAK_CHECK" QT_BEGIN_NAMESPACE -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) inline static bool isPowerOfTwo(int x) { // Assumption: x >= 1 @@ -284,7 +284,7 @@ Q_GLOBAL_STATIC(QMutex, qsg_valid_texture_mutex) bool qsg_safeguard_texture(QSGTexture *texture) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QMutexLocker locker(qsg_valid_texture_mutex()); if (!qsg_valid_texture_set()->contains(texture)) { qWarning() << "Invalid texture accessed:" << (void *) texture; @@ -527,7 +527,7 @@ QSGTexture::WrapMode QSGTexture::verticalWrapMode() const */ void QSGTexture::updateBindOptions(bool force) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) Q_D(QSGTexture); QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); force |= isAtlasTexture(); @@ -582,7 +582,7 @@ QSGPlainTexture::QSGPlainTexture() QSGPlainTexture::~QSGPlainTexture() { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_texture_id && m_owns_texture && QOpenGLContext::currentContext()) QOpenGLContext::currentContext()->functions()->glDeleteTextures(1, &m_texture_id); #endif @@ -617,7 +617,7 @@ int QSGPlainTexture::textureId() const // or ~QSGPlainTexture so just keep it minimal here. return 0; } else if (m_texture_id == 0){ -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) // Generate a texture id for use later and return it. QOpenGLContext::currentContext()->functions()->glGenTextures(1, &const_cast(this)->m_texture_id); #endif @@ -629,7 +629,7 @@ int QSGPlainTexture::textureId() const void QSGPlainTexture::setTextureId(int id) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (m_texture_id && m_owns_texture) QOpenGLContext::currentContext()->functions()->glDeleteTextures(1, &m_texture_id); #endif @@ -643,7 +643,7 @@ void QSGPlainTexture::setTextureId(int id) void QSGPlainTexture::bind() { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QOpenGLContext *context = QOpenGLContext::currentContext(); QOpenGLFunctions *funcs = context->functions(); if (!m_dirty_texture) { diff --git a/src/quick/scenegraph/util/qsgtexture_p.h b/src/quick/scenegraph/util/qsgtexture_p.h index a0d7eb41e3..13c862eb88 100644 --- a/src/quick/scenegraph/util/qsgtexture_p.h +++ b/src/quick/scenegraph/util/qsgtexture_p.h @@ -53,7 +53,7 @@ #include #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include #endif #include "qsgtexture.h" diff --git a/src/quick/scenegraph/util/qsgtexturematerial.cpp b/src/quick/scenegraph/util/qsgtexturematerial.cpp index 119828bc81..9326ea640d 100644 --- a/src/quick/scenegraph/util/qsgtexturematerial.cpp +++ b/src/quick/scenegraph/util/qsgtexturematerial.cpp @@ -39,14 +39,14 @@ #include "qsgtexturematerial_p.h" #include "qsgtexture_p.h" -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include # include #endif QT_BEGIN_NAMESPACE -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) inline static bool isPowerOfTwo(int x) { // Assumption: x >= 1 @@ -59,7 +59,7 @@ QSGMaterialType QSGOpaqueTextureMaterialShader::type; QSGOpaqueTextureMaterialShader::QSGOpaqueTextureMaterialShader() : QSGMaterialShader() { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/opaquetexture.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/opaquetexture.frag")); #endif @@ -73,7 +73,7 @@ char const *const *QSGOpaqueTextureMaterialShader::attributeNames() const void QSGOpaqueTextureMaterialShader::initialize() { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) m_matrix_id = program()->uniformLocation("qt_Matrix"); #endif } @@ -95,7 +95,7 @@ void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMa t->setHorizontalWrapMode(tx->horizontalWrapMode()); t->setVerticalWrapMode(tx->verticalWrapMode()); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) bool npotSupported = const_cast(state.context()) ->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat); if (!npotSupported) { @@ -115,7 +115,7 @@ void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMa t->bind(); else t->updateBindOptions(); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (state.isMatrixDirty()) program()->setUniformValue(m_matrix_id, state.combinedMatrix()); #endif @@ -379,7 +379,7 @@ QSGMaterialShader *QSGTextureMaterial::createShader() const QSGTextureMaterialShader::QSGTextureMaterialShader() : QSGOpaqueTextureMaterialShader() { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/texture.frag")); #endif } @@ -387,7 +387,7 @@ QSGTextureMaterialShader::QSGTextureMaterialShader() void QSGTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) { Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type()); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (state.isOpacityDirty()) program()->setUniformValue(m_opacity_id, state.opacity()); #endif @@ -397,7 +397,7 @@ void QSGTextureMaterialShader::updateState(const RenderState &state, QSGMaterial void QSGTextureMaterialShader::initialize() { QSGOpaqueTextureMaterialShader::initialize(); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) m_opacity_id = program()->uniformLocation("opacity"); #endif } diff --git a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp index 847ec289d8..8c305d7fd4 100644 --- a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp +++ b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp @@ -38,7 +38,7 @@ ****************************************************************************/ #include "qsgvertexcolormaterial.h" -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include #endif QT_BEGIN_NAMESPACE @@ -55,7 +55,7 @@ public: private: virtual void initialize(); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) int m_matrix_id; int m_opacity_id; #endif @@ -66,7 +66,7 @@ QSGMaterialType QSGVertexColorMaterialShader::type; QSGVertexColorMaterialShader::QSGVertexColorMaterialShader() : QSGMaterialShader() { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/vertexcolor.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/vertexcolor.frag")); #endif @@ -74,7 +74,7 @@ QSGVertexColorMaterialShader::QSGVertexColorMaterialShader() void QSGVertexColorMaterialShader::updateState(const RenderState &state, QSGMaterial * /*newEffect*/, QSGMaterial *) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (state.isOpacityDirty()) program()->setUniformValue(m_opacity_id, state.opacity()); @@ -93,7 +93,7 @@ char const *const *QSGVertexColorMaterialShader::attributeNames() const void QSGVertexColorMaterialShader::initialize() { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) m_matrix_id = program()->uniformLocation("matrix"); m_opacity_id = program()->uniformLocation("opacity"); #endif diff --git a/src/quick/util/qquickanimatorjob_p.h b/src/quick/util/qquickanimatorjob_p.h index 64e849d322..e891ebab72 100644 --- a/src/quick/util/qquickanimatorjob_p.h +++ b/src/quick/util/qquickanimatorjob_p.h @@ -277,7 +277,7 @@ public: private: QSGOpacityNode *m_opacityNode; }; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) class Q_QUICK_PRIVATE_EXPORT QQuickUniformAnimatorJob : public QQuickAnimatorJob { public: diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp index 7692cc79f9..5a723e4432 100644 --- a/src/quick/util/qquickglobal.cpp +++ b/src/quick/util/qquickglobal.cpp @@ -783,7 +783,7 @@ public: return new QQuickApplication(parent); } -#ifndef QT_NO_IM +#if QT_CONFIG(im) QInputMethod *inputMethod() { QInputMethod *im = qGuiApp->inputMethod(); diff --git a/src/quick/util/qquickutilmodule.cpp b/src/quick/util/qquickutilmodule.cpp index 7e2973a78b..c1bc3d60b8 100644 --- a/src/quick/util/qquickutilmodule.cpp +++ b/src/quick/util/qquickutilmodule.cpp @@ -67,7 +67,7 @@ Q_DECLARE_METATYPE(QKeySequence::StandardKey) void QQuickUtilModule::defineModule() { -#ifndef QT_NO_IM +#if QT_CONFIG(im) qmlRegisterUncreatableType("QtQuick",2,0,"InputMethod", QInputMethod::tr("InputMethod is an abstract class")); #endif @@ -94,7 +94,7 @@ void QQuickUtilModule::defineModule() qmlRegisterType("QtQuick",2,0,"Transition"); qmlRegisterType("QtQuick",2,0,"Vector3dAnimation"); -#ifndef QT_NO_VALIDATOR +#if QT_CONFIG(validator) qmlRegisterType(); qmlRegisterType("QtQuick",2,0,"IntValidator"); qmlRegisterType("QtQuick",2,0,"DoubleValidator"); diff --git a/src/quick/util/qquickvalidator.cpp b/src/quick/util/qquickvalidator.cpp index 67cb6a6c05..015a376603 100644 --- a/src/quick/util/qquickvalidator.cpp +++ b/src/quick/util/qquickvalidator.cpp @@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_VALIDATOR +#if QT_CONFIG(validator) /*! \qmltype IntValidator @@ -221,7 +221,7 @@ void QQuickDoubleValidator::resetLocaleName() By default, this property contains a regular expression with the pattern .* that matches any string. */ -#endif // QT_NO_VALIDATOR +#endif // validator QT_END_NAMESPACE diff --git a/src/quick/util/qquickvalidator_p.h b/src/quick/util/qquickvalidator_p.h index 97adfb742a..ba188e947a 100644 --- a/src/quick/util/qquickvalidator_p.h +++ b/src/quick/util/qquickvalidator_p.h @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_VALIDATOR +#if QT_CONFIG(validator) class Q_AUTOTEST_EXPORT QQuickIntValidator : public QIntValidator { Q_OBJECT @@ -90,7 +90,7 @@ Q_SIGNALS: QT_END_NAMESPACE -#ifndef QT_NO_VALIDATOR +#if QT_CONFIG(validator) QML_DECLARE_TYPE(QValidator) QML_DECLARE_TYPE(QQuickIntValidator) QML_DECLARE_TYPE(QQuickDoubleValidator) diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 1d617f5098..ed7f7a0ca6 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -59,7 +59,7 @@ #include #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) #include #include #include @@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha); #endif @@ -108,7 +108,7 @@ void QQuickWidgetPrivate::init(QQmlEngine* e) useSoftwareRenderer = true; if (!useSoftwareRenderer) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RasterGLSurface)) setRenderToTexture(); else @@ -121,7 +121,7 @@ void QQuickWidgetPrivate::init(QQmlEngine* e) if (!engine.isNull() && !engine.data()->incubationController()) engine.data()->setIncubationController(offscreenWindow->incubationController()); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) q->setAcceptDrops(true); #endif @@ -143,7 +143,7 @@ void QQuickWidgetPrivate::ensureEngine() const void QQuickWidgetPrivate::invalidateRenderControl() { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (!useSoftwareRenderer) { if (!context) // this is not an error, could be called before creating the context, or multiple times return; @@ -183,7 +183,7 @@ QQuickWidgetPrivate::QQuickWidgetPrivate() , offscreenWindow(0) , offscreenSurface(0) , renderControl(0) -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) , fbo(0) , resolvedFbo(0) , context(0) @@ -206,7 +206,7 @@ QQuickWidgetPrivate::~QQuickWidgetPrivate() delete renderControl; delete offscreenWindow; } else { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) // context and offscreenSurface are current at this stage, if the context was created. Q_ASSERT(!context || (QOpenGLContext::currentContext() == context && context->surface() == offscreenSurface)); delete renderControl; // always delete the rendercontrol first @@ -258,7 +258,7 @@ void QQuickWidgetPrivate::itemGeometryChanged(QQuickItem *resizeItem, QQuickGeom void QQuickWidgetPrivate::render(bool needsSync) { if (!useSoftwareRenderer) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) // createFramebufferObject() bails out when the size is empty. In this case // we cannot render either. if (!fbo) @@ -327,7 +327,7 @@ void QQuickWidgetPrivate::renderSceneGraph() render(true); -#ifndef QT_NO_GRAPHICSVIEW +#if QT_CONFIG(graphicsview) if (q->window()->graphicsProxyWidget()) QWidgetPrivate::nearestGraphicsProxyWidget(q)->update(); else @@ -343,7 +343,7 @@ void QQuickWidgetPrivate::renderSceneGraph() QImage QQuickWidgetPrivate::grabFramebuffer() { if (!useSoftwareRenderer) { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (!context) return QImage(); @@ -835,7 +835,7 @@ void QQuickWidgetPrivate::handleContextCreationFailure(const QSurfaceFormat &for // Never called by Software Rendering backend void QQuickWidgetPrivate::createContext() { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) Q_Q(QQuickWidget); // On hide-show we may invalidate() (when !isPersistentSceneGraph) but our @@ -886,7 +886,7 @@ void QQuickWidgetPrivate::destroyContext() { delete offscreenSurface; offscreenSurface = 0; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) delete context; context = 0; #endif @@ -914,7 +914,7 @@ void QQuickWidget::createFramebufferObject() return; } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QOpenGLContext *context = d->offscreenWindow->openglContext(); if (!context) { @@ -995,7 +995,7 @@ void QQuickWidget::destroyFramebufferObject() return; } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) delete d->fbo; d->fbo = 0; delete d->resolvedFbo; @@ -1078,7 +1078,7 @@ void QQuickWidgetPrivate::setRootObject(QObject *obj) } } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) GLuint QQuickWidgetPrivate::textureId() const { Q_Q(const QQuickWidget); @@ -1180,7 +1180,7 @@ void QQuickWidget::resizeEvent(QResizeEvent *e) createFramebufferObject(); } } else { -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (d->context) { // Bail out when receiving a resize after scenegraph invalidation. This can happen // during hide - resize - show sequences and also during application exit. @@ -1335,7 +1335,7 @@ void QQuickWidget::mouseReleaseEvent(QMouseEvent *e) e->setAccepted(mappedEvent.isAccepted()); } -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) /*! \reimp */ void QQuickWidget::wheelEvent(QWheelEvent *e) { @@ -1408,14 +1408,14 @@ bool QQuickWidget::event(QEvent *e) d->offscreenWindow->setScreen(newScreen); if (d->offscreenSurface) d->offscreenSurface->setScreen(newScreen); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) if (d->context) d->context->setScreen(newScreen); #endif } if (d->useSoftwareRenderer -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) || d->fbo #endif ) { @@ -1442,7 +1442,7 @@ bool QQuickWidget::event(QEvent *e) return QWidget::event(e); } -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) /*! \reimp */ void QQuickWidget::dragEnterEvent(QDragEnterEvent *e) @@ -1477,7 +1477,7 @@ void QQuickWidget::dropEvent(QDropEvent *e) d->offscreenWindow->event(e); } -#endif // QT_NO_DRAGANDDROP +#endif // draganddrop // TODO: try to separate the two cases of // 1. render() unconditionally without sync diff --git a/src/quickwidgets/qquickwidget.h b/src/quickwidgets/qquickwidget.h index 56e6b01ac5..2d159778ed 100644 --- a/src/quickwidgets/qquickwidget.h +++ b/src/quickwidgets/qquickwidget.h @@ -131,11 +131,11 @@ protected: void focusInEvent(QFocusEvent * event) override; void focusOutEvent(QFocusEvent * event) override; -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *) override; #endif -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) void dragEnterEvent(QDragEnterEvent *) override; void dragMoveEvent(QDragMoveEvent *) override; void dragLeaveEvent(QDragLeaveEvent *) override; diff --git a/src/quickwidgets/qquickwidget_p.h b/src/quickwidgets/qquickwidget_p.h index 0ba86172e6..559321cd51 100644 --- a/src/quickwidgets/qquickwidget_p.h +++ b/src/quickwidgets/qquickwidget_p.h @@ -101,7 +101,7 @@ public: QObject *focusObject() Q_DECL_OVERRIDE; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) GLuint textureId() const Q_DECL_OVERRIDE; QImage grabFramebuffer() Q_DECL_OVERRIDE; #else @@ -126,7 +126,7 @@ public: QOffscreenSurface *offscreenSurface; QQuickRenderControl *renderControl; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) QOpenGLFramebufferObject *fbo; QOpenGLFramebufferObject *resolvedFbo; QOpenGLContext *context; -- cgit v1.2.3