Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-staging

* 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-staging:
  Add internal documentation for QUnifiedToolbarSurface.
  Fix the autotest condition.
  Change the repaint() call to an update().
  Fix the update() autotest for raster.
  Change the repaint() to an update().
  Set the default graphics system to raster.
  Revert "Switch the default graphics system to raster on Mac."
  Fix an race condition in the auto test.
  Fix an race condition in the auto test.
  Fix a race condition when the main window is being destructed.
  Switch the default graphics system to raster on Mac.
This commit is contained in:
Qt Continuous Integration System 2011-05-10 19:50:02 +10:00
commit 41e14a4175
7 changed files with 81 additions and 28 deletions

View File

@ -1588,6 +1588,7 @@ QWidget::~QWidget()
// delete layout while we still are a valid widget
delete d->layout;
d->layout = 0;
// Remove myself from focus list
Q_ASSERT(d->focus_next->d_func()->focus_prev == this);

View File

@ -2733,7 +2733,7 @@ QWidget::macCGHandle() const
return handle();
}
void qt_mac_repaintParentUnderAlienWidget(QWidget *alienWidget)
void qt_mac_updateParentUnderAlienWidget(QWidget *alienWidget)
{
QWidget *nativeParent = alienWidget->nativeParentWidget();
if (!nativeParent)
@ -2741,7 +2741,7 @@ void qt_mac_repaintParentUnderAlienWidget(QWidget *alienWidget)
QPoint globalPos = alienWidget->mapToGlobal(QPoint(0, 0));
QRect dirtyRect = QRect(nativeParent->mapFromGlobal(globalPos), alienWidget->size());
nativeParent->repaint(dirtyRect);
nativeParent->update(dirtyRect);
}
void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
@ -2752,7 +2752,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
if (!isWindow() && parentWidget())
parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));
if (!internalWinId())
qt_mac_repaintParentUnderAlienWidget(this);
qt_mac_updateParentUnderAlienWidget(this);
d->deactivateWidgetCleanup();
qt_mac_event_release(this);
if(testAttribute(Qt::WA_WState_Created)) {
@ -3526,8 +3526,8 @@ void QWidgetPrivate::show_sys()
// INVARIANT: q is native. Just show the view:
[view setHidden:NO];
} else {
// INVARIANT: q is alien. Repaint q instead:
q->repaint();
// INVARIANT: q is alien. Update q instead:
q->update();
}
#endif
}
@ -3683,7 +3683,7 @@ void QWidgetPrivate::hide_sys()
[view setHidden:YES];
} else {
// INVARIANT: q is alien. Repaint where q is placed instead:
qt_mac_repaintParentUnderAlienWidget(q);
qt_mac_updateParentUnderAlienWidget(q);
}
#endif
}

View File

@ -74,7 +74,7 @@ QGraphicsSystem *QGraphicsSystemFactory::create(const QString& key)
if (system.isEmpty()) {
system = QLatin1String("runtime");
}
#elif defined (QT_GRAPHICSSYSTEM_RASTER) && !defined(Q_WS_WIN) && !defined(Q_OS_SYMBIAN) || defined(Q_WS_X11)
#elif defined (QT_GRAPHICSSYSTEM_RASTER) && !defined(Q_WS_WIN) && !defined(Q_OS_SYMBIAN) || defined(Q_WS_X11) || (defined (Q_WS_MAC) && defined(QT_MAC_USE_COCOA))
if (system.isEmpty()) {
system = QLatin1String("raster");
}

View File

@ -152,7 +152,8 @@ void QUnifiedToolbarSurface::beginPaint(const QRegion &rgn)
void QUnifiedToolbarSurface::updateToolbarOffset(QWidget *widget)
{
QMainWindowLayout *mlayout = qobject_cast<QMainWindowLayout*> (widget->window()->layout());
mlayout->updateUnifiedToolbarOffset();
if (mlayout)
mlayout->updateUnifiedToolbarOffset();
}
void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)

View File

