diff options
Diffstat (limited to 'src/widgets/kernel/qwidget_p.h')
-rw-r--r-- | src/widgets/kernel/qwidget_p.h | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index c8eaabf8e2..90c4c2a945 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -146,11 +146,11 @@ public: inline operator bool() const { - return (0 != m_ptr); + return (nullptr != m_ptr); } private: - Q_DISABLE_COPY(QWidgetBackingStoreTracker) + Q_DISABLE_COPY_MOVE(QWidgetBackingStoreTracker) private: QWidgetBackingStore* m_ptr; @@ -190,7 +190,6 @@ struct QTLWExtra { uint posIncludesFrame : 1; uint sizeAdjusted : 1; uint inTopLevelResize : 1; - uint inRepaint : 1; uint embedded : 1; // *************************** Platform specific values (bit fields first) ********** @@ -356,6 +355,8 @@ public: void createRecursively(); void createWinId(); + void setScreenForPoint(const QPoint &pos); + void createTLExtra(); void createExtra(); void deleteExtra(); @@ -382,10 +383,11 @@ public: void updateFont(const QFont &); inline void setFont_helper(const QFont &font) { - if (data.fnt.resolve() == font.resolve() && data.fnt == font) + if (directFontResolveMask == font.resolve() && data.fnt == font) return; updateFont(font); } + QFont localFont() const; void resolveFont(); QFont naturalWidgetFont(uint inheritedMask) const; @@ -409,7 +411,7 @@ public: void render(QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags); void drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, - QPainter *sharedPainter = 0, QWidgetBackingStore *backingStore = 0); + QPainter *sharedPainter = nullptr, QWidgetBackingStore *backingStore = nullptr); void sendPaintEvent(const QRegion &toBePainted); @@ -426,7 +428,7 @@ public: QRegion clipRegion() const; void setSystemClip(QPaintEngine *paintEngine, qreal devicePixelRatio, const QRegion ®ion); void subtractOpaqueChildren(QRegion &rgn, const QRect &clipRect) const; - void subtractOpaqueSiblings(QRegion &source, bool *hasDirtySiblingsAbove = 0, + void subtractOpaqueSiblings(QRegion &source, bool *hasDirtySiblingsAbove = nullptr, bool alsoNonOpaque = false) const; void clipToEffectiveMask(QRegion ®ion) const; void updateIsOpaque(); @@ -450,10 +452,11 @@ public: void scrollChildren(int dx, int dy); void moveRect(const QRect &, int dx, int dy); void scrollRect(const QRect &, int dx, int dy); - void invalidateBuffer_resizeHelper(const QPoint &oldPos, const QSize &oldSize); - // ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). - void invalidateBuffer(const QRegion &); - void invalidateBuffer(const QRect &); + void invalidateBackingStore_resizeHelper(const QPoint &oldPos, const QSize &oldSize); + + template <class T> + void invalidateBackingStore(const T &); + QRegion overlappedRegion(const QRect &rect, bool breakAfterFirst = false) const; void syncBackingStore(); void syncBackingStore(const QRegion ®ion); @@ -482,9 +485,9 @@ public: void hide_sys(); void hide_helper(); void _q_showIfNotHidden(); + void setVisible(bool); void setEnabled_helper(bool); - void registerDropSite(bool); static void adjustFlags(Qt::WindowFlags &flags, QWidget *w = 0); void updateFrameStrut(); @@ -522,7 +525,7 @@ public: void getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const; void setLayoutItemMargins(int left, int top, int right, int bottom); - void setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt = 0); + void setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt = nullptr); void updateContentsRect(); QMargins safeAreaMargins() const; @@ -552,7 +555,7 @@ public: QGraphicsProxyWidget *ancestorProxy = widget->d_func()->nearestGraphicsProxyWidget(widget); //It's embedded if it has an ancestor if (ancestorProxy) { - if (!bypassGraphicsProxyWidget(widget) && ancestorProxy->scene() != 0) { + if (!bypassGraphicsProxyWidget(widget) && ancestorProxy->scene() != nullptr) { // One view, let be smart and return the viewport rect then the popup is aligned if (ancestorProxy->scene()->views().size() == 1) { QGraphicsView *view = ancestorProxy->scene()->views().at(0); @@ -583,7 +586,7 @@ public: } inline void restoreRedirected() - { redirectDev = 0; } + { redirectDev = nullptr; } inline void enforceNativeChildren() { @@ -605,6 +608,11 @@ public: return extra ? extra->nativeChildrenForced : false; } + inline QRect effectiveRectFor(const QRegion ®ion) const + { + return effectiveRectFor(region.boundingRect()); + } + inline QRect effectiveRectFor(const QRect &rect) const { #if QT_CONFIG(graphicseffect) @@ -644,7 +652,7 @@ public: QOpenGLContext *shareContext() const; - virtual QObject *focusObject() { return 0; } + virtual QObject *focusObject() { return nullptr; } #ifndef QT_NO_OPENGL virtual GLuint textureId() const { return 0; } @@ -652,7 +660,7 @@ public: Q_Q(QWidget); return q->testAttribute(Qt::WA_AlwaysStackOnTop) ? QPlatformTextureList::StacksOnTop - : QPlatformTextureList::Flags(0); + : QPlatformTextureList::Flags(nullptr); } virtual QImage grabFramebuffer() { return QImage(); } virtual void beginBackingStorePainting() { } @@ -730,6 +738,7 @@ public: #endif // Other variables. + uint directFontResolveMask; uint inheritedFontResolveMask; uint inheritedPaletteResolveMask; short leftmargin; @@ -895,7 +904,7 @@ struct QWidgetPaintContext { inline QWidgetPaintContext(QPaintDevice *d, const QRegion &r, const QPoint &o, int f, QPainter *p, QWidgetBackingStore *b) - : pdev(d), rgn(r), offset(o), flags(f), sharedPainter(p), backingStore(b), painter(0) {} + : pdev(d), rgn(r), offset(o), flags(f), sharedPainter(p), backingStore(b), painter(nullptr) {} QPaintDevice *pdev; QRegion rgn; @@ -911,14 +920,14 @@ class QWidgetEffectSourcePrivate : public QGraphicsEffectSourcePrivate { public: QWidgetEffectSourcePrivate(QWidget *widget) - : QGraphicsEffectSourcePrivate(), m_widget(widget), context(0), updateDueToGraphicsEffect(false) + : QGraphicsEffectSourcePrivate(), m_widget(widget), context(nullptr), updateDueToGraphicsEffect(false) {} void detach() override - { m_widget->d_func()->graphicsEffect = 0; } + { m_widget->d_func()->graphicsEffect = nullptr; } const QGraphicsItem *graphicsItem() const override - { return 0; } + { return nullptr; } const QWidget *widget() const override { return m_widget; } @@ -944,7 +953,7 @@ public: } const QStyleOption *styleOption() const override - { return 0; } + { return nullptr; } QRect deviceRect() const override { return m_widget->window()->rect(); } @@ -974,14 +983,14 @@ inline QTLWExtra *QWidgetPrivate::topData() const inline QTLWExtra *QWidgetPrivate::maybeTopData() const { - return extra ? extra->topextra : 0; + return extra ? extra->topextra : nullptr; } inline QPainter *QWidgetPrivate::sharedPainter() const { Q_Q(const QWidget); QTLWExtra *x = q->window()->d_func()->maybeTopData(); - return x ? x->sharedPainter : 0; + return x ? x->sharedPainter : nullptr; } inline void QWidgetPrivate::setSharedPainter(QPainter *painter) @@ -1002,7 +1011,7 @@ inline QWidgetBackingStore *QWidgetPrivate::maybeBackingStore() const { Q_Q(const QWidget); QTLWExtra *x = q->window()->d_func()->maybeTopData(); - return x ? x->backingStoreTracker.data() : 0; + return x ? x->backingStoreTracker.data() : nullptr; } inline QWidgetWindow *QWidgetPrivate::windowHandle() const |