diff options
Diffstat (limited to 'src/platformsupport')
55 files changed, 807 insertions, 459 deletions
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_dummy_p.h b/src/platformsupport/devicediscovery/qdevicediscovery_dummy_p.h index fea3a06cbd..fe669c8dec 100644 --- a/src/platformsupport/devicediscovery/qdevicediscovery_dummy_p.h +++ b/src/platformsupport/devicediscovery/qdevicediscovery_dummy_p.h @@ -61,7 +61,7 @@ class QDeviceDiscoveryDummy : public QDeviceDiscovery public: QDeviceDiscoveryDummy(QDeviceTypes types, QObject *parent = 0); - QStringList scanConnectedDevices() Q_DECL_OVERRIDE; + QStringList scanConnectedDevices() override; }; QT_END_NAMESPACE diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_static_p.h b/src/platformsupport/devicediscovery/qdevicediscovery_static_p.h index ab5a9c6f12..93110c3c55 100644 --- a/src/platformsupport/devicediscovery/qdevicediscovery_static_p.h +++ b/src/platformsupport/devicediscovery/qdevicediscovery_static_p.h @@ -61,7 +61,7 @@ class QDeviceDiscoveryStatic : public QDeviceDiscovery public: QDeviceDiscoveryStatic(QDeviceTypes types, QObject *parent = 0); - QStringList scanConnectedDevices() Q_DECL_OVERRIDE; + QStringList scanConnectedDevices() override; private: bool checkDeviceType(const QString &device); diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h b/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h index 3c53ef3f17..28618d0b21 100644 --- a/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h +++ b/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h @@ -63,7 +63,7 @@ class QDeviceDiscoveryUDev : public QDeviceDiscovery public: QDeviceDiscoveryUDev(QDeviceTypes types, struct udev *udev, QObject *parent = 0); ~QDeviceDiscoveryUDev(); - QStringList scanConnectedDevices() Q_DECL_OVERRIDE; + QStringList scanConnectedDevices() override; private slots: void handleUDevNotification(); diff --git a/src/platformsupport/edid/qedidvendortable_p.h b/src/platformsupport/edid/qedidvendortable_p.h index d09642d649..948a9cecfc 100644 --- a/src/platformsupport/edid/qedidvendortable_p.h +++ b/src/platformsupport/edid/qedidvendortable_p.h @@ -47,6 +47,15 @@ #ifndef QEDIDVENDORTABLE_P_H #define QEDIDVENDORTABLE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// + QT_BEGIN_NAMESPACE typedef struct VendorTable { diff --git a/src/platformsupport/eglconvenience/qeglpbuffer_p.h b/src/platformsupport/eglconvenience/qeglpbuffer_p.h index 38370c0e62..eed8cd9dca 100644 --- a/src/platformsupport/eglconvenience/qeglpbuffer_p.h +++ b/src/platformsupport/eglconvenience/qeglpbuffer_p.h @@ -63,8 +63,8 @@ public: QEGLPlatformContext::Flags flags = 0); ~QEGLPbuffer(); - QSurfaceFormat format() const Q_DECL_OVERRIDE { return m_format; } - bool isValid() const Q_DECL_OVERRIDE { return m_pbuffer != EGL_NO_SURFACE; } + QSurfaceFormat format() const override { return m_format; } + bool isValid() const override { return m_pbuffer != EGL_NO_SURFACE; } EGLSurface pbuffer() const { return m_pbuffer; } diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h index 9d41eecd99..d6cbbe4131 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h @@ -72,15 +72,15 @@ public: Flags flags = 0); ~QEGLPlatformContext(); - void initialize() Q_DECL_OVERRIDE; - bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE; - void doneCurrent() Q_DECL_OVERRIDE; - void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE; - QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE; + void initialize() override; + bool makeCurrent(QPlatformSurface *surface) override; + void doneCurrent() override; + void swapBuffers(QPlatformSurface *surface) override; + QFunctionPointer getProcAddress(const char *procName) override; - QSurfaceFormat format() const Q_DECL_OVERRIDE; - bool isSharing() const Q_DECL_OVERRIDE { return m_shareContext != EGL_NO_CONTEXT; } - bool isValid() const Q_DECL_OVERRIDE { return m_eglContext != EGL_NO_CONTEXT; } + QSurfaceFormat format() const override; + bool isSharing() const override { return m_shareContext != EGL_NO_CONTEXT; } + bool isValid() const override { return m_eglContext != EGL_NO_CONTEXT; } EGLContext eglContext() const; EGLDisplay eglDisplay() const; diff --git a/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h b/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h index bed2532856..5930dc68e7 100644 --- a/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h +++ b/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h @@ -67,7 +67,7 @@ public: explicit QPAEventDispatcherGlib(QObject *parent = 0); ~QPAEventDispatcherGlib(); - bool processEvents(QEventLoop::ProcessEventsFlags flags) Q_DECL_OVERRIDE; + bool processEvents(QEventLoop::ProcessEventsFlags flags) override; QEventLoop::ProcessEventsFlags m_flags; }; diff --git a/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h b/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h index 9a23b5c0bd..4ff047a60e 100644 --- a/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h +++ b/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h @@ -63,8 +63,8 @@ public: static const char *windowsMessageName(UINT msg); - bool QT_ENSURE_STACK_ALIGNED_FOR_SSE processEvents(QEventLoop::ProcessEventsFlags flags) Q_DECL_OVERRIDE; - void sendPostedEvents() Q_DECL_OVERRIDE; + bool QT_ENSURE_STACK_ALIGNED_FOR_SSE processEvents(QEventLoop::ProcessEventsFlags flags) override; + void sendPostedEvents() override; private: QEventLoop::ProcessEventsFlags m_flags; diff --git a/src/platformsupport/fbconvenience/qfbbackingstore_p.h b/src/platformsupport/fbconvenience/qfbbackingstore_p.h index c8dfe3489c..c4762c9327 100644 --- a/src/platformsupport/fbconvenience/qfbbackingstore_p.h +++ b/src/platformsupport/fbconvenience/qfbbackingstore_p.h @@ -66,10 +66,10 @@ public: QFbBackingStore(QWindow *window); ~QFbBackingStore(); - QPaintDevice *paintDevice() Q_DECL_OVERRIDE { return &mImage; } - void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) Q_DECL_OVERRIDE; + QPaintDevice *paintDevice() override { return &mImage; } + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; - void resize(const QSize &size, const QRegion ®ion) Q_DECL_OVERRIDE; + void resize(const QSize &size, const QRegion ®ion) override; const QImage image(); QImage toImage() const override; @@ -77,8 +77,8 @@ public: void lock(); void unlock(); - void beginPaint(const QRegion &) Q_DECL_OVERRIDE; - void endPaint() Q_DECL_OVERRIDE; + void beginPaint(const QRegion &) override; + void endPaint() override; protected: friend class QFbWindow; diff --git a/src/platformsupport/fbconvenience/qfbscreen_p.h b/src/platformsupport/fbconvenience/qfbscreen_p.h index 1c27a941cc..eed615de36 100644 --- a/src/platformsupport/fbconvenience/qfbscreen_p.h +++ b/src/platformsupport/fbconvenience/qfbscreen_p.h @@ -78,14 +78,14 @@ public: virtual bool initialize(); - QRect geometry() const Q_DECL_OVERRIDE { return mGeometry; } - int depth() const Q_DECL_OVERRIDE { return mDepth; } - QImage::Format format() const Q_DECL_OVERRIDE { return mFormat; } - QSizeF physicalSize() const Q_DECL_OVERRIDE { return mPhysicalSize; } - QPlatformCursor *cursor() const Q_DECL_OVERRIDE { return mCursor; } + QRect geometry() const override { return mGeometry; } + int depth() const override { return mDepth; } + QImage::Format format() const override { return mFormat; } + QSizeF physicalSize() const override { return mPhysicalSize; } + QPlatformCursor *cursor() const override { return mCursor; } QWindow *topWindow() const; - QWindow *topLevelAt(const QPoint & p) const Q_DECL_OVERRIDE; + QWindow *topLevelAt(const QPoint & p) const override; // compositor api virtual void addWindow(QFbWindow *window); @@ -109,7 +109,7 @@ protected: virtual QRegion doRedraw(); void initializeCompositor(); - bool event(QEvent *event) Q_DECL_OVERRIDE; + bool event(QEvent *event) override; QFbWindow *windowForId(WId wid) const; diff --git a/src/platformsupport/fbconvenience/qfbwindow_p.h b/src/platformsupport/fbconvenience/qfbwindow_p.h index 20bac46c69..76b34ce041 100644 --- a/src/platformsupport/fbconvenience/qfbwindow_p.h +++ b/src/platformsupport/fbconvenience/qfbwindow_p.h @@ -64,17 +64,17 @@ public: QFbWindow(QWindow *window); ~QFbWindow(); - void raise() Q_DECL_OVERRIDE; - void lower() Q_DECL_OVERRIDE; + void raise() override; + void lower() override; - void setGeometry(const QRect &rect) Q_DECL_OVERRIDE; - void setVisible(bool visible) Q_DECL_OVERRIDE; + void setGeometry(const QRect &rect) override; + void setVisible(bool visible) override; - void setWindowState(Qt::WindowStates state) Q_DECL_OVERRIDE; - void setWindowFlags(Qt::WindowFlags type) Q_DECL_OVERRIDE; + void setWindowState(Qt::WindowStates state) override; + void setWindowFlags(Qt::WindowFlags type) override; Qt::WindowFlags windowFlags() const; - WId winId() const Q_DECL_OVERRIDE { return mWindowId; } + WId winId() const override { return mWindowId; } void setBackingStore(QFbBackingStore *store) { mBackingStore = store; } QFbBackingStore *backingStore() const { return mBackingStore; } @@ -83,9 +83,9 @@ public: virtual void repaint(const QRegion&); - void propagateSizeHints() Q_DECL_OVERRIDE { } - bool setKeyboardGrabEnabled(bool) Q_DECL_OVERRIDE { return false; } - bool setMouseGrabEnabled(bool) Q_DECL_OVERRIDE { return false; } + void propagateSizeHints() override { } + bool setKeyboardGrabEnabled(bool) override { return false; } + bool setMouseGrabEnabled(bool) override { return false; } protected: friend class QFbScreen; diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 969a9c17e0..733d6dc531 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -428,7 +428,7 @@ static void populateFromPattern(FcPattern *pattern) if (res == FcResultMatch) { bool hasLang = false; #if FC_VERSION >= 20297 - FcChar8 *cap = Q_NULLPTR; + FcChar8 *cap = nullptr; FcResult capRes = FcResultNoMatch; #endif for (int j = 1; j < QFontDatabase::WritingSystemsCount; ++j) { @@ -438,7 +438,7 @@ static void populateFromPattern(FcPattern *pattern) if (langRes != FcLangDifferentLang) { #if FC_VERSION >= 20297 if (*capabilityForWritingSystem[j] && requiresOpenType(j)) { - if (cap == Q_NULLPTR) + if (cap == nullptr) capRes = FcPatternGetString(pattern, FC_CAPABILITY, 0, &cap); if (capRes == FcResultMatch && strstr(reinterpret_cast<const char *>(cap), capabilityForWritingSystem[j]) == 0) continue; diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h index 6a3261de30..a7257c2f98 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h @@ -61,15 +61,15 @@ class QFontEngineFT; class QFontconfigDatabase : public QFreeTypeFontDatabase { public: - void populateFontDatabase() Q_DECL_OVERRIDE; - void invalidate() Q_DECL_OVERRIDE; - QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) Q_DECL_OVERRIDE; - QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) Q_DECL_OVERRIDE; - QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) Q_DECL_OVERRIDE; - QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const Q_DECL_OVERRIDE; - QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) Q_DECL_OVERRIDE; - QString resolveFontFamilyAlias(const QString &family) const Q_DECL_OVERRIDE; - QFont defaultFont() const Q_DECL_OVERRIDE; + void populateFontDatabase() override; + void invalidate() override; + QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) override; + QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override; + QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override; + QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override; + QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) override; + QString resolveFontFamilyAlias(const QString &family) const override; + QFont defaultFont() const override; private: void setupFontEngine(QFontEngineFT *engine, const QFontDef &fontDef) const; diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h b/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h index 1d2f451722..7f560c2d05 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h +++ b/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h @@ -63,7 +63,7 @@ public: ~QFontEngineMultiFontConfig(); - bool shouldLoadFontEngineForCharacter(int at, uint ucs4) const Q_DECL_OVERRIDE; + bool shouldLoadFontEngineForCharacter(int at, uint ucs4) const override; private: FcPattern* getMatchPatternForFallback(int at) const; diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp index 4a197fd6ef..1fb73e873a 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp @@ -1537,7 +1537,7 @@ QFontEngineFT::QGlyphSet *QFontEngineFT::loadGlyphSet(const QTransform &matrix) // FT_Set_Transform only supports scalable fonts if (!FT_IS_SCALABLE(freetype->face)) - return matrix.type() <= QTransform::TxTranslate ? &defaultGlyphSet : Q_NULLPTR; + return matrix.type() <= QTransform::TxTranslate ? &defaultGlyphSet : nullptr; FT_Matrix m = QTransformToFTMatrix(matrix); @@ -1956,7 +1956,7 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEngine::GlyphFormat glyphFormat) { - if (glyph == Q_NULLPTR || glyph->height == 0 || glyph->width == 0) + if (glyph == nullptr || glyph->height == 0 || glyph->width == 0) return QImage(); QImage::Format format = QImage::Format_Invalid; @@ -2004,14 +2004,14 @@ QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixe currentlyLockedAlphaMap = alphaMapFromGlyphData(glyph, neededFormat); - const bool glyphHasGeometry = glyph != Q_NULLPTR && glyph->height != 0 && glyph->width != 0; + const bool glyphHasGeometry = glyph != nullptr && glyph->height != 0 && glyph->width != 0; if (!cacheEnabled && glyph != &emptyGlyph) { currentlyLockedAlphaMap = currentlyLockedAlphaMap.copy(); delete glyph; } if (!glyphHasGeometry) - return Q_NULLPTR; + return nullptr; if (currentlyLockedAlphaMap.isNull()) return QFontEngine::lockedAlphaMapForGlyph(glyphIndex, subPixelPosition, neededFormat, t, offset); @@ -2109,7 +2109,7 @@ QImage QFontEngineFT::alphaRGBMapForGlyph(glyph_t g, QFixed subPixelPosition, co QImage QFontEngineFT::bitmapForGlyph(glyph_t g, QFixed subPixelPosition, const QTransform &t) { Glyph *glyph = loadGlyphFor(g, subPixelPosition, defaultFormat, t); - if (glyph == Q_NULLPTR) + if (glyph == nullptr) return QImage(); QImage img; diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h index 2993e3b616..7efd175402 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h @@ -190,68 +190,68 @@ private: mutable int fast_glyph_count; }; - QFontEngine::FaceId faceId() const Q_DECL_OVERRIDE; - QFontEngine::Properties properties() const Q_DECL_OVERRIDE; - QFixed emSquareSize() const Q_DECL_OVERRIDE; - bool supportsSubPixelPositions() const Q_DECL_OVERRIDE + QFontEngine::FaceId faceId() const override; + QFontEngine::Properties properties() const override; + QFixed emSquareSize() const override; + bool supportsSubPixelPositions() const override { return default_hint_style == HintLight || default_hint_style == HintNone; } - bool getSfntTableData(uint tag, uchar *buffer, uint *length) const Q_DECL_OVERRIDE; - int synthesized() const Q_DECL_OVERRIDE; + bool getSfntTableData(uint tag, uchar *buffer, uint *length) const override; + int synthesized() const override; - QFixed ascent() const Q_DECL_OVERRIDE; - QFixed capHeight() const Q_DECL_OVERRIDE; - QFixed descent() const Q_DECL_OVERRIDE; - QFixed leading() const Q_DECL_OVERRIDE; - QFixed xHeight() const Q_DECL_OVERRIDE; - QFixed averageCharWidth() const Q_DECL_OVERRIDE; + QFixed ascent() const override; + QFixed capHeight() const override; + QFixed descent() const override; + QFixed leading() const override; + QFixed xHeight() const override; + QFixed averageCharWidth() const override; - qreal maxCharWidth() const Q_DECL_OVERRIDE; - QFixed lineThickness() const Q_DECL_OVERRIDE; - QFixed underlinePosition() const Q_DECL_OVERRIDE; + qreal maxCharWidth() const override; + QFixed lineThickness() const override; + QFixed underlinePosition() const override; - glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE; - void doKerning(QGlyphLayout *, ShaperFlags) const Q_DECL_OVERRIDE; + glyph_t glyphIndex(uint ucs4) const override; + void doKerning(QGlyphLayout *, ShaperFlags) const override; - void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) Q_DECL_OVERRIDE; + void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) override; - bool supportsTransformation(const QTransform &transform) const Q_DECL_OVERRIDE; + bool supportsTransformation(const QTransform &transform) const override; void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, - QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE; + QPainterPath *path, QTextItem::RenderFlags flags) override; void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, - QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE; + QPainterPath *path, QTextItem::RenderFlags flags) override; - bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const Q_DECL_OVERRIDE; + bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override; - glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE; - glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE; - glyph_metrics_t boundingBox(glyph_t glyph, const QTransform &matrix) Q_DECL_OVERRIDE; + glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override; + glyph_metrics_t boundingBox(glyph_t glyph) override; + glyph_metrics_t boundingBox(glyph_t glyph, const QTransform &matrix) override; - void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags flags) const Q_DECL_OVERRIDE; - QImage alphaMapForGlyph(glyph_t g) Q_DECL_OVERRIDE { return alphaMapForGlyph(g, 0); } - QImage alphaMapForGlyph(glyph_t, QFixed) Q_DECL_OVERRIDE; - QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE; - QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE; - QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE; + void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags flags) const override; + QImage alphaMapForGlyph(glyph_t g) override { return alphaMapForGlyph(g, 0); } + QImage alphaMapForGlyph(glyph_t, QFixed) override; + QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) override; + QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override; + QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override; glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed subPixelPosition, const QTransform &matrix, - QFontEngine::GlyphFormat format) Q_DECL_OVERRIDE; + QFontEngine::GlyphFormat format) override; QImage *lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, GlyphFormat neededFormat, const QTransform &t, - QPoint *offset) Q_DECL_OVERRIDE; - bool hasInternalCaching() const Q_DECL_OVERRIDE { return cacheEnabled; } - void unlockAlphaMapForGlyph() Q_DECL_OVERRIDE; - bool expectsGammaCorrectedBlending() const Q_DECL_OVERRIDE; + QPoint *offset) override; + bool hasInternalCaching() const override { return cacheEnabled; } + void unlockAlphaMapForGlyph() override; + bool expectsGammaCorrectedBlending() const override; - void removeGlyphFromCache(glyph_t glyph) Q_DECL_OVERRIDE; - int glyphMargin(QFontEngine::GlyphFormat /* format */) Q_DECL_OVERRIDE { return 0; } + void removeGlyphFromCache(glyph_t glyph) override; + int glyphMargin(QFontEngine::GlyphFormat /* format */) override { return 0; } - int glyphCount() const Q_DECL_OVERRIDE; + int glyphCount() const override; enum Scaling { Scaled, @@ -282,13 +282,13 @@ private: bool init(FaceId faceId, bool antialias, GlyphFormat format, QFreetypeFace *freetypeFace); - int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints) Q_DECL_OVERRIDE; + int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints) override; void setQtDefaultHintStyle(QFont::HintingPreference hintingPreference); - void setDefaultHintStyle(HintStyle style) Q_DECL_OVERRIDE; + void setDefaultHintStyle(HintStyle style) override; - QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE; - Qt::HANDLE handle() const Q_DECL_OVERRIDE; + QFontEngine *cloneWithSize(qreal pixelSize) const override; + Qt::HANDLE handle() const override; bool initFromFontEngine(const QFontEngineFT *fontEngine); HintStyle defaultHintStyle() const { return default_hint_style; } diff --git a/src/platformsupport/fontdatabases/freetype/qfreetypefontdatabase_p.h b/src/platformsupport/fontdatabases/freetype/qfreetypefontdatabase_p.h index 6d51361400..0b2956b16e 100644 --- a/src/platformsupport/fontdatabases/freetype/qfreetypefontdatabase_p.h +++ b/src/platformsupport/fontdatabases/freetype/qfreetypefontdatabase_p.h @@ -66,11 +66,11 @@ struct FontFile class QFreeTypeFontDatabase : public QPlatformFontDatabase { public: - void populateFontDatabase() Q_DECL_OVERRIDE; - QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) Q_DECL_OVERRIDE; - QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) Q_DECL_OVERRIDE; - QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) Q_DECL_OVERRIDE; - void releaseHandle(void *handle) Q_DECL_OVERRIDE; + void populateFontDatabase() override; + QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override; + QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override; + QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) override; + void releaseHandle(void *handle) override; static QStringList addTTFile(const QByteArray &fontData, const QByteArray &file); }; diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h index 2b4c4e3ceb..76ab31c046 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h @@ -70,18 +70,18 @@ class QCoreTextFontDatabase : public QPlatformFontDatabase public: QCoreTextFontDatabase(); ~QCoreTextFontDatabase(); - void populateFontDatabase() Q_DECL_OVERRIDE; + void populateFontDatabase() override; bool populateFamilyAliases() override; - void populateFamily(const QString &familyName) Q_DECL_OVERRIDE; + void populateFamily(const QString &familyName) override; void invalidate() override; - QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const Q_DECL_OVERRIDE; - QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) Q_DECL_OVERRIDE; - void releaseHandle(void *handle) Q_DECL_OVERRIDE; - bool isPrivateFontFamily(const QString &family) const Q_DECL_OVERRIDE; - QFont defaultFont() const Q_DECL_OVERRIDE; - bool fontsAlwaysScalable() const Q_DECL_OVERRIDE; - QList<int> standardSizes() const Q_DECL_OVERRIDE; + QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override; + QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) override; + void releaseHandle(void *handle) override; + bool isPrivateFontFamily(const QString &family) const override; + QFont defaultFont() const override; + bool fontsAlwaysScalable() const override; + QList<int> standardSizes() const override; // For iOS and OS X platform themes QFont *themeFont(QPlatformTheme::Font) const; diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h index 2986f0aaec..1f7b346909 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h @@ -70,53 +70,53 @@ public: QCoreTextFontEngine(CGFontRef font, const QFontDef &def); ~QCoreTextFontEngine(); - glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE; - bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const Q_DECL_OVERRIDE; - void recalcAdvances(QGlyphLayout *, ShaperFlags) const Q_DECL_OVERRIDE; + glyph_t glyphIndex(uint ucs4) const override; + bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override; + void recalcAdvances(QGlyphLayout *, ShaperFlags) const override; - glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE; - glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE; + glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override; + glyph_metrics_t boundingBox(glyph_t glyph) override; - QFixed ascent() const Q_DECL_OVERRIDE; - QFixed capHeight() const Q_DECL_OVERRIDE; - QFixed descent() const Q_DECL_OVERRIDE; - QFixed leading() const Q_DECL_OVERRIDE; - QFixed xHeight() const Q_DECL_OVERRIDE; - qreal maxCharWidth() const Q_DECL_OVERRIDE; - QFixed averageCharWidth() const Q_DECL_OVERRIDE; + QFixed ascent() const override; + QFixed capHeight() const override; + QFixed descent() const override; + QFixed leading() const override; + QFixed xHeight() const override; + qreal maxCharWidth() const override; + QFixed averageCharWidth() const override; void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int numGlyphs, - QPainterPath *path, QTextItem::RenderFlags) Q_DECL_OVERRIDE; + QPainterPath *path, QTextItem::RenderFlags) override; - bool canRender(const QChar *string, int len) const Q_DECL_OVERRIDE; + bool canRender(const QChar *string, int len) const override; - int synthesized() const Q_DECL_OVERRIDE { return synthesisFlags; } - bool supportsSubPixelPositions() const Q_DECL_OVERRIDE { return true; } + int synthesized() const override { return synthesisFlags; } + bool supportsSubPixelPositions() const override { return true; } - QFixed lineThickness() const Q_DECL_OVERRIDE; - QFixed underlinePosition() const Q_DECL_OVERRIDE; + QFixed lineThickness() const override; + QFixed underlinePosition() const override; void draw(CGContextRef ctx, qreal x, qreal y, const QTextItemInt &ti, int paintDeviceHeight); - FaceId faceId() const Q_DECL_OVERRIDE; - bool getSfntTableData(uint /*tag*/, uchar * /*buffer*/, uint * /*length*/) const Q_DECL_OVERRIDE; - void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) Q_DECL_OVERRIDE; - QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition) Q_DECL_OVERRIDE; - QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE; - QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE; - glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat) Q_DECL_OVERRIDE; - QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE; - QFixed emSquareSize() const Q_DECL_OVERRIDE; - void doKerning(QGlyphLayout *g, ShaperFlags flags) const Q_DECL_OVERRIDE; - - bool supportsTransformation(const QTransform &transform) const Q_DECL_OVERRIDE; - bool expectsGammaCorrectedBlending() const Q_DECL_OVERRIDE; - - QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE; - Qt::HANDLE handle() const Q_DECL_OVERRIDE; - int glyphMargin(QFontEngine::GlyphFormat format) Q_DECL_OVERRIDE { Q_UNUSED(format); return 0; } - - QFontEngine::Properties properties() const Q_DECL_OVERRIDE; + FaceId faceId() const override; + bool getSfntTableData(uint /*tag*/, uchar * /*buffer*/, uint * /*length*/) const override; + void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) override; + QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition) override; + QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) override; + QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override; + glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat) override; + QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override; + QFixed emSquareSize() const override; + void doKerning(QGlyphLayout *g, ShaperFlags flags) const override; + + bool supportsTransformation(const QTransform &transform) const override; + bool expectsGammaCorrectedBlending() const override; + + QFontEngine *cloneWithSize(qreal pixelSize) const override; + Qt::HANDLE handle() const override; + int glyphMargin(QFontEngine::GlyphFormat format) override { Q_UNUSED(format); return 0; } + + QFontEngine::Properties properties() const override; static bool ct_getSfntTable(void *user_data, uint tag, uchar *buffer, uint *length); static QFont::Weight qtWeightFromCFWeight(float value); diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp index a0adcd6e2e..def67c6199 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp @@ -76,20 +76,18 @@ typedef HRESULT (WINAPI *DWriteCreateFactoryType)(DWRITE_FACTORY_TYPE, const IID static inline DWriteCreateFactoryType resolveDWriteCreateFactory() { - if (QSysInfo::windowsVersion() < QSysInfo::WV_VISTA) - return Q_NULLPTR; QSystemLibrary library(QStringLiteral("dwrite")); QFunctionPointer result = library.resolve("DWriteCreateFactory"); if (Q_UNLIKELY(!result)) { qWarning("Unable to load dwrite.dll"); - return Q_NULLPTR; + return nullptr; } return reinterpret_cast<DWriteCreateFactoryType>(result); } static void createDirectWriteFactory(IDWriteFactory **factory) { - *factory = Q_NULLPTR; + *factory = nullptr; static const DWriteCreateFactoryType dWriteCreateFactory = resolveDWriteCreateFactory(); if (!dWriteCreateFactory) @@ -539,7 +537,7 @@ namespace { class CustomFontFileLoader { public: - CustomFontFileLoader() : m_directWriteFontFileLoader(Q_NULLPTR) + CustomFontFileLoader() : m_directWriteFontFileLoader(nullptr) { createDirectWriteFactory(&m_directWriteFactory); @@ -1128,7 +1126,7 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t // NEWTEXTMETRICEX (passed for TT fonts) is a NEWTEXTMETRIC, which according // to the documentation is identical to a TEXTMETRIC except for the last four // members, which we don't use anyway - const FONTSIGNATURE *signature = Q_NULLPTR; + const FONTSIGNATURE *signature = nullptr; if (type & TRUETYPE_FONTTYPE) signature = &reinterpret_cast<const NEWTEXTMETRICEX *>(textmetric)->ntmFontSig; addFontToDatabase(familyName, styleName, *logFont, textmetric, signature, type); @@ -1719,11 +1717,8 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request, const QS qual = PROOF_QUALITY; if (request.styleStrategy & QFont::PreferAntialias) { - if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && !(request.styleStrategy & QFont::NoSubpixelAntialias)) { - qual = CLEARTYPE_QUALITY; - } else { - qual = ANTIALIASED_QUALITY; - } + qual = (request.styleStrategy & QFont::NoSubpixelAntialias) == 0 + ? CLEARTYPE_QUALITY : ANTIALIASED_QUALITY; } else if (request.styleStrategy & QFont::NoAntialias) { qual = NONANTIALIASED_QUALITY; } else if ((request.styleStrategy & QFont::NoSubpixelAntialias) && sharedFontData()->clearTypeEnabled) { @@ -1910,7 +1905,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, const Q } else { bool isColorFont = false; #if defined(QT_USE_DIRECTWRITE2) - IDWriteFontFace2 *directWriteFontFace2 = Q_NULLPTR; + IDWriteFontFace2 *directWriteFontFace2 = nullptr; if (SUCCEEDED(directWriteFontFace->QueryInterface(__uuidof(IDWriteFontFace2), reinterpret_cast<void **>(&directWriteFontFace2)))) { if (directWriteFontFace2->IsColorFont()) diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp index 3f03b30f10..78477de38a 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp @@ -144,7 +144,7 @@ static FontKeys &fontKeys() return result; } -static const FontKey *findFontKey(const QString &name, int *indexIn = Q_NULLPTR) +static const FontKey *findFontKey(const QString &name, int *indexIn = nullptr) { const FontKeys &keys = fontKeys(); for (auto it = keys.constBegin(), cend = keys.constEnd(); it != cend; ++it) { @@ -157,7 +157,7 @@ static const FontKey *findFontKey(const QString &name, int *indexIn = Q_NULLPTR) } if (indexIn) *indexIn = -1; - return Q_NULLPTR; + return nullptr; } static bool addFontToDatabase(QString familyName, @@ -310,7 +310,7 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t // NEWTEXTMETRICEX (passed for TT fonts) is a NEWTEXTMETRIC, which according // to the documentation is identical to a TEXTMETRIC except for the last four // members, which we don't use anyway - const FONTSIGNATURE *signature = Q_NULLPTR; + const FONTSIGNATURE *signature = nullptr; if (type & TRUETYPE_FONTTYPE) signature = &reinterpret_cast<const NEWTEXTMETRICEX *>(textmetric)->ntmFontSig; addFontToDatabase(faceName, styleName, fullName, *logFont, textmetric, signature, type); diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft_p.h b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft_p.h index 2df81274ad..c3d201b3a0 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft_p.h +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft_p.h @@ -60,18 +60,18 @@ QT_BEGIN_NAMESPACE class QWindowsFontDatabaseFT : public QFreeTypeFontDatabase { public: - void populateFontDatabase() Q_DECL_OVERRIDE; - void populateFamily(const QString &familyName) Q_DECL_OVERRIDE; - QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) Q_DECL_OVERRIDE; + void populateFontDatabase() override; + void populateFamily(const QString &familyName) override; + QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override; QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, - QFont::HintingPreference hintingPreference) Q_DECL_OVERRIDE; + QFont::HintingPreference hintingPreference) override; QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, - QChar::Script script) const Q_DECL_OVERRIDE; + QChar::Script script) const override; - QString fontDir() const Q_DECL_OVERRIDE; - QFont defaultFont() const Q_DECL_OVERRIDE; + QString fontDir() const override; + QFont defaultFont() const override; }; QT_END_NAMESPACE diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h index 15172c09da..bbdb90f70a 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h @@ -95,18 +95,18 @@ public: QWindowsFontDatabase(); ~QWindowsFontDatabase(); - void populateFontDatabase() Q_DECL_OVERRIDE; - void populateFamily(const QString &familyName) Q_DECL_OVERRIDE; - QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) Q_DECL_OVERRIDE; - QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) Q_DECL_OVERRIDE; - QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) Q_DECL_OVERRIDE; - QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const Q_DECL_OVERRIDE; - QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) Q_DECL_OVERRIDE; - void releaseHandle(void *handle) Q_DECL_OVERRIDE; - QString fontDir() const Q_DECL_OVERRIDE; - - QFont defaultFont() const Q_DECL_OVERRIDE { return systemDefaultFont(); } - bool fontsAlwaysScalable() const Q_DECL_OVERRIDE; + void populateFontDatabase() override; + void populateFamily(const QString &familyName) override; + QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) override; + QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override; + QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override; + QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override; + QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) override; + void releaseHandle(void *handle) override; + QString fontDir() const override; + + QFont defaultFont() const override { return systemDefaultFont(); } + bool fontsAlwaysScalable() const override; void derefUniqueFont(const QString &uniqueFont); void refUniqueFont(const QString &uniqueFont); diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h b/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h index 76b45d7a7b..2ec391c4da 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h @@ -76,53 +76,53 @@ public: void initFontInfo(const QFontDef &request, int dpi); - QFixed lineThickness() const Q_DECL_OVERRIDE; - Properties properties() const Q_DECL_OVERRIDE; - void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) Q_DECL_OVERRIDE; - FaceId faceId() const Q_DECL_OVERRIDE; - bool getSfntTableData(uint tag, uchar *buffer, uint *length) const Q_DECL_OVERRIDE; - int synthesized() const Q_DECL_OVERRIDE; - QFixed emSquareSize() const Q_DECL_OVERRIDE; - - glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE; - bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const Q_DECL_OVERRIDE; - void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const Q_DECL_OVERRIDE; - - void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE; + QFixed lineThickness() const override; + Properties properties() const override; + void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) override; + FaceId faceId() const override; + bool getSfntTableData(uint tag, uchar *buffer, uint *length) const override; + int synthesized() const override; + QFixed emSquareSize() const override; + + glyph_t glyphIndex(uint ucs4) const override; + bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override; + void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const override; + + void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) override; virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, - QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE; + QPainterPath *path, QTextItem::RenderFlags flags) override; HGDIOBJ selectDesignFont() const; - glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE; - glyph_metrics_t boundingBox(glyph_t g) Q_DECL_OVERRIDE { return boundingBox(g, QTransform()); } - glyph_metrics_t boundingBox(glyph_t g, const QTransform &t) Q_DECL_OVERRIDE; + glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override; + glyph_metrics_t boundingBox(glyph_t g) override { return boundingBox(g, QTransform()); } + glyph_metrics_t boundingBox(glyph_t g, const QTransform &t) override; - QFixed ascent() const Q_DECL_OVERRIDE; - QFixed descent() const Q_DECL_OVERRIDE; - QFixed leading() const Q_DECL_OVERRIDE; - QFixed xHeight() const Q_DECL_OVERRIDE; - QFixed capHeight() const Q_DECL_OVERRIDE; - QFixed averageCharWidth() const Q_DECL_OVERRIDE; - qreal maxCharWidth() const Q_DECL_OVERRIDE; - qreal minLeftBearing() const Q_DECL_OVERRIDE; - qreal minRightBearing() const Q_DECL_OVERRIDE; + QFixed ascent() const override; + QFixed descent() const override; + QFixed leading() const override; + QFixed xHeight() const override; + QFixed capHeight() const override; + QFixed averageCharWidth() const override; + qreal maxCharWidth() const override; + qreal minLeftBearing() const override; + qreal minRightBearing() const override; - QImage alphaMapForGlyph(glyph_t t) Q_DECL_OVERRIDE { return alphaMapForGlyph(t, QTransform()); } - QImage alphaMapForGlyph(glyph_t, const QTransform &xform) Q_DECL_OVERRIDE; - QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform) Q_DECL_OVERRIDE; - glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat) Q_DECL_OVERRIDE; + QImage alphaMapForGlyph(glyph_t t) override { return alphaMapForGlyph(t, QTransform()); } + QImage alphaMapForGlyph(glyph_t, const QTransform &xform) override; + QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform) override; + glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat) override; - QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE; - Qt::HANDLE handle() const Q_DECL_OVERRIDE; - bool supportsTransformation(const QTransform &transform) const Q_DECL_OVERRIDE; + QFontEngine *cloneWithSize(qreal pixelSize) const override; + Qt::HANDLE handle() const override; + bool supportsTransformation(const QTransform &transform) const override; #ifndef Q_CC_MINGW - void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0) Q_DECL_OVERRIDE; + void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0) override; #endif - bool hasUnreliableGlyphOutline() const Q_DECL_OVERRIDE; + bool hasUnreliableGlyphOutline() const override; int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs) const; void getCMap(); @@ -173,7 +173,7 @@ class QWindowsMultiFontEngine : public QFontEngineMulti public: explicit QWindowsMultiFontEngine(QFontEngine *fe, int script); - QFontEngine *loadEngine(int at) Q_DECL_OVERRIDE; + QFontEngine *loadEngine(int at) override; }; QT_END_NAMESPACE diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp index f07e711048..0e017c3b77 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp @@ -282,7 +282,7 @@ static UUID uuidIdWriteLocalFontFileLoader() QString QWindowsFontEngineDirectWrite::filenameFromFontFile(IDWriteFontFile *fontFile) { - IDWriteFontFileLoader *loader = Q_NULLPTR; + IDWriteFontFileLoader *loader = nullptr; HRESULT hr = fontFile->GetLoader(&loader); if (FAILED(hr)) { @@ -290,11 +290,11 @@ QString QWindowsFontEngineDirectWrite::filenameFromFontFile(IDWriteFontFile *fon return QString(); } - QIdWriteLocalFontFileLoader *localLoader = Q_NULLPTR; + QIdWriteLocalFontFileLoader *localLoader = nullptr; hr = loader->QueryInterface(uuidIdWriteLocalFontFileLoader(), reinterpret_cast<void **>(&localLoader)); - const void *fontFileReferenceKey = Q_NULLPTR; + const void *fontFileReferenceKey = nullptr; UINT32 fontFileReferenceKeySize = 0; if (SUCCEEDED(hr)) { hr = fontFile->GetReferenceKey(&fontFileReferenceKey, @@ -326,10 +326,10 @@ QString QWindowsFontEngineDirectWrite::filenameFromFontFile(IDWriteFontFile *fon ret = QString::fromWCharArray(filePath.data()); } - if (localLoader != Q_NULLPTR) + if (localLoader != nullptr) localLoader->Release(); - if (loader != Q_NULLPTR) + if (loader != nullptr) loader->Release(); return ret; } @@ -349,7 +349,7 @@ void QWindowsFontEngineDirectWrite::collectMetrics() m_lineGap = DESIGN_TO_LOGICAL(metrics.lineGap); m_underlinePosition = DESIGN_TO_LOGICAL(metrics.underlinePosition); - IDWriteFontFile *fontFile = Q_NULLPTR; + IDWriteFontFile *fontFile = nullptr; UINT32 numberOfFiles = 1; if (SUCCEEDED(m_directWriteFontFace->GetFiles(&numberOfFiles, &fontFile))) { m_faceId.filename = QFile::encodeName(filenameFromFontFile(fontFile)); @@ -713,7 +713,7 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t, #if defined(QT_USE_DIRECTWRITE2) HRESULT hr = DWRITE_E_NOCOLOR; IDWriteColorGlyphRunEnumerator *enumerator = 0; - IDWriteFactory2 *factory2 = Q_NULLPTR; + IDWriteFactory2 *factory2 = nullptr; if (glyphFormat == QFontEngine::Format_ARGB && SUCCEEDED(m_fontEngineData->directWriteFactory->QueryInterface(__uuidof(IDWriteFactory2), reinterpret_cast<void **>(&factory2)))) { diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite_p.h b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite_p.h index db4e79e44f..83fdddfa26 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite_p.h +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite_p.h @@ -80,41 +80,41 @@ public: void initFontInfo(const QFontDef &request, int dpi); - QFixed lineThickness() const Q_DECL_OVERRIDE; - QFixed underlinePosition() const Q_DECL_OVERRIDE; - bool getSfntTableData(uint tag, uchar *buffer, uint *length) const Q_DECL_OVERRIDE; - QFixed emSquareSize() const Q_DECL_OVERRIDE; + QFixed lineThickness() const override; + QFixed underlinePosition() const override; + bool getSfntTableData(uint tag, uchar *buffer, uint *length) const override; + QFixed emSquareSize() const override; - glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE; + glyph_t glyphIndex(uint ucs4) const override; bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, - ShaperFlags flags) const Q_DECL_OVERRIDE; - void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const Q_DECL_OVERRIDE; + ShaperFlags flags) const override; + void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const override; void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, - QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE; + QPainterPath *path, QTextItem::RenderFlags flags) override; - glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE; - glyph_metrics_t boundingBox(glyph_t g) Q_DECL_OVERRIDE; + glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override; + glyph_metrics_t boundingBox(glyph_t g) override; glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, - const QTransform &matrix, GlyphFormat) Q_DECL_OVERRIDE; + const QTransform &matrix, GlyphFormat) override; - QFixed ascent() const Q_DECL_OVERRIDE; - QFixed capHeight() const Q_DECL_OVERRIDE; - QFixed descent() const Q_DECL_OVERRIDE; - QFixed leading() const Q_DECL_OVERRIDE; - QFixed xHeight() const Q_DECL_OVERRIDE; - qreal maxCharWidth() const Q_DECL_OVERRIDE; - FaceId faceId() const Q_DECL_OVERRIDE; + QFixed ascent() const override; + QFixed capHeight() const override; + QFixed descent() const override; + QFixed leading() const override; + QFixed xHeight() const override; + qreal maxCharWidth() const override; + FaceId faceId() const override; - bool supportsSubPixelPositions() const Q_DECL_OVERRIDE; + bool supportsSubPixelPositions() const override; - QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) Q_DECL_OVERRIDE; - QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE; - QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform) Q_DECL_OVERRIDE; - QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE; + QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) override; + QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) override; + QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform) override; + QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override; - QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE; - Qt::HANDLE handle() const Q_DECL_OVERRIDE; + QFontEngine *cloneWithSize(qreal pixelSize) const override; + Qt::HANDLE handle() const override; const QSharedPointer<QWindowsFontEngineData> &fontEngineData() const { return m_fontEngineData; } diff --git a/src/platformsupport/fontdatabases/windows/qwindowsnativeimage.cpp b/src/platformsupport/fontdatabases/windows/qwindowsnativeimage.cpp index f8fcff952a..67a6619b91 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsnativeimage.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsnativeimage.cpp @@ -98,7 +98,7 @@ static inline HBITMAP createDIB(HDC hdc, int width, int height, bmi.blueMask = 0; } - uchar *bits = Q_NULLPTR; + uchar *bits = nullptr; HBITMAP bitmap = CreateDIBSection(hdc, reinterpret_cast<BITMAPINFO *>(&bmi), DIB_RGB_COLORS, reinterpret_cast<void **>(&bits), 0, 0); if (Q_UNLIKELY(!bitmap || !bits)) diff --git a/src/platformsupport/graphics/qrasterbackingstore_p.h b/src/platformsupport/graphics/qrasterbackingstore_p.h index 2764fd6432..357e861d1d 100644 --- a/src/platformsupport/graphics/qrasterbackingstore_p.h +++ b/src/platformsupport/graphics/qrasterbackingstore_p.h @@ -62,12 +62,12 @@ public: QRasterBackingStore(QWindow *window); ~QRasterBackingStore(); - void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE; - bool scroll(const QRegion &area, int dx, int dy) Q_DECL_OVERRIDE; - void beginPaint(const QRegion ®ion) Q_DECL_OVERRIDE; + void resize(const QSize &size, const QRegion &staticContents) override; + bool scroll(const QRegion &area, int dx, int dy) override; + void beginPaint(const QRegion ®ion) override; - QPaintDevice *paintDevice() Q_DECL_OVERRIDE; - QImage toImage() const Q_DECL_OVERRIDE; + QPaintDevice *paintDevice() override; + QImage toImage() const override; protected: virtual QImage::Format format() const; diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp index 960f1d2f12..2d6426db7f 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp @@ -71,7 +71,7 @@ void QFdContainer::reset() Q_DECL_NOTHROW } QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, QFdContainer &fd, bool disableZap, bool enableCompose, const QString &keymapFile) - : m_device(device), m_fd(fd.release()), m_notify(Q_NULLPTR), + : m_device(device), m_fd(fd.release()), m_notify(nullptr), m_modifiers(0), m_composing(0), m_dead_unicode(0xffff), m_no_zap(disableZap), m_do_compose(enableCompose), m_keymap(0), m_keymap_size(0), m_keycompose(0), m_keycompose_size(0) @@ -172,7 +172,7 @@ void QEvdevKeyboardHandler::readKeycode() // by the above error over and over again. if (errno == ENODEV) { delete m_notify; - m_notify = Q_NULLPTR; + m_notify = nullptr; m_fd.reset(); } return; diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp index 8614de066f..04372ae4d9 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp +++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp @@ -184,7 +184,7 @@ void QEvdevMouseHandler::sendMouseEvent() m_prevInvalid = false; } - emit handleMouseEvent(x, y, m_abs, m_buttons); + emit handleMouseEvent(x, y, m_abs, m_buttons, m_button, m_eventType); m_prevx = m_x; m_prevy = m_y; @@ -210,7 +210,7 @@ void QEvdevMouseHandler::readMouseData() // by the above error over and over again. if (errno == ENODEV) { delete m_notify; - m_notify = Q_NULLPTR; + m_notify = nullptr; qt_safe_close(m_fd); m_fd = -1; } @@ -286,6 +286,8 @@ void QEvdevMouseHandler::readMouseData() case 0x11f: button = Qt::ExtraButton13; break; } m_buttons.setFlag(button, data->value); + m_button = button; + m_eventType = data->value == 0 ? QEvent::MouseButtonRelease : QEvent::MouseButtonPress; btnChanged = true; } else if (data->type == EV_SYN && data->code == SYN_REPORT) { if (btnChanged) { @@ -293,6 +295,7 @@ void QEvdevMouseHandler::readMouseData() sendMouseEvent(); pendingMouseEvent = false; } else if (posChanged) { + m_eventType = QEvent::MouseMove; posChanged = false; if (m_compression) { pendingMouseEvent = true; diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h index 6cad4b9173..c7f2b04eb2 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h +++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h @@ -54,6 +54,7 @@ #include <QObject> #include <QString> #include <QPoint> +#include <QEvent> QT_BEGIN_NAMESPACE @@ -69,7 +70,8 @@ public: void readMouseData(); signals: - void handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons); + void handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons, + Qt::MouseButton button, QEvent::Type type); void handleWheelEvent(QPoint delta); private: @@ -86,6 +88,8 @@ private: bool m_abs; bool m_compression; Qt::MouseButtons m_buttons; + Qt::MouseButton m_button; + QEvent::Type m_eventType; int m_jitterLimitSquared; bool m_prevInvalid; int m_hardwareWidth; diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp index ba94bcd460..5264736dd6 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp +++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp @@ -131,7 +131,8 @@ void QEvdevMouseManager::clampPosition() m_y = g.bottom() - m_yoffset; } -void QEvdevMouseManager::handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons) +void QEvdevMouseManager::handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons, + Qt::MouseButton button, QEvent::Type type) { // update current absolute coordinates if (!abs) { @@ -147,7 +148,8 @@ void QEvdevMouseManager::handleMouseEvent(int x, int y, bool abs, Qt::MouseButto QPoint pos(m_x + m_xoffset, m_y + m_yoffset); // Cannot track the keyboard modifiers ourselves here. Instead, report the // modifiers from the last key event that has been seen by QGuiApplication. - QWindowSystemInterface::handleMouseEvent(0, pos, pos, buttons, QGuiApplication::keyboardModifiers()); + Qt::KeyboardModifiers mods = QGuiApplication::keyboardModifiers(); + QWindowSystemInterface::handleMouseEvent(0, pos, pos, buttons, button, type, mods); } void QEvdevMouseManager::handleWheelEvent(QPoint delta) diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h index 10703655b3..13a8e3dec5 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h +++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h @@ -68,7 +68,8 @@ public: QEvdevMouseManager(const QString &key, const QString &specification, QObject *parent = 0); ~QEvdevMouseManager(); - void handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons); + void handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons, + Qt::MouseButton button, QEvent::Type type); void handleWheelEvent(QPoint delta); void addMouse(const QString &deviceNode = QString()); diff --git a/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h b/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h index 8d848d6ebb..66e821117a 100644 --- a/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h +++ b/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h @@ -85,7 +85,7 @@ class QEvdevTabletHandlerThread : public QDaemonThread public: explicit QEvdevTabletHandlerThread(const QString &device, const QString &spec, QObject *parent = 0); ~QEvdevTabletHandlerThread(); - void run() Q_DECL_OVERRIDE; + void run() override; QEvdevTabletHandler *handler() { return m_handler; } private: diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index c7595cf2b3..0ab4c65c45 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -192,9 +192,9 @@ static inline bool testBit(long bit, const long *array) #endif QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const QString &spec, QObject *parent) - : QObject(parent), m_notify(Q_NULLPTR), m_fd(-1), d(Q_NULLPTR), m_device(Q_NULLPTR) + : QObject(parent), m_notify(nullptr), m_fd(-1), d(nullptr), m_device(nullptr) #if QT_CONFIG(mtdev) - , m_mtdev(Q_NULLPTR) + , m_mtdev(nullptr) #endif { setObjectName(QLatin1String("Evdev Touch Handler")); @@ -427,7 +427,7 @@ err: qErrnoWarning(errno, "evdevtouch: Could not read from input device"); if (errno == ENODEV) { // device got disconnected -> stop reading delete m_notify; - m_notify = Q_NULLPTR; + m_notify = nullptr; QT_CLOSE(m_fd); m_fd = -1; @@ -466,7 +466,7 @@ void QEvdevTouchScreenHandler::unregisterTouchDevice() delete m_device; } - m_device = Q_NULLPTR; + m_device = nullptr; } void QEvdevTouchScreenData::addTouchPoint(const Contact &contact, Qt::TouchPointStates *combinedStates) @@ -781,13 +781,13 @@ void QEvdevTouchScreenData::reportPoints() if (m_filtered) emit q->touchPointsUpdated(); else - QWindowSystemInterface::handleTouchEvent(Q_NULLPTR, q->touchDevice(), m_touchPoints); + QWindowSystemInterface::handleTouchEvent(nullptr, q->touchDevice(), m_touchPoints); } QEvdevTouchScreenHandlerThread::QEvdevTouchScreenHandlerThread(const QString &device, const QString &spec, QObject *parent) - : QDaemonThread(parent), m_device(device), m_spec(spec), m_handler(Q_NULLPTR), m_touchDeviceRegistered(false) + : QDaemonThread(parent), m_device(device), m_spec(spec), m_handler(nullptr), m_touchDeviceRegistered(false) , m_touchUpdatePending(false) - , m_filterWindow(Q_NULLPTR) + , m_filterWindow(nullptr) , m_touchRate(-1) { start(); @@ -812,7 +812,7 @@ void QEvdevTouchScreenHandlerThread::run() exec(); delete m_handler; - m_handler = Q_NULLPTR; + m_handler = nullptr; } bool QEvdevTouchScreenHandlerThread::isTouchDeviceRegistered() const @@ -953,7 +953,7 @@ void QEvdevTouchScreenHandlerThread::filterAndSendTouchPoints() m_filteredPoints = filteredPoints; - QWindowSystemInterface::handleTouchEvent(Q_NULLPTR, + QWindowSystemInterface::handleTouchEvent(nullptr, m_handler->touchDevice(), points); } diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h index a0b689a89e..56308d0352 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h @@ -75,7 +75,7 @@ class QEvdevTouchScreenHandler : public QObject Q_OBJECT public: - explicit QEvdevTouchScreenHandler(const QString &device, const QString &spec = QString(), QObject *parent = Q_NULLPTR); + explicit QEvdevTouchScreenHandler(const QString &device, const QString &spec = QString(), QObject *parent = nullptr); ~QEvdevTouchScreenHandler(); QTouchDevice *touchDevice() const; @@ -107,13 +107,13 @@ class QEvdevTouchScreenHandlerThread : public QDaemonThread { Q_OBJECT public: - explicit QEvdevTouchScreenHandlerThread(const QString &device, const QString &spec, QObject *parent = Q_NULLPTR); + explicit QEvdevTouchScreenHandlerThread(const QString &device, const QString &spec, QObject *parent = nullptr); ~QEvdevTouchScreenHandlerThread(); - void run() Q_DECL_OVERRIDE; + void run() override; bool isTouchDeviceRegistered() const; - bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE; + bool eventFilter(QObject *object, QEvent *event) override; void scheduleTouchPointUpdate(); diff --git a/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp b/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp index 8089a6e38b..e472693077 100644 --- a/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp +++ b/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp @@ -75,8 +75,8 @@ public: { CheckSuccess(gh_hid_close(handle)); }; - void process_event(void) Q_DECL_OVERRIDE; - void async_wait(void) Q_DECL_OVERRIDE; + void process_event(void) override; + void async_wait(void) override; HIDDriver *get_driver(void) { return driver; }; HIDHandle get_handle(void) { return handle; }; private: @@ -94,8 +94,8 @@ public: { qDeleteAll(devices); }; - void process_event(void) Q_DECL_OVERRIDE; - void async_wait(void) Q_DECL_OVERRIDE; + void process_event(void) override; + void async_wait(void) override; void find_devices(void); private: QHash<Value, HIDDeviceHandler *> devices; diff --git a/src/platformsupport/input/libinput/qlibinputhandler.cpp b/src/platformsupport/input/libinput/qlibinputhandler.cpp index 733cf7d409..52eaa18f4b 100644 --- a/src/platformsupport/input/libinput/qlibinputhandler.cpp +++ b/src/platformsupport/input/libinput/qlibinputhandler.cpp @@ -94,7 +94,7 @@ QLibInputHandler::QLibInputHandler(const QString &key, const QString &spec) if (Q_UNLIKELY(!m_udev)) qFatal("Failed to get udev context for libinput"); - m_li = libinput_udev_create_context(&liInterface, Q_NULLPTR, m_udev); + m_li = libinput_udev_create_context(&liInterface, nullptr, m_udev); if (Q_UNLIKELY(!m_li)) qFatal("Failed to get libinput context"); @@ -140,7 +140,7 @@ void QLibInputHandler::onReadyRead() } libinput_event *ev; - while ((ev = libinput_get_event(m_li)) != Q_NULLPTR) { + while ((ev = libinput_get_event(m_li)) != nullptr) { processEvent(ev); libinput_event_destroy(ev); } diff --git a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp index f14a2e8f04..21f7fde7c8 100644 --- a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp +++ b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp @@ -143,7 +143,7 @@ QLibInputKeyboard::QLibInputKeyboard() qWarning("Failed to create xkb context"); return; } - m_keymap = xkb_keymap_new_from_names(m_ctx, Q_NULLPTR, XKB_KEYMAP_COMPILE_NO_FLAGS); + m_keymap = xkb_keymap_new_from_names(m_ctx, nullptr, XKB_KEYMAP_COMPILE_NO_FLAGS); if (!m_keymap) { qWarning("Failed to compile keymap"); return; @@ -211,7 +211,7 @@ void QLibInputKeyboard::processKey(libinput_event_keyboard *e) xkb_state_update_key(m_state, k, pressed ? XKB_KEY_DOWN : XKB_KEY_UP); - QWindowSystemInterface::handleExtendedKeyEvent(Q_NULLPTR, + QWindowSystemInterface::handleExtendedKeyEvent(nullptr, pressed ? QEvent::KeyPress : QEvent::KeyRelease, qtkey, mods, k, sym, mods, text); @@ -237,7 +237,7 @@ void QLibInputKeyboard::processKey(libinput_event_keyboard *e) #ifndef QT_NO_XKBCOMMON_EVDEV void QLibInputKeyboard::handleRepeat() { - QWindowSystemInterface::handleExtendedKeyEvent(Q_NULLPTR, QEvent::KeyPress, + QWindowSystemInterface::handleExtendedKeyEvent(nullptr, QEvent::KeyPress, m_repeatData.qtkey, m_repeatData.mods, m_repeatData.nativeScanCode, m_repeatData.virtualKey, m_repeatData.nativeMods, m_repeatData.unicodeText, true, m_repeatData.repeatCount); diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp index 6879d0cd83..12379a83fa 100644 --- a/src/platformsupport/input/libinput/qlibinputpointer.cpp +++ b/src/platformsupport/input/libinput/qlibinputpointer.cpp @@ -39,6 +39,7 @@ #include "qlibinputpointer_p.h" #include <libinput.h> +#include <QtCore/QEvent> #include <QtGui/QGuiApplication> #include <QtGui/QScreen> #include <qpa/qwindowsysteminterface.h> @@ -78,7 +79,10 @@ void QLibInputPointer::processButton(libinput_event_pointer *e) m_buttons.setFlag(button, pressed); - QWindowSystemInterface::handleMouseEvent(Q_NULLPTR, m_pos, m_pos, m_buttons, QGuiApplication::keyboardModifiers()); + QEvent::Type type = pressed ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; + Qt::KeyboardModifiers mods = QGuiApplication::keyboardModifiers(); + + QWindowSystemInterface::handleMouseEvent(nullptr, m_pos, m_pos, m_buttons, button, type, mods); } void QLibInputPointer::processMotion(libinput_event_pointer *e) @@ -91,7 +95,10 @@ void QLibInputPointer::processMotion(libinput_event_pointer *e) m_pos.setX(qBound(g.left(), qRound(m_pos.x() + dx), g.right())); m_pos.setY(qBound(g.top(), qRound(m_pos.y() + dy), g.bottom())); - QWindowSystemInterface::handleMouseEvent(Q_NULLPTR, m_pos, m_pos, m_buttons, QGuiApplication::keyboardModifiers()); + Qt::KeyboardModifiers mods = QGuiApplication::keyboardModifiers(); + + QWindowSystemInterface::handleMouseEvent(nullptr, m_pos, m_pos, m_buttons, + Qt::NoButton, QEvent::MouseMove, mods); } void QLibInputPointer::processAxis(libinput_event_pointer *e) diff --git a/src/platformsupport/input/libinput/qlibinputtouch.cpp b/src/platformsupport/input/libinput/qlibinputtouch.cpp index 42925a18e1..a65bc91c39 100644 --- a/src/platformsupport/input/libinput/qlibinputtouch.cpp +++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp @@ -53,7 +53,7 @@ QWindowSystemInterface::TouchPoint *QLibInputTouch::DeviceState::point(int32_t s if (m_points.at(i).id == id) return &m_points[i]; - return Q_NULLPTR; + return nullptr; } QLibInputTouch::DeviceState *QLibInputTouch::deviceState(libinput_event_touch *e) @@ -150,7 +150,7 @@ void QLibInputTouch::processTouchCancel(libinput_event_touch *e) { DeviceState *state = deviceState(e); if (state->m_touchDevice) - QWindowSystemInterface::handleTouchCancelEvent(Q_NULLPTR, state->m_touchDevice, QGuiApplication::keyboardModifiers()); + QWindowSystemInterface::handleTouchCancelEvent(nullptr, state->m_touchDevice, QGuiApplication::keyboardModifiers()); else qWarning("TouchCancel without registered device"); } @@ -165,7 +165,7 @@ void QLibInputTouch::processTouchFrame(libinput_event_touch *e) if (state->m_points.isEmpty()) return; - QWindowSystemInterface::handleTouchEvent(Q_NULLPTR, state->m_touchDevice, state->m_points, + QWindowSystemInterface::handleTouchEvent(nullptr, state->m_touchDevice, state->m_points, QGuiApplication::keyboardModifiers()); for (int i = 0; i < state->m_points.count(); ++i) { diff --git a/src/platformsupport/kmsconvenience/qkmsdevice.cpp b/src/platformsupport/kmsconvenience/qkmsdevice.cpp index a25a1e582f..59db3da776 100644 --- a/src/platformsupport/kmsconvenience/qkmsdevice.cpp +++ b/src/platformsupport/kmsconvenience/qkmsdevice.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Copyright (C) 2016 Pelagicore AG ** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> ** Contact: https://www.qt.io/licensing/ @@ -47,6 +47,8 @@ #include <QtCore/QFile> #include <QtCore/QLoggingCategory> +#include <errno.h> + #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) QT_BEGIN_NAMESPACE @@ -75,7 +77,7 @@ int QKmsDevice::crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr co for (int j = 0; j < resources->count_crtcs; j++) { bool isPossible = possibleCrtcs & (1 << j); - bool isAvailable = !(m_crtc_allocator & 1 << resources->crtcs[j]); + bool isAvailable = !(m_crtc_allocator & (1 << j)); if (isPossible && isAvailable) return j; @@ -162,22 +164,24 @@ static bool parseModeline(const QByteArray &text, drmModeModeInfoPtr mode) QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, - VirtualDesktopInfo *vinfo) + ScreenInfo *vinfo) { + Q_ASSERT(vinfo); const QByteArray connectorName = nameForConnector(connector); const int crtc = crtcForConnector(resources, connector); if (crtc < 0) { qWarning() << "No usable crtc/encoder pair for connector" << connectorName; - return Q_NULLPTR; + return nullptr; } OutputConfiguration configuration; QSize configurationSize; + int configurationRefresh = 0; drmModeModeInfo configurationModeline; auto userConfig = m_screenConfig->outputSettings(); - auto userConnectorConfig = userConfig.value(QString::fromUtf8(connectorName)); + QVariantMap userConnectorConfig = userConfig.value(QString::fromUtf8(connectorName)); // default to the preferred mode unless overridden in the config const QByteArray mode = userConnectorConfig.value(QStringLiteral("mode"), QStringLiteral("preferred")) .toByteArray().toLower(); @@ -187,6 +191,10 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, configuration = OutputConfigPreferred; } else if (mode == "current") { configuration = OutputConfigCurrent; + } else if (sscanf(mode.constData(), "%dx%d@%d", &configurationSize.rwidth(), &configurationSize.rheight(), + &configurationRefresh) == 3) + { + configuration = OutputConfigMode; } else if (sscanf(mode.constData(), "%dx%d", &configurationSize.rwidth(), &configurationSize.rheight()) == 2) { configuration = OutputConfigMode; } else if (parseModeline(mode, &configurationModeline)) { @@ -195,31 +203,30 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, qWarning("Invalid mode \"%s\" for output %s", mode.constData(), connectorName.constData()); configuration = OutputConfigPreferred; } - if (vinfo) { - *vinfo = VirtualDesktopInfo(); - vinfo->virtualIndex = userConnectorConfig.value(QStringLiteral("virtualIndex"), INT_MAX).toInt(); - if (userConnectorConfig.contains(QStringLiteral("virtualPos"))) { - const QByteArray vpos = userConnectorConfig.value(QStringLiteral("virtualPos")).toByteArray(); - const QByteArrayList vposComp = vpos.split(','); - if (vposComp.count() == 2) - vinfo->virtualPos = QPoint(vposComp[0].trimmed().toInt(), vposComp[1].trimmed().toInt()); - } - if (userConnectorConfig.value(QStringLiteral("primary")).toBool()) - vinfo->isPrimary = true; + + *vinfo = ScreenInfo(); + vinfo->virtualIndex = userConnectorConfig.value(QStringLiteral("virtualIndex"), INT_MAX).toInt(); + if (userConnectorConfig.contains(QStringLiteral("virtualPos"))) { + const QByteArray vpos = userConnectorConfig.value(QStringLiteral("virtualPos")).toByteArray(); + const QByteArrayList vposComp = vpos.split(','); + if (vposComp.count() == 2) + vinfo->virtualPos = QPoint(vposComp[0].trimmed().toInt(), vposComp[1].trimmed().toInt()); } + if (userConnectorConfig.value(QStringLiteral("primary")).toBool()) + vinfo->isPrimary = true; const uint32_t crtc_id = resources->crtcs[crtc]; if (configuration == OutputConfigOff) { qCDebug(qLcKmsDebug) << "Turning off output" << connectorName; - drmModeSetCrtc(m_dri_fd, crtc_id, 0, 0, 0, 0, 0, Q_NULLPTR); - return Q_NULLPTR; + drmModeSetCrtc(m_dri_fd, crtc_id, 0, 0, 0, 0, 0, nullptr); + return nullptr; } // Skip disconnected output if (configuration == OutputConfigPreferred && connector->connection == DRM_MODE_DISCONNECTED) { qCDebug(qLcKmsDebug) << "Skipping disconnected output" << connectorName; - return Q_NULLPTR; + return nullptr; } // Get the current mode on the current crtc @@ -230,7 +237,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, drmModeFreeEncoder(encoder); if (!crtc) - return Q_NULLPTR; + return nullptr; if (crtc->mode_valid) crtc_mode = crtc->mode; @@ -240,7 +247,8 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, QList<drmModeModeInfo> modes; modes.reserve(connector->count_modes); - qCDebug(qLcKmsDebug) << connectorName << "mode count:" << connector->count_modes; + qCDebug(qLcKmsDebug) << connectorName << "mode count:" << connector->count_modes + << "crtc index:" << crtc << "crtc id:" << crtc_id; for (int i = 0; i < connector->count_modes; i++) { const drmModeModeInfo &mode = connector->modes[i]; qCDebug(qLcKmsDebug) << "mode" << i << mode.hdisplay << "x" << mode.vdisplay @@ -256,9 +264,11 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, for (int i = modes.size() - 1; i >= 0; i--) { const drmModeModeInfo &m = modes.at(i); - if (configuration == OutputConfigMode && - m.hdisplay == configurationSize.width() && - m.vdisplay == configurationSize.height()) { + if (configuration == OutputConfigMode + && m.hdisplay == configurationSize.width() + && m.vdisplay == configurationSize.height() + && (!configurationRefresh || m.vrefresh == uint32_t(configurationRefresh))) + { configured = i; } @@ -297,7 +307,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, if (selected_mode < 0) { qWarning() << "No modes available for output" << connectorName; - return Q_NULLPTR; + return nullptr; } else { int width = modes[selected_mode].hdisplay; int height = modes[selected_mode].vdisplay; @@ -324,24 +334,72 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, } qCDebug(qLcKmsDebug) << "Physical size is" << physSize << "mm" << "for output" << connectorName; - QKmsOutput output = { - QString::fromUtf8(connectorName), - connector->connector_id, - crtc_id, - physSize, - selected_mode, - selected_mode, - false, - drmModeGetCrtc(m_dri_fd, crtc_id), - modes, - connector->subpixel, - connectorProperty(connector, QByteArrayLiteral("DPMS")), - connectorPropertyBlob(connector, QByteArrayLiteral("EDID")), - false, - 0, - false - }; + const QByteArray formatStr = userConnectorConfig.value(QStringLiteral("format"), QStringLiteral("xrgb8888")) + .toByteArray().toLower(); + uint32_t drmFormat; + if (formatStr == "xrgb8888") { + drmFormat = DRM_FORMAT_XRGB8888; + } else if (formatStr == "xbgr8888") { + drmFormat = DRM_FORMAT_XBGR8888; + } else if (formatStr == "argb8888") { + drmFormat = DRM_FORMAT_ARGB8888; + } else if (formatStr == "abgr8888") { + drmFormat = DRM_FORMAT_ABGR8888; + } else if (formatStr == "rgb565") { + drmFormat = DRM_FORMAT_RGB565; + } else if (formatStr == "bgr565") { + drmFormat = DRM_FORMAT_BGR565; + } else if (formatStr == "xrgb2101010") { + drmFormat = DRM_FORMAT_XRGB2101010; + } else if (formatStr == "xbgr2101010") { + drmFormat = DRM_FORMAT_XBGR2101010; + } else if (formatStr == "argb2101010") { + drmFormat = DRM_FORMAT_ARGB2101010; + } else if (formatStr == "abgr2101010") { + drmFormat = DRM_FORMAT_ABGR2101010; + } else { + qWarning("Invalid pixel format \"%s\" for output %s", formatStr.constData(), connectorName.constData()); + drmFormat = DRM_FORMAT_XRGB8888; + } + + const QString cloneSource = userConnectorConfig.value(QStringLiteral("clones")).toString(); + if (!cloneSource.isEmpty()) + qCDebug(qLcKmsDebug) << "Output" << connectorName << " clones output " << cloneSource; + + QKmsOutput output; + output.name = QString::fromUtf8(connectorName); + output.connector_id = connector->connector_id; + output.crtc_index = crtc; + output.crtc_id = crtc_id; + output.physical_size = physSize; + output.preferred_mode = preferred >= 0 ? preferred : selected_mode; + output.mode = selected_mode; + output.mode_set = false; + output.saved_crtc = drmModeGetCrtc(m_dri_fd, crtc_id); + output.modes = modes; + output.subpixel = connector->subpixel; + output.dpms_prop = connectorProperty(connector, QByteArrayLiteral("DPMS")); + output.edid_blob = connectorPropertyBlob(connector, QByteArrayLiteral("EDID")); + output.wants_forced_plane = false; + output.forced_plane_id = 0; + output.forced_plane_set = false; + output.drm_format = drmFormat; + output.clone_source = cloneSource; + + QString planeListStr; + for (const QKmsPlane &plane : qAsConst(m_planes)) { + if (plane.possibleCrtcs & (1 << output.crtc_index)) { + output.available_planes.append(plane); + planeListStr.append(QString::number(plane.id)); + planeListStr.append(QLatin1Char(' ')); + } + } + qCDebug(qLcKmsDebug, "Output %s can use %d planes: %s", + connectorName.constData(), output.available_planes.count(), qPrintable(planeListStr)); + // This is for the EGLDevice/EGLStream backend. On some of those devices one + // may want to target a pre-configured plane. It is probably useless for + // eglfs_kms and others. Do not confuse with generic plane support (available_planes). bool ok; int idx = qEnvironmentVariableIntValue("QT_QPA_EGLFS_KMS_PLANE_INDEX", &ok); if (ok) { @@ -350,8 +408,8 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, if (idx >= 0 && idx < int(planeResources->count_planes)) { drmModePlane *plane = drmModeGetPlane(m_dri_fd, planeResources->planes[idx]); if (plane) { - output.wants_plane = true; - output.plane_id = plane->plane_id; + output.wants_forced_plane = true; + output.forced_plane_id = plane->plane_id; qCDebug(qLcKmsDebug, "Forcing plane index %d, plane id %u (belongs to crtc id %u)", idx, plane->plane_id, plane->crtc_id); drmModeFreePlane(plane); @@ -362,8 +420,9 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, } } - m_crtc_allocator |= (1 << output.crtc_id); - m_connector_allocator |= (1 << output.connector_id); + m_crtc_allocator |= (1 << output.crtc_index); + + vinfo->output = output; return createScreen(output); } @@ -381,7 +440,7 @@ drmModePropertyPtr QKmsDevice::connectorProperty(drmModeConnectorPtr connector, drmModeFreeProperty(prop); } - return Q_NULLPTR; + return nullptr; } drmModePropertyBlobPtr QKmsDevice::connectorPropertyBlob(drmModeConnectorPtr connector, const QByteArray &name) @@ -406,7 +465,6 @@ QKmsDevice::QKmsDevice(QKmsScreenConfig *screenConfig, const QString &path) , m_path(path) , m_dri_fd(-1) , m_crtc_allocator(0) - , m_connector_allocator(0) { if (m_path.isEmpty()) { m_path = m_screenConfig->devicePath(); @@ -425,10 +483,10 @@ QKmsDevice::~QKmsDevice() struct OrderedScreen { OrderedScreen() : screen(nullptr) { } - OrderedScreen(QPlatformScreen *screen, const QKmsDevice::VirtualDesktopInfo &vinfo) + OrderedScreen(QPlatformScreen *screen, const QKmsDevice::ScreenInfo &vinfo) : screen(screen), vinfo(vinfo) { } QPlatformScreen *screen; - QKmsDevice::VirtualDesktopInfo vinfo; + QKmsDevice::ScreenInfo vinfo; }; QDebug operator<<(QDebug dbg, const OrderedScreen &s) @@ -449,12 +507,29 @@ static bool orderedScreenLessThan(const OrderedScreen &a, const OrderedScreen &b void QKmsDevice::createScreens() { + // Headless mode using a render node: cannot do any output related DRM + // stuff. Skip it all and register a dummy screen. + if (m_screenConfig->headless()) { + QPlatformScreen *screen = createHeadlessScreen(); + if (screen) { + qCDebug(qLcKmsDebug, "Headless mode enabled"); + registerScreen(screen, true, QPoint(0, 0), QList<QPlatformScreen *>()); + return; + } else { + qWarning("QKmsDevice: Requested headless mode without support in the backend. Request is ignored."); + } + } + + drmSetClientCap(m_dri_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1); + drmModeResPtr resources = drmModeGetResources(m_dri_fd); if (!resources) { - qWarning("drmModeGetResources failed"); + qErrnoWarning(errno, "drmModeGetResources failed"); return; } + discoverPlanes(); + QVector<OrderedScreen> screens; int wantedConnectorIndex = -1; @@ -475,7 +550,7 @@ void QKmsDevice::createScreens() if (!connector) continue; - VirtualDesktopInfo vinfo; + ScreenInfo vinfo; QPlatformScreen *screen = createScreenForConnector(resources, connector, &vinfo); if (screen) screens.append(OrderedScreen(screen, vinfo)); @@ -490,6 +565,32 @@ void QKmsDevice::createScreens() std::stable_sort(screens.begin(), screens.end(), orderedScreenLessThan); qCDebug(qLcKmsDebug) << "Sorted screen list:" << screens; + // The final list of screens is available, so do the second phase setup. + // Hook up clone sources and targets. + for (const OrderedScreen &orderedScreen : screens) { + QVector<QPlatformScreen *> screensCloningThisScreen; + for (const OrderedScreen &s : screens) { + if (s.vinfo.output.clone_source == orderedScreen.vinfo.output.name) + screensCloningThisScreen.append(s.screen); + } + QPlatformScreen *screenThisScreenClones = nullptr; + if (!orderedScreen.vinfo.output.clone_source.isEmpty()) { + for (const OrderedScreen &s : screens) { + if (s.vinfo.output.name == orderedScreen.vinfo.output.clone_source) { + screenThisScreenClones = s.screen; + break; + } + } + } + if (screenThisScreenClones) + qCDebug(qLcKmsDebug) << orderedScreen.screen->name() << "clones" << screenThisScreenClones; + if (!screensCloningThisScreen.isEmpty()) + qCDebug(qLcKmsDebug) << orderedScreen.screen->name() << "is cloned by" << screensCloningThisScreen; + + registerScreenCloning(orderedScreen.screen, screenThisScreenClones, screensCloningThisScreen); + } + + // Figure out the virtual desktop and register the screens to QPA/QGuiApplication. QPoint pos(0, 0); QList<QPlatformScreen *> siblings; QVector<QPoint> virtualPositions; @@ -531,6 +632,132 @@ void QKmsDevice::createScreens() } } +QPlatformScreen *QKmsDevice::createHeadlessScreen() +{ + // headless mode not supported by default + return nullptr; +} + +// not all subclasses support screen cloning +void QKmsDevice::registerScreenCloning(QPlatformScreen *screen, + QPlatformScreen *screenThisScreenClones, + const QVector<QPlatformScreen *> &screensCloningThisScreen) +{ + Q_UNUSED(screen); + Q_UNUSED(screenThisScreenClones); + Q_UNUSED(screensCloningThisScreen); +} + +// drm_property_type_is is not available in old headers +static inline bool propTypeIs(drmModePropertyPtr prop, uint32_t type) +{ + if (prop->flags & DRM_MODE_PROP_EXTENDED_TYPE) + return (prop->flags & DRM_MODE_PROP_EXTENDED_TYPE) == type; + return prop->flags & type; +} + +void QKmsDevice::enumerateProperties(drmModeObjectPropertiesPtr objProps, PropCallback callback) +{ + for (uint32_t propIdx = 0; propIdx < objProps->count_props; ++propIdx) { + drmModePropertyPtr prop = drmModeGetProperty(m_dri_fd, objProps->props[propIdx]); + if (!prop) + continue; + + const quint64 value = objProps->prop_values[propIdx]; + qCDebug(qLcKmsDebug, " property %d: id = %u name = '%s'", propIdx, prop->prop_id, prop->name); + + if (propTypeIs(prop, DRM_MODE_PROP_SIGNED_RANGE)) { + qCDebug(qLcKmsDebug, " type is SIGNED_RANGE, value is %lld, possible values are:", qint64(value)); + for (int i = 0; i < prop->count_values; ++i) + qCDebug(qLcKmsDebug, " %lld", qint64(prop->values[i])); + } else if (propTypeIs(prop, DRM_MODE_PROP_RANGE)) { + qCDebug(qLcKmsDebug, " type is RANGE, value is %llu, possible values are:", value); + for (int i = 0; i < prop->count_values; ++i) + qCDebug(qLcKmsDebug, " %llu", quint64(prop->values[i])); + } else if (propTypeIs(prop, DRM_MODE_PROP_ENUM)) { + qCDebug(qLcKmsDebug, " type is ENUM, value is %llu, possible values are:", value); + for (int i = 0; i < prop->count_enums; ++i) + qCDebug(qLcKmsDebug, " enum %d: %s - %llu", i, prop->enums[i].name, prop->enums[i].value); + } else if (propTypeIs(prop, DRM_MODE_PROP_BITMASK)) { + qCDebug(qLcKmsDebug, " type is BITMASK, value is %llu, possible bits are:", value); + for (int i = 0; i < prop->count_enums; ++i) + qCDebug(qLcKmsDebug, " bitmask %d: %s - %u", i, prop->enums[i].name, 1 << prop->enums[i].value); + } else if (propTypeIs(prop, DRM_MODE_PROP_BLOB)) { + qCDebug(qLcKmsDebug, " type is BLOB"); + } else if (propTypeIs(prop, DRM_MODE_PROP_OBJECT)) { + qCDebug(qLcKmsDebug, " type is OBJECT"); + } + + callback(prop, value); + + drmModeFreeProperty(prop); + } +} + +void QKmsDevice::discoverPlanes() +{ + m_planes.clear(); + + drmModePlaneResPtr planeResources = drmModeGetPlaneResources(m_dri_fd); + if (!planeResources) + return; + + const int countPlanes = planeResources->count_planes; + qCDebug(qLcKmsDebug, "Found %d planes", countPlanes); + for (int planeIdx = 0; planeIdx < countPlanes; ++planeIdx) { + drmModePlanePtr drmplane = drmModeGetPlane(m_dri_fd, planeResources->planes[planeIdx]); + if (!drmplane) { + qCDebug(qLcKmsDebug, "Failed to query plane %d, ignoring", planeIdx); + continue; + } + + QKmsPlane plane; + plane.id = drmplane->plane_id; + plane.possibleCrtcs = drmplane->possible_crtcs; + + const int countFormats = drmplane->count_formats; + QString formatStr; + for (int i = 0; i < countFormats; ++i) { + uint32_t f = drmplane->formats[i]; + plane.supportedFormats.append(f); + QString s; + s.sprintf("%c%c%c%c ", f, f >> 8, f >> 16, f >> 24); + formatStr += s; + } + + qCDebug(qLcKmsDebug, "plane %d: id = %u countFormats = %d possibleCrtcs = 0x%x supported formats = %s", + planeIdx, plane.id, countFormats, plane.possibleCrtcs, qPrintable(formatStr)); + + drmModeFreePlane(drmplane); + + drmModeObjectPropertiesPtr objProps = drmModeObjectGetProperties(m_dri_fd, plane.id, DRM_MODE_OBJECT_PLANE); + if (!objProps) { + qCDebug(qLcKmsDebug, "Failed to query plane %d object properties, ignoring", planeIdx); + continue; + } + + enumerateProperties(objProps, [&plane](drmModePropertyPtr prop, quint64 value) { + if (!strcmp(prop->name, "type")) { + plane.type = QKmsPlane::Type(value); + } else if (!strcmp(prop->name, "rotation")) { + plane.initialRotation = QKmsPlane::Rotations(int(value)); + plane.availableRotations = 0; + if (propTypeIs(prop, DRM_MODE_PROP_BITMASK)) { + for (int i = 0; i < prop->count_enums; ++i) + plane.availableRotations |= QKmsPlane::Rotation(1 << prop->enums[i].value); + } + plane.rotationPropertyId = prop->prop_id; + } + }); + + m_planes.append(plane); + + drmModeFreeObjectProperties(objProps); + } + + drmModeFreePlaneResources(planeResources); +} + int QKmsDevice::fd() const { return m_dri_fd; @@ -552,7 +779,8 @@ QKmsScreenConfig *QKmsDevice::screenConfig() const } QKmsScreenConfig::QKmsScreenConfig() - : m_hwCursor(true) + : m_headless(false) + , m_hwCursor(true) , m_separateScreens(false) , m_pbuffers(false) , m_virtualDesktopLayout(VirtualDesktopLayoutHorizontal) @@ -587,6 +815,16 @@ void QKmsScreenConfig::loadConfig() const QJsonObject object = doc.object(); + const QString headlessStr = object.value(QLatin1String("headless")).toString(); + const QByteArray headless = headlessStr.toUtf8(); + QSize headlessSize; + if (sscanf(headless.constData(), "%dx%d", &headlessSize.rwidth(), &headlessSize.rheight()) == 2) { + m_headless = true; + m_headlessSize = headlessSize; + } else { + m_headless = false; + } + m_hwCursor = object.value(QLatin1String("hwcursor")).toBool(m_hwCursor); m_pbuffers = object.value(QLatin1String("pbuffers")).toBool(m_pbuffers); m_devicePath = object.value(QLatin1String("device")).toString(); @@ -618,6 +856,7 @@ void QKmsScreenConfig::loadConfig() } qCDebug(qLcKmsDebug) << "Requested configuration (some settings may be ignored):\n" + << "\theadless:" << m_headless << "\n" << "\thwcursor:" << m_hwCursor << "\n" << "\tpbuffers:" << m_pbuffers << "\n" << "\tseparateScreens:" << m_separateScreens << "\n" diff --git a/src/platformsupport/kmsconvenience/qkmsdevice_p.h b/src/platformsupport/kmsconvenience/qkmsdevice_p.h index 964a0b1775..5eecedec39 100644 --- a/src/platformsupport/kmsconvenience/qkmsdevice_p.h +++ b/src/platformsupport/kmsconvenience/qkmsdevice_p.h @@ -59,6 +59,42 @@ #include <xf86drm.h> #include <xf86drmMode.h> +#include <drm_fourcc.h> + +#include <functional> + +// In less fortunate cases one may need to build on a system with dev headers +// from the dark ages. Let's pull a GL and define the missing stuff outselves. + +#ifndef DRM_PLANE_TYPE_OVERLAY +#define DRM_PLANE_TYPE_OVERLAY 0 +#endif +#ifndef DRM_PLANE_TYPE_PRIMARY +#define DRM_PLANE_TYPE_PRIMARY 1 +#endif +#ifndef DRM_PLANE_TYPE_CURSOR +#define DRM_PLANE_TYPE_CURSOR 2 +#endif + +#ifndef DRM_CLIENT_CAP_UNIVERSAL_PLANES +#define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2 +#endif +#ifndef DRM_CLIENT_CAP_ATOMIC +#define DRM_CLIENT_CAP_ATOMIC 3 +#endif + +#ifndef DRM_MODE_PROP_EXTENDED_TYPE +#define DRM_MODE_PROP_EXTENDED_TYPE 0x0000ffc0 +#endif +#ifndef DRM_MODE_PROP_TYPE +#define DRM_MODE_PROP_TYPE(n) ((n) << 6) +#endif +#ifndef DRM_MODE_PROP_OBJECT +#define DRM_MODE_PROP_OBJECT DRM_MODE_PROP_TYPE(1) +#endif +#ifndef DRM_MODE_PROP_SIGNED_RANGE +#define DRM_MODE_PROP_SIGNED_RANGE DRM_MODE_PROP_TYPE(2) +#endif QT_BEGIN_NAMESPACE @@ -76,6 +112,8 @@ public: QString devicePath() const { return m_devicePath; } + bool headless() const { return m_headless; } + QSize headlessSize() const { return m_headlessSize; } bool hwCursor() const { return m_hwCursor; } bool separateScreens() const { return m_separateScreens; } bool supportsPBuffers() const { return m_pbuffers; } @@ -87,6 +125,8 @@ private: void loadConfig(); QString m_devicePath; + bool m_headless; + QSize m_headlessSize; bool m_hwCursor; bool m_separateScreens; bool m_pbuffers; @@ -94,23 +134,63 @@ private: QMap<QString, QVariantMap> m_outputSettings; }; +// NB! QKmsPlane does not store the current state and offers no functions to +// change object properties. Any such functionality belongs to subclasses since +// in some cases atomic operations will be desired where a mere +// drmModeObjectSetProperty would not be acceptable. +struct QKmsPlane +{ + enum Type { + OverlayPlane = DRM_PLANE_TYPE_OVERLAY, + PrimaryPlane = DRM_PLANE_TYPE_PRIMARY, + CursorPlane = DRM_PLANE_TYPE_CURSOR + }; + + enum Rotation { + Rotation0 = 1 << 0, + Rotation90 = 1 << 1, + Rotation180 = 1 << 2, + Rotation270 = 1 << 3, + RotationReflectX = 1 << 4, + RotationReflectY = 1 << 5 + }; + Q_DECLARE_FLAGS(Rotations, Rotation) + + uint32_t id = 0; + Type type = OverlayPlane; + + int possibleCrtcs = 0; + + QVector<uint32_t> supportedFormats; + + Rotations initialRotation = Rotation0; + Rotations availableRotations = Rotation0; + uint32_t rotationPropertyId = 0; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QKmsPlane::Rotations) + struct QKmsOutput { QString name; - uint32_t connector_id; - uint32_t crtc_id; + uint32_t connector_id = 0; + uint32_t crtc_index = 0; + uint32_t crtc_id = 0; QSizeF physical_size; - int preferred_mode; // index of preferred mode in list below - int mode; // index of selected mode in list below - bool mode_set; - drmModeCrtcPtr saved_crtc; + int preferred_mode = -1; // index of preferred mode in list below + int mode = -1; // index of selected mode in list below + bool mode_set = false; + drmModeCrtcPtr saved_crtc = nullptr; QList<drmModeModeInfo> modes; - int subpixel; - drmModePropertyPtr dpms_prop; - drmModePropertyBlobPtr edid_blob; - bool wants_plane; - uint32_t plane_id; - bool plane_set; + int subpixel = DRM_MODE_SUBPIXEL_UNKNOWN; + drmModePropertyPtr dpms_prop = nullptr; + drmModePropertyBlobPtr edid_blob = nullptr; + bool wants_forced_plane = false; + uint32_t forced_plane_id = 0; + bool forced_plane_set = false; + uint32_t drm_format = DRM_FORMAT_XRGB8888; + QString clone_source; + QVector<QKmsPlane> available_planes; void restoreMode(QKmsDevice *device); void cleanup(QKmsDevice *device); @@ -121,11 +201,11 @@ struct QKmsOutput class QKmsDevice { public: - struct VirtualDesktopInfo { - VirtualDesktopInfo() : virtualIndex(0), isPrimary(false) { } - int virtualIndex; + struct ScreenInfo { + int virtualIndex = 0; QPoint virtualPos; - bool isPrimary; + bool isPrimary = false; + QKmsOutput output; }; QKmsDevice(QKmsScreenConfig *screenConfig, const QString &path = QString()); @@ -144,6 +224,10 @@ public: protected: virtual QPlatformScreen *createScreen(const QKmsOutput &output) = 0; + virtual QPlatformScreen *createHeadlessScreen(); + virtual void registerScreenCloning(QPlatformScreen *screen, + QPlatformScreen *screenThisScreenClones, + const QVector<QPlatformScreen *> &screensCloningThisScreen); virtual void registerScreen(QPlatformScreen *screen, bool isPrimary, const QPoint &virtualPos, @@ -153,16 +237,20 @@ protected: int crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr connector); QPlatformScreen *createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, - VirtualDesktopInfo *vinfo); + ScreenInfo *vinfo); drmModePropertyPtr connectorProperty(drmModeConnectorPtr connector, const QByteArray &name); drmModePropertyBlobPtr connectorPropertyBlob(drmModeConnectorPtr connector, const QByteArray &name); + typedef std::function<void(drmModePropertyPtr, quint64)> PropCallback; + void enumerateProperties(drmModeObjectPropertiesPtr objProps, PropCallback callback); + void discoverPlanes(); QKmsScreenConfig *m_screenConfig; QString m_path; int m_dri_fd; quint32 m_crtc_allocator; - quint32 m_connector_allocator; + + QVector<QKmsPlane> m_planes; private: Q_DISABLE_COPY(QKmsDevice) diff --git a/src/platformsupport/linuxaccessibility/bridge_p.h b/src/platformsupport/linuxaccessibility/bridge_p.h index 1e435ca351..c48bbd3710 100644 --- a/src/platformsupport/linuxaccessibility/bridge_p.h +++ b/src/platformsupport/linuxaccessibility/bridge_p.h @@ -74,7 +74,7 @@ public: virtual ~QSpiAccessibleBridge(); - void notifyAccessibilityUpdate(QAccessibleEvent *event) Q_DECL_OVERRIDE; + void notifyAccessibilityUpdate(QAccessibleEvent *event) override; QDBusConnection dBusConnection() const; public Q_SLOTS: diff --git a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp index e938020437..40400e2a19 100644 --- a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp +++ b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp @@ -196,7 +196,7 @@ void QOpenGLCompositorBackingStore::flush(QWindow *window, const QRegion ®ion dstCtx->makeCurrent(dstWin); updateTexture(); m_textures->clear(); - m_textures->appendTexture(Q_NULLPTR, m_bsTexture, window->geometry()); + m_textures->appendTexture(nullptr, m_bsTexture, window->geometry()); compositor->update(); } @@ -233,7 +233,7 @@ void QOpenGLCompositorBackingStore::composeAndFlush(QWindow *window, const QRegi textures->clipRect(i), textures->flags(i)); updateTexture(); - m_textures->appendTexture(Q_NULLPTR, m_bsTexture, window->geometry()); + m_textures->appendTexture(nullptr, m_bsTexture, window->geometry()); textures->lock(true); m_lockedWidgetTextures = textures; @@ -280,7 +280,7 @@ void QOpenGLCompositorBackingStore::resize(const QSize &size, const QRegion &sta if (m_bsTexture) { glDeleteTextures(1, &m_bsTexture); m_bsTexture = 0; - m_bsTextureContext = Q_NULLPTR; + m_bsTextureContext = nullptr; } } diff --git a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h index da68b90e92..d88738ea8f 100644 --- a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h +++ b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h @@ -66,17 +66,17 @@ public: QOpenGLCompositorBackingStore(QWindow *window); ~QOpenGLCompositorBackingStore(); - QPaintDevice *paintDevice() Q_DECL_OVERRIDE; + QPaintDevice *paintDevice() override; - void beginPaint(const QRegion ®ion) Q_DECL_OVERRIDE; + void beginPaint(const QRegion ®ion) override; - void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) Q_DECL_OVERRIDE; - void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE; + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; + void resize(const QSize &size, const QRegion &staticContents) override; - QImage toImage() const Q_DECL_OVERRIDE; + QImage toImage() const override; void composeAndFlush(QWindow *window, const QRegion ®ion, const QPoint &offset, QPlatformTextureList *textures, - bool translucentBackground) Q_DECL_OVERRIDE; + bool translucentBackground) override; const QPlatformTextureList *textures() const { return m_textures; } diff --git a/src/platformsupport/services/genericunix/qgenericunixservices_p.h b/src/platformsupport/services/genericunix/qgenericunixservices_p.h index 205b2e6160..8ac3de6f03 100644 --- a/src/platformsupport/services/genericunix/qgenericunixservices_p.h +++ b/src/platformsupport/services/genericunix/qgenericunixservices_p.h @@ -61,10 +61,10 @@ class QGenericUnixServices : public QPlatformServices public: QGenericUnixServices() {} - QByteArray desktopEnvironment() const Q_DECL_OVERRIDE; + QByteArray desktopEnvironment() const override; - bool openUrl(const QUrl &url) Q_DECL_OVERRIDE; - bool openDocument(const QUrl &url) Q_DECL_OVERRIDE; + bool openUrl(const QUrl &url) override; + bool openDocument(const QUrl &url) override; private: QString m_webBrowser; diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuadaptor.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuadaptor.cpp index 354b9c3a2e..eabb4b4122 100644 --- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuadaptor.cpp +++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuadaptor.cpp @@ -122,7 +122,7 @@ void QDBusMenuAdaptor::Event(int id, const QString &eventId, const QDBusVariant emit item->hovered(); if (eventId == QLatin1String("closed")) { // There is no explicit AboutToHide method, so map closed event to aboutToHide method - const QDBusPlatformMenu *menu = Q_NULLPTR; + const QDBusPlatformMenu *menu = nullptr; if (item) menu = static_cast<const QDBusPlatformMenu *>(item->menu()); else if (id == 0) diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar_p.h b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar_p.h index 8266a395f5..364e7da4b6 100644 --- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar_p.h +++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar_p.h @@ -67,12 +67,12 @@ public: QDBusMenuBar(); virtual ~QDBusMenuBar(); - void insertMenu(QPlatformMenu *menu, QPlatformMenu *before) Q_DECL_OVERRIDE; - void removeMenu(QPlatformMenu *menu) Q_DECL_OVERRIDE; - void syncMenu(QPlatformMenu *menu) Q_DECL_OVERRIDE; - void handleReparent(QWindow *newParentWindow) Q_DECL_OVERRIDE; - QPlatformMenu *menuForTag(quintptr tag) const Q_DECL_OVERRIDE; - QPlatformMenu *createMenu() const Q_DECL_OVERRIDE; + void insertMenu(QPlatformMenu *menu, QPlatformMenu *before) override; + void removeMenu(QPlatformMenu *menu) override; + void syncMenu(QPlatformMenu *menu) override; + void handleReparent(QWindow *newParentWindow) override; + QPlatformMenu *menuForTag(quintptr tag) const override; + QPlatformMenu *createMenu() const override; private: QDBusPlatformMenu *m_menu; diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu.cpp index 51c690d43a..fc1b37f2f2 100644 --- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu.cpp +++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu.cpp @@ -68,7 +68,7 @@ QDBusPlatformMenuItem::~QDBusPlatformMenuItem() { menuItemsByID.remove(m_dbusID); if (m_subMenu) - static_cast<QDBusPlatformMenu *>(m_subMenu)->setContainingMenuItem(Q_NULLPTR); + static_cast<QDBusPlatformMenu *>(m_subMenu)->setContainingMenuItem(nullptr); } void QDBusPlatformMenuItem::setText(const QString &text) @@ -88,7 +88,7 @@ void QDBusPlatformMenuItem::setIcon(const QIcon &icon) void QDBusPlatformMenuItem::setMenu(QPlatformMenu *menu) { if (m_subMenu) - static_cast<QDBusPlatformMenu *>(m_subMenu)->setContainingMenuItem(Q_NULLPTR); + static_cast<QDBusPlatformMenu *>(m_subMenu)->setContainingMenuItem(nullptr); m_subMenu = menu; if (menu) static_cast<QDBusPlatformMenu *>(menu)->setContainingMenuItem(this); @@ -147,7 +147,7 @@ QDBusPlatformMenuItem *QDBusPlatformMenuItem::byId(int id) // a default-constructed nullptr value into menuItemsByID if (menuItemsByID.contains(id)) return menuItemsByID[id]; - return Q_NULLPTR; + return nullptr; } QList<const QDBusPlatformMenuItem *> QDBusPlatformMenuItem::byIds(const QList<int> &ids) @@ -165,14 +165,14 @@ QDBusPlatformMenu::QDBusPlatformMenu() : m_isEnabled(true) , m_isVisible(true) , m_revision(1) - , m_containingMenuItem(Q_NULLPTR) + , m_containingMenuItem(nullptr) { } QDBusPlatformMenu::~QDBusPlatformMenu() { if (m_containingMenuItem) - m_containingMenuItem->setMenu(Q_NULLPTR); + m_containingMenuItem->setMenu(nullptr); } void QDBusPlatformMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before) diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h b/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h index 5458e2fdd5..8a31f82fb0 100644 --- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h +++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h @@ -77,31 +77,31 @@ public: ~QDBusPlatformMenuItem(); const QString text() const { return m_text; } - void setText(const QString &text) Q_DECL_OVERRIDE; + void setText(const QString &text) override; QIcon icon() const { return m_icon; } - void setIcon(const QIcon &icon) Q_DECL_OVERRIDE; + void setIcon(const QIcon &icon) override; const QPlatformMenu *menu() const { return m_subMenu; } - void setMenu(QPlatformMenu *menu) Q_DECL_OVERRIDE; + void setMenu(QPlatformMenu *menu) override; bool isEnabled() const { return m_isEnabled; } - void setEnabled(bool enabled) Q_DECL_OVERRIDE; + void setEnabled(bool enabled) override; bool isVisible() const { return m_isVisible; } - void setVisible(bool isVisible) Q_DECL_OVERRIDE; + void setVisible(bool isVisible) override; bool isSeparator() const { return m_isSeparator; } - void setIsSeparator(bool isSeparator) Q_DECL_OVERRIDE; - void setFont(const QFont &font) Q_DECL_OVERRIDE { Q_UNUSED(font); } - void setRole(MenuRole role) Q_DECL_OVERRIDE; + void setIsSeparator(bool isSeparator) override; + void setFont(const QFont &font) override { Q_UNUSED(font); } + void setRole(MenuRole role) override; bool isCheckable() const { return m_isCheckable; } - void setCheckable(bool checkable) Q_DECL_OVERRIDE; + void setCheckable(bool checkable) override; bool isChecked() const { return m_isChecked; } - void setChecked(bool isChecked) Q_DECL_OVERRIDE; + void setChecked(bool isChecked) override; bool hasExclusiveGroup() const { return m_hasExclusiveGroup; } - void setHasExclusiveGroup(bool hasExclusiveGroup) Q_DECL_OVERRIDE; + void setHasExclusiveGroup(bool hasExclusiveGroup) override; #ifndef QT_NO_SHORTCUT QKeySequence shortcut() const { return m_shortcut; } - void setShortcut(const QKeySequence& shortcut) Q_DECL_OVERRIDE; + void setShortcut(const QKeySequence& shortcut) override; #endif - void setIconSize(int size) Q_DECL_OVERRIDE { Q_UNUSED(size); } - void setNativeContents(WId item) Q_DECL_OVERRIDE { Q_UNUSED(item); } + void setIconSize(int size) override { Q_UNUSED(size); } + void setNativeContents(WId item) override { Q_UNUSED(item); } int dbusID() const { return m_dbusID; } @@ -133,35 +133,35 @@ class QDBusPlatformMenu : public QPlatformMenu public: QDBusPlatformMenu(); ~QDBusPlatformMenu(); - void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before) Q_DECL_OVERRIDE; - void removeMenuItem(QPlatformMenuItem *menuItem) Q_DECL_OVERRIDE; + void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before) override; + void removeMenuItem(QPlatformMenuItem *menuItem) override; void syncSubMenu(const QDBusPlatformMenu *menu); - void syncMenuItem(QPlatformMenuItem *menuItem) Q_DECL_OVERRIDE; - void syncSeparatorsCollapsible(bool enable) Q_DECL_OVERRIDE { Q_UNUSED(enable); } + void syncMenuItem(QPlatformMenuItem *menuItem) override; + void syncSeparatorsCollapsible(bool enable) override { Q_UNUSED(enable); } const QString text() const { return m_text; } - void setText(const QString &text) Q_DECL_OVERRIDE; + void setText(const QString &text) override; QIcon icon() const { return m_icon; } - void setIcon(const QIcon &icon) Q_DECL_OVERRIDE; - bool isEnabled() const Q_DECL_OVERRIDE { return m_isEnabled; } - void setEnabled(bool enabled) Q_DECL_OVERRIDE; + void setIcon(const QIcon &icon) override; + bool isEnabled() const override { return m_isEnabled; } + void setEnabled(bool enabled) override; bool isVisible() const { return m_isVisible; } - void setVisible(bool visible) Q_DECL_OVERRIDE; - void setMinimumWidth(int width) Q_DECL_OVERRIDE { Q_UNUSED(width); } - void setFont(const QFont &font) Q_DECL_OVERRIDE { Q_UNUSED(font); } - void setMenuType(MenuType type) Q_DECL_OVERRIDE { Q_UNUSED(type); } + void setVisible(bool visible) override; + void setMinimumWidth(int width) override { Q_UNUSED(width); } + void setFont(const QFont &font) override { Q_UNUSED(font); } + void setMenuType(MenuType type) override { Q_UNUSED(type); } void setContainingMenuItem(QDBusPlatformMenuItem *item); - void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) Q_DECL_OVERRIDE; + void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) override; - void dismiss() Q_DECL_OVERRIDE { } // Closes this and all its related menu popups + void dismiss() override { } // Closes this and all its related menu popups - QPlatformMenuItem *menuItemAt(int position) const Q_DECL_OVERRIDE; - QPlatformMenuItem *menuItemForTag(quintptr tag) const Q_DECL_OVERRIDE; + QPlatformMenuItem *menuItemAt(int position) const override; + QPlatformMenuItem *menuItemForTag(quintptr tag) const override; const QList<QDBusPlatformMenuItem *> items() const; - QPlatformMenuItem *createMenuItem() const Q_DECL_OVERRIDE; - QPlatformMenu *createSubMenu() const Q_DECL_OVERRIDE; + QPlatformMenuItem *createMenuItem() const override; + QPlatformMenu *createSubMenu() const override; uint revision() const { return m_revision; } diff --git a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp index 9baf94726d..8480c15fb7 100644 --- a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp +++ b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp @@ -102,17 +102,17 @@ static int instanceCount = 0; */ QDBusTrayIcon::QDBusTrayIcon() - : m_dbusConnection(Q_NULLPTR) + : m_dbusConnection(nullptr) , m_adaptor(new QStatusNotifierItemAdaptor(this)) - , m_menuAdaptor(Q_NULLPTR) - , m_menu(Q_NULLPTR) - , m_notifier(Q_NULLPTR) + , m_menuAdaptor(nullptr) + , m_menu(nullptr) + , m_notifier(nullptr) , m_instanceId(KDEItemFormat.arg(QCoreApplication::applicationPid()).arg(++instanceCount)) , m_category(QStringLiteral("ApplicationStatus")) , m_defaultStatus(QStringLiteral("Active")) // be visible all the time. QSystemTrayIcon has no API to control this. , m_status(m_defaultStatus) - , m_tempIcon(Q_NULLPTR) - , m_tempAttentionIcon(Q_NULLPTR) + , m_tempIcon(nullptr) + , m_tempAttentionIcon(nullptr) , m_registered(false) { qCDebug(qLcTray); @@ -149,9 +149,9 @@ void QDBusTrayIcon::cleanup() if (m_registered) dBusConnection()->unregisterTrayIcon(this); delete m_dbusConnection; - m_dbusConnection = Q_NULLPTR; + m_dbusConnection = nullptr; delete m_notifier; - m_notifier = Q_NULLPTR; + m_notifier = nullptr; m_registered = false; } @@ -203,7 +203,7 @@ QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon) necessity_checked = true; } if (!necessary) - return Q_NULLPTR; + return nullptr; qreal dpr = qGuiApp->devicePixelRatio(); QTemporaryFile *ret = new QTemporaryFile(TempFileTemplate, this); ret->open(); diff --git a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h index 4c9bc8f7e3..7034a7edb4 100644 --- a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h +++ b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h @@ -91,18 +91,18 @@ public: QDBusMenuConnection * dBusConnection(); - void init() Q_DECL_OVERRIDE; - void cleanup() Q_DECL_OVERRIDE; - void updateIcon(const QIcon &icon) Q_DECL_OVERRIDE; - void updateToolTip(const QString &tooltip) Q_DECL_OVERRIDE; - void updateMenu(QPlatformMenu *menu) Q_DECL_OVERRIDE; - QPlatformMenu *createMenu() const Q_DECL_OVERRIDE; + void init() override; + void cleanup() override; + void updateIcon(const QIcon &icon) override; + void updateToolTip(const QString &tooltip) override; + void updateMenu(QPlatformMenu *menu) override; + QPlatformMenu *createMenu() const override; void showMessage(const QString &title, const QString &msg, - const QIcon &icon, MessageIcon iconType, int msecs) Q_DECL_OVERRIDE; + const QIcon &icon, MessageIcon iconType, int msecs) override; - bool isSystemTrayAvailable() const Q_DECL_OVERRIDE; - bool supportsMessages() const Q_DECL_OVERRIDE { return true; } - QRect geometry() const Q_DECL_OVERRIDE { return QRect(); } + bool isSystemTrayAvailable() const override; + bool supportsMessages() const override { return true; } + QRect geometry() const override { return QRect(); } QString category() const { return m_category; } QString status() const { return m_status; } diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index be0fac4b55..eeb03eb958 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -197,7 +197,7 @@ QPlatformSystemTrayIcon *QGenericUnixTheme::createPlatformSystemTrayIcon() const { if (isDBusTrayAvailable()) return new QDBusTrayIcon(); - return Q_NULLPTR; + return nullptr; } #endif @@ -672,7 +672,7 @@ QPlatformSystemTrayIcon *QKdeTheme::createPlatformSystemTrayIcon() const { if (isDBusTrayAvailable()) return new QDBusTrayIcon(); - return Q_NULLPTR; + return nullptr; } #endif @@ -691,7 +691,7 @@ const char *QGnomeTheme::name = "gnome"; class QGnomeThemePrivate : public QPlatformThemePrivate { public: - QGnomeThemePrivate() : systemFont(Q_NULLPTR), fixedFont(Q_NULLPTR) {} + QGnomeThemePrivate() : systemFont(nullptr), fixedFont(nullptr) {} ~QGnomeThemePrivate() { delete systemFont; delete fixedFont; } void configureFonts(const QString >kFontName) const @@ -791,7 +791,7 @@ QPlatformSystemTrayIcon *QGnomeTheme::createPlatformSystemTrayIcon() const { if (isDBusTrayAvailable()) return new QDBusTrayIcon(); - return Q_NULLPTR; + return nullptr; } #endif @@ -829,7 +829,7 @@ QPlatformTheme *QGenericUnixTheme::createUnixTheme(const QString &name) #endif if (name == QLatin1String(QGnomeTheme::name)) return new QGnomeTheme; - return Q_NULLPTR; + return nullptr; } QStringList QGenericUnixTheme::themeNames() diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h index da13390662..186e5a7dff 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h @@ -81,15 +81,15 @@ public: static QPlatformTheme *createUnixTheme(const QString &name); static QStringList themeNames(); - const QFont *font(Font type) const Q_DECL_OVERRIDE; - QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE; + const QFont *font(Font type) const override; + QVariant themeHint(ThemeHint hint) const override; static QStringList xdgIconThemePaths(); #ifndef QT_NO_DBUS - QPlatformMenuBar *createPlatformMenuBar() const Q_DECL_OVERRIDE; + QPlatformMenuBar *createPlatformMenuBar() const override; #endif #if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) - QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const Q_DECL_OVERRIDE; + QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override; #endif static const char *name; @@ -105,19 +105,19 @@ public: QKdeTheme(const QStringList& kdeDirs, int kdeVersion); static QPlatformTheme *createKdeTheme(); - QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE; + QVariant themeHint(ThemeHint hint) const override; QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions = 0) const override; - const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE; + const QPalette *palette(Palette type = SystemPalette) const override; - const QFont *font(Font type) const Q_DECL_OVERRIDE; + const QFont *font(Font type) const override; #ifndef QT_NO_DBUS - QPlatformMenuBar *createPlatformMenuBar() const Q_DECL_OVERRIDE; + QPlatformMenuBar *createPlatformMenuBar() const override; #endif #if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) - QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const Q_DECL_OVERRIDE; + QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override; #endif static const char *name; @@ -131,18 +131,18 @@ class QGnomeTheme : public QPlatformTheme Q_DECLARE_PRIVATE(QGnomeTheme) public: QGnomeTheme(); - QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE; + QVariant themeHint(ThemeHint hint) const override; QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions = 0) const override; - const QFont *font(Font type) const Q_DECL_OVERRIDE; - QString standardButtonText(int button) const Q_DECL_OVERRIDE; + const QFont *font(Font type) const override; + QString standardButtonText(int button) const override; virtual QString gtkFontName() const; #ifndef QT_NO_DBUS - QPlatformMenuBar *createPlatformMenuBar() const Q_DECL_OVERRIDE; + QPlatformMenuBar *createPlatformMenuBar() const override; #endif #if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) - QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const Q_DECL_OVERRIDE; + QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override; #endif static const char *name; |