@ -65,6 +65,39 @@ QT_BEGIN_NAMESPACE
class QNativeImage;
//
// This is the implementation of the unified toolbar on Mac OS X
// with the graphics system raster.
//
// General idea:
// -------------
// We redirect the painting of widgets inside the unified toolbar
// to a special window surface, the QUnifiedToolbarSurface.
// We need a separate window surface because the unified toolbar
// is out of the content view.
// The input system is the same as for the unified toolbar with the
// native (CoreGraphics) engine.
//
// Execution flow:
// ---------------
// The unified toolbar is triggered by QMainWindow::setUnifiedTitleAndToolBarOnMac().
// It calls QMainWindowLayout::insertIntoMacToolbar() which will
// set all the appropriate variables (offsets, redirection, ...).
// When Qt tells a widget to repaint, QWidgetPrivate::drawWidget()
// checks if the widget is inside the unified toolbar and exits without
// painting is that is the case.
// We trigger the rendering of the unified toolbar in QWidget::repaint()
// and QWidget::update().
// We keep track of flush requests via "flushRequested" variable. That
// allow flush() to be a no-op if no repaint occured for a widget.
// We rely on the needsDisplay: and drawRect: mecanism for drawing our
// content into the graphics context.
//
// Notes:
// ------
// The painting of items inside the unified toolbar is expensive.
// Too many repaints will drastically slow down the whole application.
//
class QUnifiedToolbarSurfacePrivate
{

View File

@ -4738,7 +4738,8 @@ void tst_QWidget::update()
QCOMPARE(w.visibleRegion(), expectedVisible);
QCOMPARE(w.paintedRegion, expectedVisible);
#ifdef QT_MAC_USE_COCOA
QEXPECT_FAIL(0, "Cocoa compositor says to paint this.", Continue);
if (QApplicationPrivate::graphics_system_name != QLatin1String("raster"))
QEXPECT_FAIL(0, "Cocoa compositor says to paint this.", Continue);
#endif
QCOMPARE(child.numPaintEvents, 0);
@ -6336,11 +6337,15 @@ void tst_QWidget::compatibilityChildInsertedEvents()
expected =
EventRecorder::EventList()
<< qMakePair(&widget, QEvent::PolishRequest)
<< qMakePair(&widget, QEvent::Type(QEvent::User + 1))
#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) || defined(Q_WS_QPA)
<< qMakePair(&widget, QEvent::UpdateRequest)
#endif
;
<< qMakePair(&widget, QEvent::Type(QEvent::User + 1));
#ifndef QT_MAC_USE_CARBON
#ifdef QT_MAC_USE_COCOA
if (QApplicationPrivate::graphics_system_name == QLatin1String("raster"))
#endif // QT_MAC_USE_COCOA
expected << qMakePair(&widget, QEvent::UpdateRequest);
#endif // !QT_MAC_USE_CARBON
QCOMPARE(spy.eventList(), expected);
}
@ -6432,11 +6437,15 @@ void tst_QWidget::compatibilityChildInsertedEvents()
#endif
<< qMakePair(&widget, QEvent::PolishRequest)
<< qMakePair(&widget, QEvent::Type(QEvent::User + 1))
<< qMakePair(&widget, QEvent::Type(QEvent::User + 2))
#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) || defined(Q_WS_QPA)
<< qMakePair(&widget, QEvent::UpdateRequest)
#endif
;
<< qMakePair(&widget, QEvent::Type(QEvent::User + 2));
#ifndef QT_MAC_USE_CARBON
#ifdef QT_MAC_USE_COCOA
if (QApplicationPrivate::graphics_system_name == QLatin1String("raster"))
#endif // QT_MAC_USE_COCOA
expected << qMakePair(&widget, QEvent::UpdateRequest);
#endif // !QT_MAC_USE_CARBON
QCOMPARE(spy.eventList(), expected);
}
@ -6528,11 +6537,15 @@ void tst_QWidget::compatibilityChildInsertedEvents()
#endif
<< qMakePair(&widget, QEvent::PolishRequest)
<< qMakePair(&widget, QEvent::Type(QEvent::User + 1))
<< qMakePair(&widget, QEvent::Type(QEvent::User + 2))
#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) || defined(Q_WS_QPA)
<< qMakePair(&widget, QEvent::UpdateRequest)
#endif
;
<< qMakePair(&widget, QEvent::Type(QEvent::User + 2));
#ifndef QT_MAC_USE_CARBON
#ifdef QT_MAC_USE_COCOA
if (QApplicationPrivate::graphics_system_name == QLatin1String("raster"))
#endif // QT_MAC_USE_COCOA
expected << qMakePair(&widget, QEvent::UpdateRequest);
#endif // !QT_MAC_USE_CARBON
QCOMPARE(spy.eventList(), expected);
}
}

View File

@ -1770,8 +1770,11 @@ public:
~TestWizard()
{
foreach (int id, pageIds)
delete page(id);
foreach (int id, pageIds) {
QWizardPage *page_to_delete = page(id);
removePage(id);
delete page_to_delete;
}
}
void applyOperations(const QList<Operation *> &operations)
@ -2548,8 +2551,8 @@ void tst_QWizard::task177022_setFixedSize()
QWizard wiz;
QWizardPage page1;
QWizardPage page2;
wiz.addPage(&page1);
wiz.addPage(&page2);
int page1_id = wiz.addPage(&page1);
int page2_id = wiz.addPage(&page2);
wiz.setFixedSize(width, height);
if (wiz.wizardStyle() == QWizard::AeroStyle)
QEXPECT_FAIL("", "this probably relates to non-client area hack for AeroStyle titlebar "
@ -2576,6 +2579,8 @@ void tst_QWizard::task177022_setFixedSize()
QCOMPARE(wiz.maximumWidth(), width);
QCOMPARE(wiz.maximumHeight(), height);
wiz.removePage(page1_id);
wiz.removePage(page2_id);
}
void tst_QWizard::task248107_backButton()