Remove WA_PaintOutsidePaintEvent

WA_PaintOutsidePaintEvent is only suggested to be used when porting Qt3 code
to Qt 4 under X11 platform. and it has been broken now.

Change-Id: Ie4297b2a449f1055ca10ada9efb930e6018b1efb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
bb10
Debao Zhang 2012-03-23 18:19:27 -07:00 committed by Qt by Nokia
parent 5e80eb7917
commit d2b1c2ef1f
7 changed files with 3 additions and 73 deletions

View File

@ -342,7 +342,6 @@ public:
WA_UpdatesDisabled = 10,
WA_Mapped = 11,
WA_MacNoClickThrough = 12, // Mac only
WA_PaintOutsidePaintEvent = 13,
WA_InputMethodEnabled = 14,
WA_WState_Visible = 15,
WA_WState_Hidden = 16,

View File

@ -993,11 +993,6 @@
require native painting primitives, you need to reimplement
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()}. This
flag is not supported on Windows, Mac OS X or Embedded Linux. 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
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

View File

@ -970,10 +970,7 @@ void QPainterPrivate::updateState(QPainterState *newState)
\warning When the paintdevice is a widget, QPainter can only be
used inside a paintEvent() function or in a function called by
paintEvent(); that is unless the Qt::WA_PaintOutsidePaintEvent
widget attribute is set. On Mac OS X and Windows, you can only
paint in a paintEvent() function regardless of this attribute's
setting.
paintEvent().
\tableofcontents
@ -1760,25 +1757,6 @@ bool QPainter::begin(QPaintDevice *pd)
d->engine->state = d->state;
switch (pd->devType()) {
#if 0
// is this needed any more??
case QInternal::Widget:
{
const QWidget *widget = static_cast<const QWidget *>(pd);
Q_ASSERT(widget);
const bool paintOutsidePaintEvent = widget->testAttribute(Qt::WA_PaintOutsidePaintEvent);
const bool inPaintEvent = widget->testAttribute(Qt::WA_WState_InPaintEvent);
// 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;
}
#endif
case QInternal::Pixmap:
{
QPixmap *pm = static_cast<QPixmap *>(pd);

View File

@ -5128,7 +5128,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
paintEngine->d_func()->systemClip = QRegion();
}
q->setAttribute(Qt::WA_WState_InPaintEvent, false);
if (q->paintingActive() && !q->testAttribute(Qt::WA_PaintOutsidePaintEvent))
if (q->paintingActive())
qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
if (paintEngine && paintEngine->autoDestruct()) {

View File

@ -1364,7 +1364,7 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn)
QWidgetBackingStore::unflushPaint(q, toBePainted);
#endif
if (!q->testAttribute(Qt::WA_PaintOutsidePaintEvent) && q->paintingActive())
if (q->paintingActive())
qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
}

View File

@ -1384,7 +1384,6 @@ void tst_QGraphicsWidget::setAttribute_data()
QTest::newRow("WA_RightToLeft") << Qt::WA_RightToLeft << true;
QTest::newRow("WA_SetStyle") << Qt::WA_SetStyle << true;
QTest::newRow("WA_Resized") << Qt::WA_Resized << true;
QTest::newRow("unsupported") << Qt::WA_PaintOutsidePaintEvent << false;
}
// void setAttribute(Qt::WidgetAttribute attribute, bool on = true) public
@ -1393,8 +1392,6 @@ void tst_QGraphicsWidget::setAttribute()
QFETCH(Qt::WidgetAttribute, attribute);
QFETCH(bool, supported);
SubQGraphicsWidget widget;
if (attribute == Qt::WA_PaintOutsidePaintEvent)
QTest::ignoreMessage(QtWarningMsg, "QGraphicsWidget::setAttribute: unsupported attribute 13");
widget.setAttribute(attribute);
QCOMPARE(widget.testAttribute(attribute), supported);
}

View File

@ -377,9 +377,6 @@ private slots:
#endif
void windowFlags();
void initialPosForDontShowOnScreenWidgets();
#ifdef Q_WS_X11
void paintOutsidePaintEvent();
#endif
void updateOnDestroyedSignal();
void toplevelLineEditFocus();
void inputFocus_task257832();
@ -8711,42 +8708,6 @@ void tst_QWidget::initialPosForDontShowOnScreenWidgets()
}
}
#ifdef Q_WS_X11
void tst_QWidget::paintOutsidePaintEvent()
{
QWidget widget;
widget.resize(200, 200);
QWidget child1(&widget);
child1.resize(100, 100);
child1.setPalette(Qt::red);
child1.setAutoFillBackground(true);
QWidget child2(&widget);
child2.setGeometry(50, 50, 100, 100);
child2.setPalette(Qt::blue);
child2.setAutoFillBackground(true);
widget.show();
QTest::qWaitForWindowShown(&widget);
QTest::qWait(60);
const QPixmap before = QPixmap::grabWindow(widget.winId());
// Child 1 should be clipped by child 2, so nothing should change.
child1.setAttribute(Qt::WA_PaintOutsidePaintEvent);
QPainter painter(&child1);
painter.fillRect(child1.rect(), Qt::red);
painter.end();
XSync(QX11Info::display(), false); // Flush output buffer.
QTest::qWait(60);
const QPixmap after = QPixmap::grabWindow(widget.winId());
QCOMPARE(before, after);
}
#endif
class MyEvilObject : public QObject
{
Q_OBJECT