mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
drop support for painting widgets outside paint events [ci reset]
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
36d3978855
commit
3bd1313a36
7 changed files with 76 additions and 99 deletions
|
@ -756,82 +756,81 @@ public:
|
||||||
WA_NoSystemBackground = 6,
|
WA_NoSystemBackground = 6,
|
||||||
WA_UpdatesDisabled = 7,
|
WA_UpdatesDisabled = 7,
|
||||||
WA_Mapped = 8,
|
WA_Mapped = 8,
|
||||||
WA_PaintOutsidePaintEvent = 9,
|
WA_ForceDisabled = 9,
|
||||||
WA_ForceDisabled = 10,
|
WA_PendingMoveEvent = 10,
|
||||||
WA_PendingMoveEvent = 11,
|
WA_PendingResizeEvent = 11,
|
||||||
WA_PendingResizeEvent = 12,
|
WA_SetPalette = 12,
|
||||||
WA_SetPalette = 13,
|
WA_SetFont = 13,
|
||||||
WA_SetFont = 14,
|
WA_SetCursor = 14,
|
||||||
WA_SetCursor = 15,
|
WA_NoChildEventsFromChildren = 15,
|
||||||
WA_NoChildEventsFromChildren = 16,
|
WA_WindowModified = 16,
|
||||||
WA_WindowModified = 17,
|
WA_Resized = 17,
|
||||||
WA_Resized = 18,
|
WA_Moved = 18,
|
||||||
WA_Moved = 19,
|
WA_CustomWhatsThis = 19,
|
||||||
WA_CustomWhatsThis = 20,
|
WA_LayoutOnEntireRect = 20,
|
||||||
WA_LayoutOnEntireRect = 21,
|
WA_OutsideWSRange = 21,
|
||||||
WA_OutsideWSRange = 22,
|
WA_TransparentForMouseEvents = 22,
|
||||||
WA_TransparentForMouseEvents = 23,
|
WA_PaintUnclipped = 23,
|
||||||
WA_PaintUnclipped = 24,
|
WA_NoMouseReplay = 24,
|
||||||
WA_NoMouseReplay = 25,
|
WA_DeleteOnClose = 25,
|
||||||
WA_DeleteOnClose = 26,
|
WA_RightToLeft = 26,
|
||||||
WA_RightToLeft = 27,
|
WA_NoChildEventsForParent = 27,
|
||||||
WA_NoChildEventsForParent = 28,
|
WA_ShowModal = 28, // ## deprecated
|
||||||
WA_ShowModal = 29, // ## deprecated
|
WA_MouseNoMask = 29,
|
||||||
WA_MouseNoMask = 30,
|
WA_GroupLeader = 30, // ## deprecated
|
||||||
WA_GroupLeader = 31, // ## deprecated
|
WA_NoMousePropagation = 31, // ## for now, might go away.
|
||||||
WA_NoMousePropagation = 32, // ## for now, might go away.
|
WA_Hover = 32,
|
||||||
WA_Hover = 33,
|
WA_QuitOnClose = 33,
|
||||||
WA_QuitOnClose = 34,
|
WA_KeyboardFocusChange = 34,
|
||||||
WA_KeyboardFocusChange = 35,
|
WA_AcceptDrops = 35,
|
||||||
WA_AcceptDrops = 36,
|
WA_WindowPropagation = 36,
|
||||||
WA_WindowPropagation = 37,
|
WA_AlwaysShowToolTips = 37,
|
||||||
WA_AlwaysShowToolTips = 38,
|
WA_SetStyle = 38,
|
||||||
WA_SetStyle = 39,
|
WA_SetLocale = 39,
|
||||||
WA_SetLocale = 40,
|
WA_LayoutUsesWidgetRect = 40,
|
||||||
WA_LayoutUsesWidgetRect = 41,
|
WA_ShowWithoutActivating = 41,
|
||||||
WA_ShowWithoutActivating = 42,
|
WA_NativeWindow = 42,
|
||||||
WA_NativeWindow = 43,
|
WA_DontCreateNativeAncestors = 43,
|
||||||
WA_DontCreateNativeAncestors = 44,
|
WA_TranslucentBackground = 44,
|
||||||
WA_TranslucentBackground = 45,
|
WA_X11DoNotAcceptFocus = 45,
|
||||||
WA_X11DoNotAcceptFocus = 46,
|
WA_X11BypassTransientForHint = 46,
|
||||||
WA_X11BypassTransientForHint = 47,
|
|
||||||
|
|
||||||
// window types from http://standards.freedesktop.org/wm-spec/
|
// window types from http://standards.freedesktop.org/wm-spec/
|
||||||
WA_X11NetWmWindowTypeDesktop = 48,
|
WA_X11NetWmWindowTypeDesktop = 47,
|
||||||
WA_X11NetWmWindowTypeDock = 49,
|
WA_X11NetWmWindowTypeDock = 48,
|
||||||
WA_X11NetWmWindowTypeToolBar = 50,
|
WA_X11NetWmWindowTypeToolBar = 49,
|
||||||
WA_X11NetWmWindowTypeMenu = 51,
|
WA_X11NetWmWindowTypeMenu = 50,
|
||||||
WA_X11NetWmWindowTypeUtility = 52,
|
WA_X11NetWmWindowTypeUtility = 51,
|
||||||
WA_X11NetWmWindowTypeSplash = 53,
|
WA_X11NetWmWindowTypeSplash = 52,
|
||||||
WA_X11NetWmWindowTypeDialog = 54,
|
WA_X11NetWmWindowTypeDialog = 53,
|
||||||
WA_X11NetWmWindowTypeDropDownMenu = 55,
|
WA_X11NetWmWindowTypeDropDownMenu = 54,
|
||||||
WA_X11NetWmWindowTypePopupMenu = 56,
|
WA_X11NetWmWindowTypePopupMenu = 55,
|
||||||
WA_X11NetWmWindowTypeToolTip = 57,
|
WA_X11NetWmWindowTypeToolTip = 56,
|
||||||
WA_X11NetWmWindowTypeNotification = 58,
|
WA_X11NetWmWindowTypeNotification = 57,
|
||||||
WA_X11NetWmWindowTypeCombo = 59,
|
WA_X11NetWmWindowTypeCombo = 58,
|
||||||
WA_X11NetWmWindowTypeDND = 60,
|
WA_X11NetWmWindowTypeDND = 59,
|
||||||
|
|
||||||
// internal
|
// internal
|
||||||
WA_LaidOut = 61,
|
WA_LaidOut = 60,
|
||||||
WA_GrabbedShortcut = 62,
|
WA_GrabbedShortcut = 61,
|
||||||
WA_DontShowOnScreen = 63,
|
WA_DontShowOnScreen = 62,
|
||||||
WA_ForceUpdatesDisabled = 64,
|
WA_ForceUpdatesDisabled = 63,
|
||||||
WA_StyledBackground = 65,
|
WA_StyledBackground = 64,
|
||||||
WA_StyleSheet = 66,
|
WA_StyleSheet = 65,
|
||||||
WA_DropSiteRegistered = 67,
|
WA_DropSiteRegistered = 66,
|
||||||
WA_WState_Visible = 68,
|
WA_WState_Visible = 67,
|
||||||
WA_WState_Hidden = 69,
|
WA_WState_Hidden = 68,
|
||||||
WA_WState_Created = 70,
|
WA_WState_Created = 69,
|
||||||
WA_WState_InPaintEvent = 71,
|
WA_WState_InPaintEvent = 70,
|
||||||
WA_WState_Reparented = 72,
|
WA_WState_Reparented = 71,
|
||||||
WA_WState_Polished = 73,
|
WA_WState_Polished = 72,
|
||||||
WA_WState_OwnSizePolicy = 74,
|
WA_WState_OwnSizePolicy = 73,
|
||||||
WA_WState_ExplicitShowHide = 75,
|
WA_WState_ExplicitShowHide = 74,
|
||||||
WA_WState_ConfigPending = 76,
|
WA_WState_ConfigPending = 75,
|
||||||
WA_SetWindowIcon = 77,
|
WA_SetWindowIcon = 76,
|
||||||
WA_SetLayoutDirection = 78,
|
WA_SetLayoutDirection = 77,
|
||||||
WA_SetWindowModality = 79,
|
WA_SetWindowModality = 78,
|
||||||
WA_NoX11EventCompression = 80,
|
WA_NoX11EventCompression = 79,
|
||||||
|
|
||||||
// Add new attributes before this line
|
// Add new attributes before this line
|
||||||
WA_AttributeCount
|
WA_AttributeCount
|
||||||
|
|
|
@ -781,10 +781,6 @@
|
||||||
require native painting primitives, you need to reimplement
|
require native painting primitives, you need to reimplement
|
||||||
QWidget::paintEngine() to return 0 and set this flag.
|
QWidget::paintEngine() to return 0 and set this flag.
|
||||||
|
|
||||||
\value WA_PaintOutsidePaintEvent Makes it possible to use QPainter to
|
|
||||||
paint on the widget outside \l{QWidget::paintEvent()}{paintEvent()}.
|
|
||||||
We recommend that you use it only when porting Qt 3 code to Qt 4.
|
|
||||||
|
|
||||||
\value WA_PaintUnclipped Makes all painters operating on this widget
|
\value WA_PaintUnclipped Makes all painters operating on this widget
|
||||||
unclipped. Children of this widget or other widgets in front of it do not
|
unclipped. Children of this widget or other widgets in front of it do not
|
||||||
clip the area the painter can paint on. This flag is only supported for
|
clip the area the painter can paint on. This flag is only supported for
|
||||||
|
|
|
@ -4639,7 +4639,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
|
||||||
paintEngine->d_func()->systemClip = QRegion();
|
paintEngine->d_func()->systemClip = QRegion();
|
||||||
}
|
}
|
||||||
q->setAttribute(Qt::WA_WState_InPaintEvent, false);
|
q->setAttribute(Qt::WA_WState_InPaintEvent, false);
|
||||||
if (Q_UNLIKELY(q->paintingActive() && !q->testAttribute(Qt::WA_PaintOutsidePaintEvent)))
|
if (Q_UNLIKELY(q->paintingActive()))
|
||||||
qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
|
qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
|
|
|
@ -1146,7 +1146,7 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn)
|
||||||
QWidgetBackingStore::unflushPaint(q, toBePainted);
|
QWidgetBackingStore::unflushPaint(q, toBePainted);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!q->testAttribute(Qt::WA_PaintOutsidePaintEvent) && q->paintingActive())
|
if (Q_UNLIKELY(q->paintingActive()))
|
||||||
qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
|
qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,8 +168,6 @@ QFont QTextItem::font() const
|
||||||
\value ConstantOpacity The engine supports the feature provided by
|
\value ConstantOpacity The engine supports the feature provided by
|
||||||
QPainter::setOpacity().
|
QPainter::setOpacity().
|
||||||
\value PainterPaths The engine has path support.
|
\value PainterPaths The engine has path support.
|
||||||
\value PaintOutsidePaintEvent The engine is capable of painting outside of
|
|
||||||
paint events.
|
|
||||||
\value PatternTransform The engine has support for transforming brush
|
\value PatternTransform The engine has support for transforming brush
|
||||||
patterns.
|
patterns.
|
||||||
\value PerspectiveTransform The engine has support for performing perspective
|
\value PerspectiveTransform The engine has support for performing perspective
|
||||||
|
|
|
@ -72,7 +72,6 @@ public:
|
||||||
ConstantOpacity = 0x00000040, // Can render at constant opacity
|
ConstantOpacity = 0x00000040, // Can render at constant opacity
|
||||||
PerspectiveTransform = 0x00000080, // Can do perspective transformations
|
PerspectiveTransform = 0x00000080, // Can do perspective transformations
|
||||||
BlendModes = 0x00000100, // Can do extended Porter&Duff composition
|
BlendModes = 0x00000100, // Can do extended Porter&Duff composition
|
||||||
PaintOutsidePaintEvent = 0x00000200, // Engine is capable of painting outside paint events
|
|
||||||
|
|
||||||
AllFeatures = 0xffffffff // For convenience
|
AllFeatures = 0xffffffff // For convenience
|
||||||
};
|
};
|
||||||
|
|
|
@ -144,10 +144,7 @@ bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Check if we're attempting to paint outside a paint event.
|
// Check if we're attempting to paint outside a paint event.
|
||||||
if (Q_UNLIKELY(!sp->d_ptr->engine->hasFeature(QPaintEngine::PaintOutsidePaintEvent)
|
if (Q_UNLIKELY(!widget->testAttribute(Qt::WA_WState_InPaintEvent))) {
|
||||||
&& !widget->testAttribute(Qt::WA_PaintOutsidePaintEvent)
|
|
||||||
&& !widget->testAttribute(Qt::WA_WState_InPaintEvent))) {
|
|
||||||
|
|
||||||
qWarning("QPainter::begin: Widget painting can only begin as a result of a paintEvent");
|
qWarning("QPainter::begin: Widget painting can only begin as a result of a paintEvent");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -591,10 +588,7 @@ void QPainterPrivate::updateState(QPainterState *newState)
|
||||||
|
|
||||||
\warning When the paintdevice is a widget, QPainter can only be
|
\warning When the paintdevice is a widget, QPainter can only be
|
||||||
used inside a paintEvent() function or in a function called by
|
used inside a paintEvent() function or in a function called by
|
||||||
paintEvent(); that is unless the Qt::WA_PaintOutsidePaintEvent
|
paintEvent().
|
||||||
widget attribute is set. On Mac OS X and Windows, you can only
|
|
||||||
paint in a paintEvent() function regardless of this attribute's
|
|
||||||
setting.
|
|
||||||
|
|
||||||
\tableofcontents
|
\tableofcontents
|
||||||
|
|
||||||
|
@ -1359,22 +1353,13 @@ bool QPainter::begin(QPaintDevice *pd)
|
||||||
const QWidget *widget = static_cast<const QWidget *>(pd);
|
const QWidget *widget = static_cast<const QWidget *>(pd);
|
||||||
Q_ASSERT(widget);
|
Q_ASSERT(widget);
|
||||||
|
|
||||||
const bool paintOutsidePaintEvent = widget->testAttribute(Qt::WA_PaintOutsidePaintEvent);
|
|
||||||
const bool inPaintEvent = widget->testAttribute(Qt::WA_WState_InPaintEvent);
|
const bool inPaintEvent = widget->testAttribute(Qt::WA_WState_InPaintEvent);
|
||||||
if(Q_UNLIKELY(!d->engine->hasFeature(QPaintEngine::PaintOutsidePaintEvent)
|
if(Q_UNLIKELY(!inPaintEvent)) {
|
||||||
&& !paintOutsidePaintEvent && !inPaintEvent)) {
|
|
||||||
qWarning("QPainter::begin: Widget painting can only begin as a "
|
qWarning("QPainter::begin: Widget painting can only begin as a "
|
||||||
"result of a paintEvent");
|
"result of a paintEvent");
|
||||||
qt_cleanup_painter_state(d);
|
qt_cleanup_painter_state(d);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust offset for alien widgets painting outside the paint event.
|
|
||||||
if (!inPaintEvent && paintOutsidePaintEvent && !widget->internalWinId()
|
|
||||||
&& widget->testAttribute(Qt::WA_WState_Created)) {
|
|
||||||
const QPoint offset = widget->mapTo(widget->nativeParentWidget(), QPoint());
|
|
||||||
d->state->redirectionMatrix.translate(offset.x(), offset.y());
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QInternal::Pixmap:
|
case QInternal::Pixmap:
|
||||||
|
|
Loading…
Add table
Reference in a new issue