From 86e1b289c8246befc37455e7caa101fc20e0bc97 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 15 Sep 2009 11:13:23 +0200 Subject: Make the test work with shadow builds. Reviewed-by: Jesper --- tests/auto/uic/tst_uic.cpp | 18 +++++++++--------- tests/auto/uic/uic.pro | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/auto/uic/tst_uic.cpp b/tests/auto/uic/tst_uic.cpp index c4759e2..60367b9 100644 --- a/tests/auto/uic/tst_uic.cpp +++ b/tests/auto/uic/tst_uic.cpp @@ -55,16 +55,16 @@ class tst_uic : public QObject public: tst_uic(); - + private Q_SLOTS: void initTestCase(); - + void run(); void run_data() const; void compare(); void compare_data() const; - + void cleanupTestCase(); private: @@ -105,8 +105,8 @@ void tst_uic::initTestCase() qDebug() << msg; process.terminate(); - QCOMPARE(QFileInfo(QLatin1String("baseline")).exists(), true); - QCOMPARE(QFileInfo(QLatin1String("generated_ui")).exists(), true); + QCOMPARE(QFileInfo(QLatin1String(SRCDIR "baseline")).exists(), true); + QCOMPARE(QFileInfo(QLatin1String(SRCDIR "generated_ui")).exists(), true); } void tst_uic::run() @@ -163,23 +163,23 @@ void tst_uic::compare() QFile genFile(generatedFile); if (!orgFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - QString err(QLatin1String("Could not read file: %1...")); + QString err(QLatin1String("Could not read file: %1...")); QFAIL(err.arg(orgFile.fileName()).toUtf8()); } if (!genFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - QString err(QLatin1String("Could not read file: %1...")); + QString err(QLatin1String("Could not read file: %1...")); QFAIL(err.arg(genFile.fileName()).toUtf8()); } originalFile = orgFile.readAll(); originalFile.replace(QRegExp(QLatin1String("Created:.{0,25}[\\d]{4,4}")), ""); originalFile.replace(QRegExp(QLatin1String("by: Qt User Interface Compiler version [.\\d]{5,5}")), ""); - + generatedFile = genFile.readAll(); generatedFile.replace(QRegExp(QLatin1String("Created:.{0,25}[\\d]{4,4}")), ""); generatedFile.replace(QRegExp(QLatin1String("by: Qt User Interface Compiler version [.\\d]{5,5}")), ""); - + QCOMPARE(generatedFile, originalFile); } diff --git a/tests/auto/uic/uic.pro b/tests/auto/uic/uic.pro index 411a993..355cb56 100644 --- a/tests/auto/uic/uic.pro +++ b/tests/auto/uic/uic.pro @@ -5,4 +5,4 @@ SOURCES += tst_uic.cpp TARGET = tst_uic # This test is not run on wince (I think) -DEFINES += SRCDIR=\\\"$$PWD\\\" +DEFINES += SRCDIR=\\\"$$PWD/\\\" -- cgit v0.12 From 541ff2c0ffbe13424b212bcab145214d5725d49e Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 15 Sep 2009 11:44:42 +0200 Subject: Make test pass on Windows Reviewed-by: Jan-Arve --- tests/auto/qwidget/tst_qwidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index ad814fd..04b7b39 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -9236,13 +9236,15 @@ void tst_QWidget::destroyBackingStore() w.reset(); w.update(); - QApplication::processEvents(); delete qt_widget_private(&w)->topData()->backingStore; qt_widget_private(&w)->topData()->backingStore = 0; qt_widget_private(&w)->topData()->backingStore = new QWidgetBackingStore(&w); w.update(); QApplication::processEvents(); +#ifdef Q_WS_QWS + QApplication::processEvents(); +#endif QCOMPARE(w.numPaintEvents, 1); // Check one more time, because the second time around does more caching. -- cgit v0.12 From 4a7e5c25339a7d52cbcd7d4c6ff792f7d991a70c Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 15 Sep 2009 12:02:19 +0200 Subject: Export again qt_set_sequence_auto_mnemonic Became unexported from commit bcd23411c8 Task-number: 261250 --- src/gui/kernel/qkeysequence.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 2530f38..aec757f 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -145,7 +145,7 @@ static int qtkeyForMacSymbol(const QChar ch) #else static bool qt_sequence_no_mnemonics = false; #endif -void Q_AUTOTEST_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemonics = !b; } +void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemonics = !b; } /*! \class QKeySequence -- cgit v0.12 From f60e8c21c1d031daa8984461f9e5a6988e3ce2e7 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 15 Sep 2009 12:05:50 +0200 Subject: doc: Fixed some qdoc errors. --- src/gui/effects/qgraphicseffect.cpp | 12 +++++++ src/gui/graphicsview/qgraphicsanchorlayout.cpp | 45 ++------------------------ src/svg/qgraphicssvgitem.cpp | 17 ++++++++-- 3 files changed, 29 insertions(+), 45 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 26489c5..c0877a4 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -493,6 +493,12 @@ void QGraphicsGrayscaleEffect::setStrength(qreal strength) emit strengthChanged(strength); } +/*! \fn void QGraphicsGrayscaleEffect::strengthChanged(qreal strength) + This signal is emitted whenever setStrength() changes the grayscale + strength property. \a strength contains the new strength value of + the grayscale effect. + */ + /*! \reimp */ @@ -602,6 +608,12 @@ void QGraphicsColorizeEffect::setStrength(qreal strength) emit strengthChanged(strength); } +/*! \fn void QGraphicsColorizeEffect::strengthChanged(qreal strength) + This signal is emitted whenever setStrength() changes the colorize + strength property. \a strength contains the new strength value of + the colorize effect. + */ + /*! \fn void QGraphicsColorizeEffect::colorChanged(const QColor &color) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index f57f65f..5897ae4 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -257,9 +257,9 @@ void QGraphicsAnchorLayout::addCornerAnchors(QGraphicsLayoutItem *firstItem, } /*! - Anchors two or four edges of \a firstItem with the corresponding edges of \secondItem, - so that \a firstItem has the same size as \a secondItem in the dimensions specified by - \a orientation. + Anchors two or four edges of \a firstItem with the corresponding + edges of \a secondItem, so that \a firstItem has the same size as + \a secondItem in the dimensions specified by \a orientations. Calling this convenience function with the following arguments \code @@ -288,45 +288,6 @@ void QGraphicsAnchorLayout::addAnchors(QGraphicsLayoutItem *firstItem, } /*! - \fn QGraphicsAnchorLayout::addLeftAndRightAnchors(QGraphicsLayoutItem *firstItem, QGraphicsLayoutItem *secondItem) - - Anchors the left and right edges of \a firstItem to the same edges of - \a secondItem. - - This convenience function is equivalent to calling - \code - l->addAnchor(firstItem, Qt::AnchorLeft, secondItem, Qt::AnchorLeft); - l->addAnchor(firstItem, Qt::AnchorRight, secondItem, Qt::AnchorRight); - \endcode -*/ - -/*! - \fn QGraphicsAnchorLayout::addTopAndBottomAnchors(QGraphicsLayoutItem *firstItem, QGraphicsLayoutItem *secondItem) - - Anchors the top and bottom edges of \a firstItem to the same edges of - \a secondItem. - - This convenience function is equivalent to calling - \code - l->addAnchor(firstItem, Qt::AnchorTop, secondItem, Qt::AnchorTop); - l->addAnchor(firstItem, Qt::AnchorBottom, secondItem, Qt::AnchorBottom); - \endcode -*/ - -/*! - \fn QGraphicsAnchorLayout::addAllAnchors(QGraphicsLayoutItem *firstItem, QGraphicsLayoutItem *secondItem) - - Anchors all edges (left, right, top and bottom) of \a firstItem to the same edges of - \a secondItem. - - This convenience function is equivalent to calling - \code - l->addLeftAndRightAnchors(firstItem, secondItem); - l->addTopAndBottomAnchors(firstItem, secondItem); - \endcode -*/ - -/*! Sets the default horizontal spacing for the anchor layout to \a spacing. \sa horizontalSpacing(), setVerticalSpacing(), setSpacing() diff --git a/src/svg/qgraphicssvgitem.cpp b/src/svg/qgraphicssvgitem.cpp index ea26c78..bcdd821 100644 --- a/src/svg/qgraphicssvgitem.cpp +++ b/src/svg/qgraphicssvgitem.cpp @@ -265,6 +265,12 @@ int QGraphicsSvgItem::type() const return Type; } +/*! + \property QGraphicsSvgItem::maximumCacheSize + + This property holds the maximum size of the device coordinate cache + for this item. + */ /*! Sets the maximum device coordinate cache size of the item to \a size. @@ -305,8 +311,13 @@ QSize QGraphicsSvgItem::maximumCacheSize() const } /*! - Sets the XML ID of the element that this item should render to \a - id. + \property QGraphicsSvgItem::elementId + + This property holds the element's XML ID. + */ + +/*! + Sets the XML ID of the element to \a id. */ void QGraphicsSvgItem::setElementId(const QString &id) { @@ -318,7 +329,7 @@ void QGraphicsSvgItem::setElementId(const QString &id) /*! Returns the XML ID the element that is currently - being renderer. Returns an empty string if the whole + being rendered. Returns an empty string if the whole file is being rendered. */ QString QGraphicsSvgItem::elementId() const -- cgit v0.12 From af1cfbc945c7c01adea09d3d369699f4dd0daab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 15 Sep 2009 12:27:37 +0200 Subject: Fixed rendering errors in blurpicker with -graphicssystem opengl 1) Need to transfer to brush drawing mode when switching active engine, to make sure we reset the vertex / texture coordinate pointers for image drawing. 2) QGLPixmapGLPaintDevice::beginPaint() was changed to use QGLContext::drawTexture() for blitting the old texture contents to the render FBO, which means that we also need to set up viewport, modelview, and projection matrices, and ensure that clipping / stencil testing is disabled. 3) Make sure stencil testing is disabled when clearing the FBO. Reviewed-by: Tom --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 1 + src/opengl/qpixmapdata_gl.cpp | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 5e790cf..e41d0b4 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1385,6 +1385,7 @@ void QGL2PaintEngineEx::ensureActive() d->device->ensureActiveTarget(); if (d->needsSync) { + d->transferMode(BrushDrawingMode); glViewport(0, 0, d->width, d->height); glDepthMask(false); glDepthFunc(GL_LESS); diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 0bc46e1..d5398a9 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -149,6 +149,7 @@ void QGLPixmapGLPaintDevice::beginPaint() if (data->needsFill()) { const QColor &c = data->fillColor(); float alpha = c.alphaF(); + glDisable(GL_SCISSOR_TEST); glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha); glClear(GL_COLOR_BUFFER_BIT); } @@ -157,8 +158,21 @@ void QGLPixmapGLPaintDevice::beginPaint() // uploaded from an image or rendered into before), we need to // copy it from the texture to the render FBO. + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glDisable(GL_BLEND); + + glMatrixMode(GL_MODELVIEW_MATRIX); + glLoadIdentity(); + + glMatrixMode(GL_PROJECTION_MATRIX); + glLoadIdentity(); + glOrtho(0, data->width(), data->height(), 0, -999999, 999999); + + glViewport(0, 0, data->width(), data->height()); + // Pass false to bind so it doesn't copy the FBO into the texture! - context()->drawTexture(QPointF(0.0, 0.0), data->bind(false)); + context()->drawTexture(QRect(0, 0, data->width(), data->height()), data->bind(false)); } } -- cgit v0.12 From 6a90f032d160f35058373fce16efd1b5d2190bf1 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 15 Sep 2009 12:32:42 +0200 Subject: Fixed QLineEdit to pass the tst_QLineEdit::displayText() autotest. Fetch the correct password character from the style. Reviewed-by: Olivier --- src/gui/widgets/qlineedit.cpp | 6 +++++- src/gui/widgets/qlineedit_p.cpp | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index a55ca8e..37e57cf 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -2047,7 +2047,11 @@ void QLineEdit::changeEvent(QEvent *ev) d->control->setFont(font()); break; case QEvent::StyleChange: - d->control->setPasswordCharacter(style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter)); + { + QStyleOptionFrameV2 opt; + initStyleOption(&opt); + d->control->setPasswordCharacter(style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, this)); + } update(); break; case QEvent::LayoutDirectionChange: diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp index 4fe02a2..148da1b 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/gui/widgets/qlineedit_p.cpp @@ -159,7 +159,10 @@ void QLineEditPrivate::init(const QString& txt) QObject::connect(control, SIGNAL(updateNeeded(const QRect &)), q, SLOT(update())); - control->setPasswordCharacter(q->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter)); + + QStyleOptionFrameV2 opt; + q->initStyleOption(&opt); + control->setPasswordCharacter(q->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, q)); #ifndef QT_NO_CURSOR q->setCursor(Qt::IBeamCursor); #endif -- cgit v0.12 From 2b21c3f4022c64ee6f0178b1866f22639c377ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 15 Sep 2009 12:35:17 +0200 Subject: Made QGraphicsBlurEffect use the high blur quality setting. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This greatly increases the blur quality in the OpenGL implementation, and doesn't affect the performance of the raster implementation. Reviewed-by: Bjørn Erik Nilsen --- src/gui/effects/qgraphicseffect.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index c0877a4..ee87323 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -794,6 +794,8 @@ void QGraphicsPixelizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent) { + Q_D(QGraphicsBlurEffect); + d->filter->setQuality(Qt::SmoothTransformation); } /*! -- cgit v0.12 From cd5f0f868bc830c6b350e8263fd53597f52e1146 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Tue, 15 Sep 2009 13:01:45 +0200 Subject: Doc: Added some snippets to the multimedia audio docs. --- doc/src/snippets/audio/main.cpp | 109 ++++++++++++++++++++++++++++++ src/multimedia/audio/qaudiodeviceinfo.cpp | 6 +- src/multimedia/audio/qaudioformat.cpp | 3 +- src/multimedia/audio/qaudioinput.cpp | 7 +- src/multimedia/audio/qaudiooutput.cpp | 7 +- 5 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 doc/src/snippets/audio/main.cpp diff --git a/doc/src/snippets/audio/main.cpp b/doc/src/snippets/audio/main.cpp new file mode 100644 index 0000000..a215d43 --- /dev/null +++ b/doc/src/snippets/audio/main.cpp @@ -0,0 +1,109 @@ + +#include + +#include +#include +#include + +class Window2 : public QWidget +{ + Q_OBJECT + +public slots: +//![0] + void stateChanged(QAudio::State newState) + { + switch(newState) { + case QAudio::StopState: + if (input->error() != QAudio::NoError) { + // Error handling + } else { + + } + break; +//![0] + default: + ; + } + } + +private: + QAudioInput *input; + +}; + +class Window : public QWidget +{ + Q_OBJECT + +public: + Window() + { + output = new QAudioOutput; + connect(output, SIGNAL(stateChanged(QAudio::State)), + this, SLOT(stateChanged(QAudio::State))); + } + +private: + void setupFormat() + { +//![1] + QAudioFormat format; + format.setFrequency(44100); +//![1] + format.setChannels(2); + format.setSampleSize(16); + format.setCodec("audio/pcm"); + format.setByteOrder(QAudioFormat::LittleEndian); +//![2] + format.setSampleType(QAudioFormat::SignedInt); + + QAudioDeviceId id = QAudioDeviceInfo::defaultOutputDevice(); + QAudioDeviceInfo info(id); + + if (!info.isFormatSupported(format)) + format = info.nearestFormat(format); +//![2] + } + +public slots: +//![3] + void stateChanged(QAudio::State newState) + { + switch (newState) { + case QAudio::StopState: + if (output->error() != QAudio::NoError) { + // Do your error handlin + } else { + // Normal stop + } + break; +//![3] + + // Handle + case QAudio::ActiveState: + // Handle active state... + break; + break; + default: + ; + } + } + +private: + QAudioOutput *output; +}; + +int main(int argv, char **args) +{ + QApplication app(argv, args); + + Window window; + window.show(); + + return app.exec(); +} + + +#include "main.moc" + diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp index e349733..e38a91e 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo.cpp @@ -71,7 +71,11 @@ QT_BEGIN_NAMESPACE audio plugins installed and the audio device capabilities. If you need a specific format, you can check if the device supports it with isFormatSupported(), or fetch a supported format that is as close as possible to the format with - nearestFormat(). + nearestFormat(). For instance: + + \snippet doc/src/snippets/audio/main.cpp 1 + \dots 8 + \snippet doc/src/snippets/audio/main.cpp 2 A QAudioDeviceInfo is constructed with a QAudioDeviceId, which is an identifier for a physical device. It is used by Qt to construct diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp index ddfcc2c..c23e454 100644 --- a/src/multimedia/audio/qaudioformat.cpp +++ b/src/multimedia/audio/qaudioformat.cpp @@ -134,7 +134,8 @@ public: through functions in QAudioDeviceInfo. This class also lets you query available parameter values for a device, so that you can set the parameters yourself. See the QAudioDeviceInfo class - description for details. + description for details. You need to know the format of the audio + streams you wish to play. Qt does not set up formats for you. */ /*! diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index edf6dd6..3c0d98e 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -128,7 +128,12 @@ QT_BEGIN_NAMESPACE which states the QAudioInput has been in. If an error should occur, you can fetch its reason with error(). - The possible error reasons are described by the QAudio::Error enum. + The possible error reasons are described by the QAudio::Error + enum. The QAudioInput will enter the \l{QAudio::}{StopState} when + an error is encountered. Connect to the stateChanged() signal to + handle the error: + + \snippet doc/src/snippets/audio/main.cpp 0 \sa QAudioOutput, QAudioDeviceInfo */ diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index 556b616..8a8edb4 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -129,9 +129,12 @@ QT_BEGIN_NAMESPACE If an error occurs, you can fetch the \l{QAudio::Error}{error type} with the error() function. Please see the QAudio::Error enum - for a description of the possible errors that are reported. + for a description of the possible errors that are reported. When + an error is encountered, the state changes to QAudio::StopState. + You can check for errors by connecting to the stateChanged() + signal: - If an error is encountered state changes to QAudio::StopState. + \snippet doc/src/snippets/audio/main.cpp 3 \sa QAudioInput, QAudioDeviceInfo */ -- cgit v0.12 From afb6c4935dc6a7be0f9de092003477692559815c Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 15 Sep 2009 14:19:43 +0200 Subject: Fix ambiguous overload for QTileRules constructor Also fix the relations in the documentation Reviewed-by: David Boddie --- src/corelib/tools/qmargins.cpp | 2 ++ src/gui/painting/qdrawutil.cpp | 6 ++++-- src/gui/painting/qdrawutil.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp index f5441a3..58cef4a 100644 --- a/src/corelib/tools/qmargins.cpp +++ b/src/corelib/tools/qmargins.cpp @@ -59,6 +59,8 @@ QT_BEGIN_NAMESPACE QMargin objects can be streamed as well as compared. + \sa qDrawBorderPixmap + */ diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index 17cf196..7be8e04 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -1044,7 +1044,7 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs, Holds the rules used to draw a pixmap or image split into nine segments, similar to \l{http://www.w3.org/TR/css3-background/}{CSS3 border-images}. - \sa Qt::TileRule, QMargins + \sa Qt::TileRule, QMargins, qDrawBorderPixmap */ /*! \fn QTileRules::QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule) @@ -1060,7 +1060,7 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs, /*! \fn void qDrawBorderPixmap(QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap) \since 4.6 - \relates QMargins + \relates QPainter Draws the given \a pixmap into the given \a target rectangle, using the given \a painter. The pixmap will be split into nine segments and drawn @@ -1156,6 +1156,8 @@ static inline void qDrawHorizontallyRoundedPixmap(QPainter *painter, const QRect /*! \since 4.6 + \relates QPainter + Draws the indicated \a sourceRect rectangle from the given \a pixmap into the given \a targetRect rectangle, using the given \a painter. The pixmap will be split into nine segments according to the given \a targetMargins diff --git a/src/gui/painting/qdrawutil.h b/src/gui/painting/qdrawutil.h index ce89e22..3a2dd0e 100644 --- a/src/gui/painting/qdrawutil.h +++ b/src/gui/painting/qdrawutil.h @@ -135,7 +135,7 @@ Q_GUI_EXPORT QT3_SUPPORT void qDrawArrow(QPainter *p, Qt::ArrowType type, Qt::GU struct QTileRules { - inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule = Qt::Stretch) + inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule) : horizontal(horizontalRule), vertical(verticalRule) {} inline QTileRules(Qt::TileRule rule = Qt::Stretch) : horizontal(rule), vertical(rule) {} -- cgit v0.12 From d9597782202b2be117874330ceee95040c7365cb Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Tue, 15 Sep 2009 12:14:03 +0200 Subject: Don't do pixel tests in QGraphicsEffect on other than 32-bit display. Reviewed-by: Paul Olav Tvete --- tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index d5205cd..ba3783b 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -41,6 +41,7 @@ #include +#include #include #include #include @@ -369,6 +370,11 @@ void tst_QGraphicsEffect::opacity() void tst_QGraphicsEffect::grayscale() { + if (qApp->desktop()->depth() < 24) { + QSKIP("Test only works on 32 bit displays", SkipAll); + return; + } + QGraphicsScene scene(0, 0, 100, 100); QGraphicsRectItem *item = scene.addRect(0, 0, 50, 50); @@ -412,6 +418,11 @@ void tst_QGraphicsEffect::grayscale() void tst_QGraphicsEffect::colorize() { + if (qApp->desktop()->depth() < 24) { + QSKIP("Test only works on 32 bit displays", SkipAll); + return; + } + QGraphicsScene scene(0, 0, 100, 100); QGraphicsRectItem *item = scene.addRect(0, 0, 50, 50); -- cgit v0.12 From 14b0db1a93deb0fd13dd27c1d6bda9d78b544b68 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 15 Sep 2009 13:04:11 +0200 Subject: QNativeSocketEngine on Windows: don't bail out on non-fatal error receiving the WSAEMSGSIZE error means we could not read all the data because the buffer was too small, but still we should return the number of bytes read and not return -1 Reviewed-by: Marius Storm-Olsen --- src/network/socket/qnativesocketengine_win.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 3478130..63fe78e 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -917,9 +917,15 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxL int wsaRet = ::WSARecvFrom(socketDescriptor, &buf, 1, &bytesRead, &flags, &aa.a, &sz,0,0); if (wsaRet == SOCKET_ERROR) { int err = WSAGetLastError(); - WS_ERROR_DEBUG(err); - setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString); - ret = -1; + if (err == WSAEMSGSIZE) { + // it is ok the buffer was to small if bytesRead is larger than + // maxLength then assume bytes read is really maxLenth + ret = qint64(bytesRead) > maxLength ? maxLength : qint64(bytesRead); + } else { + WS_ERROR_DEBUG(err); + setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString); + ret = -1; + } } else { ret = qint64(bytesRead); } -- cgit v0.12 From 57e0656e92ac8e8dac1a6d6f1e434a78d641e05a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 15 Sep 2009 14:19:57 +0200 Subject: Removed GL1 pixmap filters and ported colorize filter to GL2 engine. The GL1 engine will use the raster fall back for pixmap filters. We anyhow use GLSL for the filters, which requires OpenGL 2 support, and in that case the GL2 engine is the default. Reviewed-by: Gunnar Sletta --- src/opengl/qglpixmapfilter.cpp | 67 +++++++++++++------------------------- src/opengl/qpaintengine_opengl.cpp | 14 -------- src/opengl/qpaintengine_opengl_p.h | 2 -- 3 files changed, 22 insertions(+), 61 deletions(-) diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 6ebc397..7876661 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -68,17 +68,16 @@ void QGLPixmapFilterBase::drawImpl(QPainter *painter, const QPointF &pos, const processGL(painter, pos, src, source); } -class QGLPixmapColorizeFilter: public QGLPixmapFilter +class QGLPixmapColorizeFilter: public QGLCustomShaderStage, public QGLPixmapFilter { public: - QGLPixmapColorizeFilter(); + void setUniforms(QGLShaderProgram *program); protected: bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &pixmap, const QRectF &srcRect) const; private: - mutable QGLShaderProgram m_program; - int m_colorUniform; + mutable QGLShader *m_shader; }; class QGLPixmapConvolutionFilter: public QGLPixmapFilter @@ -104,9 +103,6 @@ private: class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter { public: - QGLPixmapBlurFilter(); - ~QGLPixmapBlurFilter(); - void setUniforms(QGLShaderProgram *program); protected: @@ -120,8 +116,6 @@ private: mutable QSize m_textureSize; mutable bool m_horizontalBlur; - - QGLShaderProgram *m_program; }; extern QGLWidget *qt_gl_share_widget(); @@ -183,41 +177,34 @@ static void qgl_drawTexture(const QRectF &rect, int tx_width, int tx_height, con } static const char *qt_gl_colorize_filter = - "uniform sampler2D texture;" - "uniform vec3 color;" - "void main(void)" + "uniform lowp vec4 colorizeColor;" + "uniform lowp float colorizeStrength;" + "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords)" "{" - " vec2 coords = gl_TexCoord[0].st;" - " vec4 src = texture2D(texture, coords);" - " float gray = dot(src.rgb, vec3(0.212671, 0.715160, 0.072169));" - " vec3 colorizeed = 1.0-((1.0-gray)*(1.0-color));" - " gl_FragColor = vec4(colorizeed, src.a);" + " lowp vec4 srcPixel = texture2D(src, srcCoords);" + " lowp float gray = dot(srcPixel.rgb, vec3(0.212671, 0.715160, 0.072169));" + " lowp vec3 colorized = 1.0-((1.0-gray)*(1.0-colorizeColor.rgb));" + " return vec4(mix(srcPixel.rgb, colorized * srcPixel.a, colorizeStrength), srcPixel.a);" "}"; -QGLPixmapColorizeFilter::QGLPixmapColorizeFilter() +bool QGLPixmapColorizeFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const { - m_program.addShader(QGLShader::FragmentShader, qt_gl_colorize_filter); - m_program.link(); - m_program.enable(); - m_program.setUniformValue(m_program.uniformLocation("texture"), GLint(0)); // GL_TEXTURE_0 - m_colorUniform = m_program.uniformLocation("color"); -} + QGLPixmapColorizeFilter *filter = const_cast(this); + filter->setSource(qt_gl_colorize_filter); -bool QGLPixmapColorizeFilter::processGL(QPainter *, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const -{ - bindTexture(src); - - QColor col = color(); - m_program.enable(); - m_program.setUniformValue(m_colorUniform, col.redF(), col.greenF(), col.blueF()); - - QRectF target = (srcRect.isNull() ? QRectF(src.rect()) : srcRect).translated(pos); - qgl_drawTexture(target, src.width(), src.height(), srcRect); - m_program.disable(); + filter->setOnPainter(painter); + painter->drawPixmap(pos, src); + filter->removeFromPainter(painter); return true; } +void QGLPixmapColorizeFilter::setUniforms(QGLShaderProgram *program) +{ + program->setUniformValue("colorizeColor", color()); + program->setUniformValue("colorizeStrength", float(strength())); +} + // generates convolution filter code for arbitrary sized kernel QByteArray QGLPixmapConvolutionFilter::generateConvolutionShader() const { QByteArray code; @@ -310,14 +297,6 @@ bool QGLPixmapConvolutionFilter::processGL(QPainter *, const QPointF &pos, const return true; } -QGLPixmapBlurFilter::QGLPixmapBlurFilter() -{ -} - -QGLPixmapBlurFilter::~QGLPixmapBlurFilter() -{ -} - bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const { QGLPixmapBlurFilter *filter = const_cast(this); @@ -384,8 +363,6 @@ void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program) program->setUniformValue("delta", 1.0, 0.0); else program->setUniformValue("delta", 0.0, 1.0); - - m_program = program; } static inline qreal gaussian(qreal dx, qreal sigma) diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index ff00f29..bd3883a 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -5625,20 +5625,6 @@ void QOpenGLPaintEnginePrivate::ensureDrawableTexture() #endif } -QPixmapFilter *QOpenGLPaintEngine::createPixmapFilter(int type) const -{ -#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) - if (QGLContext::currentContext()) - return QGLContext::currentContext()->d_func()->createPixmapFilter(type); - else - return 0; -#else - Q_UNUSED(type); - return 0; -#endif -} - - QT_END_NAMESPACE #include "qpaintengine_opengl.moc" diff --git a/src/opengl/qpaintengine_opengl_p.h b/src/opengl/qpaintengine_opengl_p.h index c8f460a..4fea638 100644 --- a/src/opengl/qpaintengine_opengl_p.h +++ b/src/opengl/qpaintengine_opengl_p.h @@ -136,8 +136,6 @@ public: void drawEllipse(const QRectF &rect); - QPixmapFilter *createPixmapFilter(int type) const; - #ifdef Q_WS_WIN HDC handle() const; #else -- cgit v0.12 From 0b2b41f11b5e037f93480a1af2c84c59739f685d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 15 Sep 2009 14:32:40 +0200 Subject: Fix linenumbers. --- .../auto/linguist/lupdate/testdata/good/backslashes/project.ts.result | 2 +- tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result index f2d109b..d3a5fdf 100644 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result @@ -4,7 +4,7 @@ QApplication - + QT_LAYOUT_DIRECTION Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout. diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result index 93adae4..b27d239 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result @@ -4,12 +4,12 @@ FindDialog - + Qt Assistant - Finn text - + Finn tekst - Der Bjørn möchte auch mal. -- cgit v0.12 From 59aa130bb9209aa1809c7bd31f694265eeb1baf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 15 Sep 2009 14:33:18 +0200 Subject: When parsing a java file do not simply ignore the first character. If the file started with a comment (/* .. */) the parser would not see the first '/' character, thus it would not treat it as a comment. This was because we called getChar() just before we called parse(), and just after we had entered parse(). --- tools/linguist/lupdate/java.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/linguist/lupdate/java.cpp b/tools/linguist/lupdate/java.cpp index 05b1987..3f532d5 100644 --- a/tools/linguist/lupdate/java.cpp +++ b/tools/linguist/lupdate/java.cpp @@ -631,7 +631,6 @@ bool loadJava(Translator &translator, const QString &filename, ConversionData &c yyFileName = filename; yyCurLineNo = 1; yyParenLineNo = 1; - yyCh = getChar(); parse(&translator); -- cgit v0.12 From 85c79e53208b0171198cb748ad85b5be1af7a558 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 15 Sep 2009 14:55:13 +0200 Subject: doc: Fixed some qdoc errors. --- doc/src/frameworks-technologies/gestures.qdoc | 41 ++++++++++++++------------- src/gui/image/qimagereader.cpp | 3 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc index 57f25ba..a0eab21 100644 --- a/doc/src/frameworks-technologies/gestures.qdoc +++ b/doc/src/frameworks-technologies/gestures.qdoc @@ -58,21 +58,21 @@ \section1 Overview - QGesture is the central class in Qt's gesture framework, providing the API - used by classes that represent specific gestures, such as QPanGesture, - QPinchGesture, and QSwipeGesture. These standard classes are ready to use, - and each exposes functions and properties that give gesture-specific - information about the user's input. This is described in the - \l{#Using Standard Gestures}{Using Standard Gestures} section. - - QGesture is also designed to be subclassed and extended so that support for - new gestures can be implemented by developers. Adding support for a new - gesture involves implementing code to recognize the gesture from incoming - events. This is described in the - \l{#Creating Your Own Gesture Recognizer}{Creating Your Own Gesture Recognizer} - section. - - \section1 Using Standard Gestures with Widgets + QGesture is the central class in Qt's gesture framework, providing + the API used by classes that represent specific gestures, such as + QPanGesture, QPinchGesture, and QSwipeGesture. These standard + classes are ready to use, and each exposes functions and + properties that give gesture-specific information about the user's + input. This is described in the section \l{Using Standard Gestures + With Widgets}. + + QGesture is also designed to be subclassed and extended so that + support for new gestures can be implemented by developers. Adding + support for a new gesture involves implementing code to recognize + the gesture from incoming events. This is described in the section + \l{Creating Your Own Gesture Recognizer}. + + \section1 Using Standard Gestures With Widgets Gesture objects are applied directly to widgets and other controls that accept user input \mdash these are the \e{target objects}. When a gesture object is @@ -91,10 +91,11 @@ \snippet examples/gestures/imageviewer/imagewidget.cpp connect swipe gesture - Here, the \l{QGesture::}{triggered()} signal is used to inform the application - that a gesture was used. More precise monitoring of a gesture can be implemented - by connecting its \l{QGesture::}{started()}, \l{QGesture::}{canceled()} and - \l{QGesture::}{finished()} signals to slots. + Here, the \l{QGesture::} {triggered()} signal is used to inform + the application that a gesture was used. More precise monitoring + of a gesture can be implemented by connecting its \l{QGesture::} + {started()}, \l{QGesture::} {canceled()} and \l{QGesture::} + {finished()} signals to slots. Responding to a signal is simply a matter of obtaining the gesture that sent it and examining the information it contains. @@ -141,7 +142,7 @@ \table \header \o New State \o Description \o QGesture Actions on Entering this State - \row \o Qt::NoGesture \o Initial value \o emit \l {QGesture::}{cancelled()} + \row \o Qt::NoGesture \o Initial value \o emit \l {QGesture::}{canceled()} \row \o Qt::GestureStarted \o A continuous gesture has started \o emit \l{QGesture::}{started()} and emit \l{QGesture::}{triggered()} \row \o Qt::GestureUpdated \o A gesture continues \o emit \l{QGesture::}{triggered()} \row \o Qt::GestureFinished \o A gesture has finished. \o emit \l{QGesture::}{finished()} diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 5cd768f..aff186b 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -696,13 +696,12 @@ bool QImageReader::autoDetectImageFormat() const /*! - Specifies that the image reader should decide which plugin to use solely based on the contents in the datastream. Setting this flag means that all image plugins gets loaded. Each plugin will read the first bytes in the image data and decide if - the plugin is compatible or not. + the plugin is compatible or not. The flag is set to \a ignored. This also disables auto detecting image format. */ -- cgit v0.12 From 38cc0e34757d05e88d50275d8a9856347c053995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 15 Sep 2009 15:07:57 +0200 Subject: Removed a debug output that was a bit annoying Reviewed-by: Peter Hartmann --- src/network/kernel/qnetworkproxy_mac.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp index 9e2b0e4..2c7e250 100644 --- a/src/network/kernel/qnetworkproxy_mac.cpp +++ b/src/network/kernel/qnetworkproxy_mac.cpp @@ -170,8 +170,7 @@ QList macQueryInternal(const QNetworkProxyQuery &query) (CFStringRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigURLString); QString url = QCFString::toQString(pacUrl); - // ### Use PAC somehow - qDebug("Mac system proxy: found PAC script at \"%s\"", qPrintable(url)); + // ### TODO: Use PAC somehow } } -- cgit v0.12 From fd8be39b40467be69a7cd9c5a009c5a47c6a4e9b Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Tue, 15 Sep 2009 15:02:36 +0200 Subject: Remove unused signal declaration. This came in with change c8bf9bd17a4520eefe4306b7b1bb4f93fb296d80, by accident - it was a leftover after debugging. Reviewed-by: Martin Smith --- src/gui/graphicsview/qgraphicsitem.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index bc0f30f..665f33f 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -551,7 +551,6 @@ Q_SIGNALS: void zChanged(); void rotationChanged(); void scaleChanged(); - void focusChanged(); protected: QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); -- cgit v0.12 From 4c779ca7cd74b77ec5f7e480b9762acccce3c4ad Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Tue, 15 Sep 2009 15:12:52 +0200 Subject: Fix a bug in FocusScopes; ensure subFocus is set correctly. The bug was triggered by setting focus on a parent scope (which then passes focus to the innermost scope). Subfocus was set up for the first scope, but not the inner scopes. Reviewed-by: TrustMe --- src/gui/graphicsview/qgraphicsitem.cpp | 4 +++- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 838bd34..81eeb39 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -2830,6 +2830,8 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim if (climb) { while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible()) f = f->d_ptr->focusScopeItem; + if (f != q_ptr) + f->d_ptr->setSubFocus(); } // Update the scene's focus item. @@ -4979,7 +4981,7 @@ void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem) if (parent->d_ptr->subFocusItem != q_ptr) break; parent->d_ptr->subFocusItem = 0; - subFocusItemChange(); + parent->d_ptr->subFocusItemChange(); } while (!parent->isPanel() && (parent = parent->d_ptr->parent)); } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 0744fa5..304330e 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -8332,6 +8332,22 @@ void tst_QGraphicsItem::focusScope() rect4->setParentItem(0); QCOMPARE(scope3->focusScopeItem(), (QGraphicsItem *)0); QVERIFY(!scope3->hasFocus()); + + QGraphicsRectItem *rectA = new QGraphicsRectItem; + QGraphicsRectItem *scopeA = new QGraphicsRectItem(rectA); + scopeA->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsFocusScope); + scopeA->setFocus(); + QGraphicsRectItem *scopeB = new QGraphicsRectItem(scopeA); + scopeB->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsFocusScope); + scopeB->setFocus(); + + scene.addItem(rectA); + QVERIFY(rect5->hasFocus()); + QVERIFY(!scopeB->hasFocus()); + + scopeA->setFocus(); + QVERIFY(scopeB->hasFocus()); + QCOMPARE(scopeB->focusItem(), (QGraphicsItem *)scopeB); } QTEST_MAIN(tst_QGraphicsItem) -- cgit v0.12 From f42f5c457b3368adb4c92e521dc56969f138bdd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 15 Sep 2009 15:23:07 +0200 Subject: Make the scrollUpdate test function work. We could sometimes have more than two paint events even before reaching QTRY_COMPARE, thus it would fail. The test failed on Windows. --- tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 626a691..c86d9e3 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -1507,7 +1507,7 @@ void tst_QGraphicsProxyWidget::scrollUpdate() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&view); #endif - QTRY_COMPARE(view.npaints, 1); + QTRY_VERIFY(view.npaints >= 1); QTest::qWait(20); widget->paintEventRegion = QRegion(); widget->npaints = 0; -- cgit v0.12