summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/3rdparty/phonon/ds9/backend.h2
-rw-r--r--src/3rdparty/phonon/ds9/mediaobject.cpp2
-rw-r--r--src/corelib/global/qt_windows.h7
-rw-r--r--src/gui/effects/qgraphicseffect.cpp206
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp3
-rw-r--r--src/gui/kernel/qwidget.cpp9
-rw-r--r--src/gui/text/qfontengine_win.cpp4
-rw-r--r--src/opengl/qgraphicsshadereffect.cpp6
-rw-r--r--src/opengl/qgraphicsshadereffect.h4
-rw-r--r--src/script/api/qscriptvalue.cpp47
-rw-r--r--src/script/api/qscriptvalue_p.h6
-rw-r--r--tests/auto/qbytearray/tst_qbytearray.cpp54
-rw-r--r--tests/auto/qmainwindow/tst_qmainwindow.cpp26
-rw-r--r--tests/auto/qobject/tst_qobject.cpp94
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp2
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp29
16 files changed, 387 insertions, 114 deletions
diff --git a/src/3rdparty/phonon/ds9/backend.h b/src/3rdparty/phonon/ds9/backend.h
index 9b2c2a2..8b020c2 100644
--- a/src/3rdparty/phonon/ds9/backend.h
+++ b/src/3rdparty/phonon/ds9/backend.h
@@ -64,7 +64,7 @@ namespace Phonon
Filter getAudioOutputFilter(int index) const;
- static QMutex *Backend::directShowMutex();
+ static QMutex *directShowMutex();
Q_SIGNALS:
void objectDescriptionChanged(ObjectDescriptionType);
diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp
index 579517f..e42dff9 100644
--- a/src/3rdparty/phonon/ds9/mediaobject.cpp
+++ b/src/3rdparty/phonon/ds9/mediaobject.cpp
@@ -21,9 +21,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <QtCore/QTime>
#include <QtCore/QLibrary>
-#ifndef Q_CC_MSVC
#include <dshow.h>
-#endif //Q_CC_MSVC
#include <objbase.h>
#include <initguid.h>
#include <qnetwork.h>
diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h
index 6e3f242..dd722f9 100644
--- a/src/corelib/global/qt_windows.h
+++ b/src/corelib/global/qt_windows.h
@@ -53,6 +53,13 @@
#endif
#endif
+#if defined(Q_CC_MINGW)
+// mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation
+#ifndef WINVER
+#define WINVER 0x500
+#endif
+#endif
+
#include <windows.h>
#ifdef _WIN32_WCE
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index 9ed01df..0289914 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -108,7 +108,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QGraphicsEffectSource
- \brief The QGraphicsEffectSource represents the source on which a
+ \brief The QGraphicsEffectSource class represents the source on which a
QGraphicsEffect is installed on.
\since 4.6
@@ -119,12 +119,19 @@ QT_BEGIN_NAMESPACE
QGraphicsEffectSource also provides a pixmap() function which creates a
pixmap with the source painted into it.
- \sa QGraphicsItem::setGraphicsEffect(), QWidget::setGraphicsEffect.
+ \sa QGraphicsItem::setGraphicsEffect(), QWidget::setGraphicsEffect().
+*/
+
+/*!
+ \internal
*/
QGraphicsEffectSource::QGraphicsEffectSource(QGraphicsEffectSourcePrivate &dd, QObject *parent)
: QObject(dd, parent)
{}
+/*!
+ Destroys the effect source.
+*/
QGraphicsEffectSource::~QGraphicsEffectSource()
{}
@@ -167,8 +174,8 @@ const QGraphicsItem *QGraphicsEffectSource::graphicsItem() const
}
/*!
- Returns a pointer to the widget if this source is a QWidget; otherwis
- returns 0.
+ Returns a pointer to the widget if this source is a QWidget; otherwise
+ returns 0.
\sa graphicsItem()
*/
@@ -199,7 +206,6 @@ const QStyleOption *QGraphicsEffectSource::styleOption() const
\sa QGraphicsEffect::draw()
*/
-
void QGraphicsEffectSource::draw(QPainter *painter)
{
d_func()->draw(painter);
@@ -312,8 +318,6 @@ QRectF QGraphicsEffect::boundingRectFor(const QRectF &rect) const
Using this property, you can disable certain effects on slow platforms, in
order to ensure that the user interface is responsive.
-
- \sa enabledChanged()
*/
bool QGraphicsEffect::isEnabled() const
{
@@ -337,6 +341,7 @@ void QGraphicsEffect::setEnabled(bool enable)
\fn void QGraphicsEffect::enabledChanged(bool enabled)
This signal is emitted whenever the effect is enabled or disabled.
+ The \a enabled parameter holds the effects's new enabled state.
\sa isEnabled()
*/
@@ -423,15 +428,26 @@ void QGraphicsEffect::sourceChanged(ChangeFlags flags)
\sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect,
QGraphicsColorizeEffect, QGraphicsOpacityEffect
*/
+
+/*!
+ Constructs a new QGraphicsGrayscale instance.
+ The \a parent parameter is passed to QGraphicsEffect's constructor.
+*/
QGraphicsGrayscaleEffect::QGraphicsGrayscaleEffect(QObject *parent)
: QGraphicsEffect(*new QGraphicsGrayscaleEffectPrivate, parent)
{
}
+/*!
+ Destroys the effect.
+*/
QGraphicsGrayscaleEffect::~QGraphicsGrayscaleEffect()
{
}
+/*!
+ \reimp
+*/
void QGraphicsGrayscaleEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
{
Q_D(QGraphicsGrayscaleEffect);
@@ -454,7 +470,7 @@ void QGraphicsGrayscaleEffect::draw(QPainter *painter, QGraphicsEffectSource *so
/*!
\class QGraphicsColorizeEffect
- \brief The QGraphicsColorizeEffect provides a colorize effect.
+ \brief The QGraphicsColorizeEffect class provides a colorize effect.
\since 4.6
A colorize effect renders the source with a tint of its color(). The color
@@ -465,31 +481,35 @@ void QGraphicsGrayscaleEffect::draw(QPainter *painter, QGraphicsEffectSource *so
\sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect,
QGraphicsGrayscaleEffect, QGraphicsOpacityEffect
*/
+
+/*!
+ Constructs a new QGraphicsColorizeEffect instance.
+ The \a parent parameter is passed to QGraphicsEffect's constructor.
+*/
QGraphicsColorizeEffect::QGraphicsColorizeEffect(QObject *parent)
: QGraphicsEffect(*new QGraphicsColorizeEffectPrivate, parent)
{
}
+/*!
+ Destroys the effect.
+*/
QGraphicsColorizeEffect::~QGraphicsColorizeEffect()
{
}
/*!
- Returns the color.
+ \property QGraphicsColorizeEffect::color
+ \brief the color of the effect.
- \sa setColor(), colorChanged()
-*/
+ By default, the color is light blue (QColor(0, 0, 192)).
+*/;
QColor QGraphicsColorizeEffect::color() const
{
Q_D(const QGraphicsColorizeEffect);
return d->filter->color();
}
-/*!
- Sets the color to the given \a color.
-
- \sa color(), colorChanged()
-*/
void QGraphicsColorizeEffect::setColor(const QColor &color)
{
Q_D(QGraphicsColorizeEffect);
@@ -504,8 +524,12 @@ void QGraphicsColorizeEffect::setColor(const QColor &color)
\fn void QGraphicsColorizeEffect::colorChanged(const QColor &color)
This signal is emitted whenever the effect's color changes.
+ The \a color parameter holds the effect's new color.
*/
+/*!
+ \reimp
+*/
void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
{
Q_D(QGraphicsColorizeEffect);
@@ -527,7 +551,7 @@ void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou
/*!
\class QGraphicsPixelizeEffect
- \brief The QGraphicsPixelizeEffect provides a pixelize effect.
+ \brief The QGraphicsPixelizeEffect class provides a pixelize effect.
\since 4.6
A pixelize effect renders the source in lower resolution. This effect is
@@ -539,19 +563,31 @@ void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou
\sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsGrayscaleEffect,
QGraphicsColorizeEffect, QGraphicsOpacityEffect
*/
+
+/*!
+ Constructs a new QGraphicsPixelizeEffect instance.
+ The \a parent parameter is passed to QGraphicsEffect's constructor.
+*/
QGraphicsPixelizeEffect::QGraphicsPixelizeEffect(QObject *parent)
: QGraphicsEffect(*new QGraphicsPixelizeEffectPrivate, parent)
{
}
+/*!
+ Destroys the effect.
+*/
QGraphicsPixelizeEffect::~QGraphicsPixelizeEffect()
{
}
/*!
- Returns the size of a pixel.
+ \property QGraphicsPixelizeEffect::pixelSize
+ \brief the size of a pixel in the effect.
- \sa setPixelSize(), pixelSizeChanged()
+ Setting the pixel size to 2 means two pixels in the source will be used to
+ represent one pixel. Using a bigger size results in lower resolution.
+
+ By default, the pixel size is 3.
*/
int QGraphicsPixelizeEffect::pixelSize() const
{
@@ -559,14 +595,6 @@ int QGraphicsPixelizeEffect::pixelSize() const
return d->pixelSize;
}
-/*!
- Sets the size of a pixel to the given \a size.
-
- Setting \a size to 2 means two pixels in the source will be used to
- represent one pixel. Using a bigger size results in lower resolution.
-
- \sa pixelSize(), pixelSizeChanged()
-*/
void QGraphicsPixelizeEffect::setPixelSize(int size)
{
Q_D(QGraphicsPixelizeEffect);
@@ -581,6 +609,7 @@ void QGraphicsPixelizeEffect::setPixelSize(int size)
\fn void QGraphicsPixelizeEffect::pixelSizeChanged(int size)
This signal is emitted whenever the effect's pixel size changes.
+ The \a size parameter holds the effect's new pixel size.
*/
static inline void pixelize(QImage *image, int pixelSize)
@@ -604,6 +633,9 @@ static inline void pixelize(QImage *image, int pixelSize)
}
}
+/*!
+ \reimp
+*/
void QGraphicsPixelizeEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
{
Q_D(QGraphicsPixelizeEffect);
@@ -636,7 +668,7 @@ void QGraphicsPixelizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou
/*!
\class QGraphicsBlurEffect
- \brief The QGraphicsBlurEffect provides a blur effect.
+ \brief The QGraphicsBlurEffect class provides a blur effect.
\since 4.6
A blur effect blurs the source. This effect is useful for reducing details,
@@ -649,19 +681,31 @@ void QGraphicsPixelizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou
\sa QGraphicsDropShadowEffect, QGraphicsPixelizeEffect, QGraphicsGrayscaleEffect,
QGraphicsColorizeEffect, QGraphicsOpacityEffect
*/
+
+/*!
+ Constructs a new QGraphicsBlurEffect instance.
+ The \a parent parameter is passed to QGraphicsEffect's constructor.
+*/
QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent)
: QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent)
{
}
+/*!
+ Destroys the effect.
+*/
QGraphicsBlurEffect::~QGraphicsBlurEffect()
{
}
/*!
- Returns the blur radius.
+ \property QGraphicsBlurEffect::blurRadius
+ \brief the blur radius of the effect.
+
+ Using a smaller radius results in a sharper appearance, whereas a bigger
+ radius results in a more blurred appearance.
- \sa setBlurRadius(), blurRadiusChanged()
+ By default, the blur radius is 5 pixels.
*/
int QGraphicsBlurEffect::blurRadius() const
{
@@ -669,14 +713,6 @@ int QGraphicsBlurEffect::blurRadius() const
return d->filter->radius();
}
-/*!
- Sets the blur radius to the given \a radius.
-
- Using a smaller radius results in a sharper appearance, whereas a bigger
- radius results in a more blurred appearance.
-
- \sa blurRadius(), blurRadiusChanged()
-*/
void QGraphicsBlurEffect::setBlurRadius(int radius)
{
Q_D(QGraphicsBlurEffect);
@@ -692,14 +728,21 @@ void QGraphicsBlurEffect::setBlurRadius(int radius)
\fn void QGraphicsBlurEffect::blurRadiusChanged(int radius)
This signal is emitted whenever the effect's blur radius changes.
+ The \a radius parameter holds the effect's new blur radius.
*/
+/*!
+ \reimp
+*/
QRectF QGraphicsBlurEffect::boundingRectFor(const QRectF &rect) const
{
Q_D(const QGraphicsBlurEffect);
return d->filter->boundingRectFor(rect);
}
+/*!
+ \reimp
+*/
void QGraphicsBlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
{
Q_D(QGraphicsBlurEffect);
@@ -742,19 +785,30 @@ void QGraphicsBlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
\sa QGraphicsBlurEffect, QGraphicsPixelizeEffect, QGraphicsGrayscaleEffect,
QGraphicsColorizeEffect, QGraphicsOpacityEffect
*/
+
+/*!
+ Constructs a new QGraphicsDropShadowEffect instance.
+ The \a parent parameter is passed to QGraphicsEffect's constructor.
+*/
QGraphicsDropShadowEffect::QGraphicsDropShadowEffect(QObject *parent)
: QGraphicsEffect(*new QGraphicsDropShadowEffectPrivate, parent)
{
}
+/*!
+ Destroys the effect.
+*/
QGraphicsDropShadowEffect::~QGraphicsDropShadowEffect()
{
}
/*!
- Returns the shadow offset in pixels.
+ \property QGraphicsDropShadowEffect::offset
+ \brief the shadow offset in pixels.
- \sa setOffset(), blurRadius(), color(), offsetChanged()
+ By default, the offset is 8 pixels towards the lower right.
+
+ \sa blurRadius(), color()
*/
QPointF QGraphicsDropShadowEffect::offset() const
{
@@ -762,11 +816,6 @@ QPointF QGraphicsDropShadowEffect::offset() const
return d->filter->offset();
}
-/*!
- Sets the shadow offset in pixels to the given \a offset.
-
- \sa offset(), setBlurRadius(), setColor(), offsetChanged()
-*/
void QGraphicsDropShadowEffect::setOffset(const QPointF &offset)
{
Q_D(QGraphicsDropShadowEffect);
@@ -782,12 +831,19 @@ void QGraphicsDropShadowEffect::setOffset(const QPointF &offset)
\fn void QGraphicsDropShadowEffect::offsetChanged(const QPointF &offset)
This signal is emitted whenever the effect's shadow offset changes.
+ The \a offset parameter holds the effect's new shadow offset.
*/
/*!
- Returns the radius in pixels of the blur on the drop shadow.
+ \property QGraphicsDropShadowEffect::blurRadius
+ \brief the blur radius in pixels of the drop shadow.
+
+ Using a smaller radius results in a sharper shadow, whereas using a bigger
+ radius results in a more blurred shadow.
+
+ By default, the blur radius is 1 pixel.
- \sa setBlurRadius(), color(), offset(), blurRadiusChanged()
+ \sa color(), offset().
*/
int QGraphicsDropShadowEffect::blurRadius() const
{
@@ -795,15 +851,6 @@ int QGraphicsDropShadowEffect::blurRadius() const
return d->filter->blurRadius();
}
-/*!
- Sets the radius in pixels of the blur on the drop shadow to the
- \a blurRadius specified.
-
- Using a smaller radius results in a sharper shadow, whereas using a bigger
- radius results in a more blurred shadow.
-
- \sa blurRadius(), setColor(), setOffset(), blurRadiusChanged()
-*/
void QGraphicsDropShadowEffect::setBlurRadius(int blurRadius)
{
Q_D(QGraphicsDropShadowEffect);
@@ -819,12 +866,17 @@ void QGraphicsDropShadowEffect::setBlurRadius(int blurRadius)
\fn void QGraphicsDropShadowEffect::blurRadiusChanged(int blurRadius)
This signal is emitted whenever the effect's blur radius changes.
+ The \a blurRadius parameter holds the effect's new blur radius.
*/
/*!
- Returns the color of the drop shadow.
+ \property QGraphicsDropShadowEffect::color
+ \brief the color of the drop shadow.
+
+ By default, the drop color is a semi-transparent dark gray
+ (QColor(63, 63, 63, 180)).
- \sa setColor, offset(), blurRadius(), colorChanged()
+ \sa offset(), blurRadius()
*/
QColor QGraphicsDropShadowEffect::color() const
{
@@ -832,11 +884,6 @@ QColor QGraphicsDropShadowEffect::color() const
return d->filter->color();
}
-/*!
- Sets the color of the drop shadow to the given \a color.
-
- \sa color(), setOffset(), setBlurRadius(), colorChanged()
-*/
void QGraphicsDropShadowEffect::setColor(const QColor &color)
{
Q_D(QGraphicsDropShadowEffect);
@@ -851,14 +898,21 @@ void QGraphicsDropShadowEffect::setColor(const QColor &color)
\fn void QGraphicsDropShadowEffect::colorChanged(const QColor &color)
This signal is emitted whenever the effect's color changes.
+ The \a color parameter holds the effect's new color.
*/
+/*!
+ \reimp
+*/
QRectF QGraphicsDropShadowEffect::boundingRectFor(const QRectF &rect) const
{
Q_D(const QGraphicsDropShadowEffect);
return d->filter->boundingRectFor(rect);
}
+/*!
+ \reimp
+*/
void QGraphicsDropShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
{
Q_D(QGraphicsDropShadowEffect);
@@ -897,19 +951,31 @@ void QGraphicsDropShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *s
\sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect,
QGraphicsGrayscaleEffect, QGraphicsColorizeEffect
*/
+
+/*!
+ Constructs a new QGraphicsOpacityEffect instance.
+ The \a parent parameter is passed to QGraphicsEffect's constructor.
+*/
QGraphicsOpacityEffect::QGraphicsOpacityEffect(QObject *parent)
: QGraphicsEffect(*new QGraphicsOpacityEffectPrivate, parent)
{
}
+/*!
+ Destroys the effect.
+*/
QGraphicsOpacityEffect::~QGraphicsOpacityEffect()
{
}
/*!
- Returns the opacity.
+ \property QGraphicsOpacityEffect::opacity
+ \brief the opacity of the effect.
+
+ The value should be in the range of 0.0 to 1.0, where 0.0 is
+ fully transparent and 1.0 is fully opaque.
- \sa setOpacity(), opacityChanged()
+ By default, the opacity is 0.7.
*/
qreal QGraphicsOpacityEffect::opacity() const
{
@@ -917,12 +983,6 @@ qreal QGraphicsOpacityEffect::opacity() const
return d->opacity;
}
-/*!
- Sets the opacity to the given \a opacity. The value should be in the range
- of 0.0 to 1.0, where 0.0 is fully transparent and 1.0 is fully opaque.
-
- \sa opacity(), opacityChanged()
-*/
void QGraphicsOpacityEffect::setOpacity(qreal opacity)
{
Q_D(QGraphicsOpacityEffect);
@@ -939,8 +999,12 @@ void QGraphicsOpacityEffect::setOpacity(qreal opacity)
\fn void QGraphicsOpacityEffect::opacityChanged(qreal opacity)
This signal is emitted whenever the effect's opacity changes.
+ The \a opacity parameter holds the effect's new opacity.
*/
+/*!
+ \reimp
+*/
void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
{
Q_D(QGraphicsOpacityEffect);
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index bca5df7..ccc57d7 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -1661,9 +1661,6 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event)
EditTrigger trigger = (selectedClicked ? SelectedClicked : NoEditTriggers);
bool edited = edit(index, trigger, event);
- if (d->selectionModel)
- d->selectionModel->select(index, selectionCommand(index, event));
-
setState(NoState);
if (click) {
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 62d0848..d39044a 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -4970,6 +4970,13 @@ void QWidgetPrivate::setSoftKeys_sys(const QList<QAction*> &softkeys)
}
#endif // !defined(Q_OS_SYMBIAN)
+/*!
+ Returns a pointer to this widget's effect if it has one; otherwise 0.
+
+ \since 4.6
+
+ \sa setGraphicsEffect()
+*/
QGraphicsEffect *QWidget::graphicsEffect() const
{
Q_D(const QWidget);
@@ -4987,6 +4994,8 @@ QGraphicsEffect *QWidget::graphicsEffect() const
\note This function will apply the effect on itself and all its children.
\since 4.6
+
+ \sa graphicsEffect()
*/
void QWidget::setGraphicsEffect(QGraphicsEffect *effect)
{
diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp
index 173b822..7a9d958 100644
--- a/src/gui/text/qfontengine_win.cpp
+++ b/src/gui/text/qfontengine_win.cpp
@@ -327,8 +327,10 @@ QFontEngineWin::QFontEngineWin(const QString &name, HFONT _hfont, bool stockFont
BOOL res = GetTextMetrics(hdc, &tm);
fontDef.fixedPitch = !(tm.tmPitchAndFamily & TMPF_FIXED_PITCH);
- if (!res)
+ if (!res) {
qErrnoWarning("QFontEngineWin: GetTextMetrics failed");
+ ZeroMemory(&tm, sizeof(TEXTMETRIC));
+ }
cache_cost = tm.tmHeight * tm.tmAveCharWidth * 2000;
getCMap();
diff --git a/src/opengl/qgraphicsshadereffect.cpp b/src/opengl/qgraphicsshadereffect.cpp
index 5e37d62..293413c 100644
--- a/src/opengl/qgraphicsshadereffect.cpp
+++ b/src/opengl/qgraphicsshadereffect.cpp
@@ -51,8 +51,6 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
-
/*!
\class QGraphicsShaderEffect
\brief The QGraphicsShaderEffect class is the base class for creating
@@ -126,7 +124,7 @@ QT_BEGIN_NAMESPACE
the drawItem() method will draw its item argument directly with
no effect applied.
- \sa QGrapicsEffect
+ \sa QGraphicsEffect
*/
static const char qglslDefaultImageFragmentShader[] = "\
@@ -313,6 +311,4 @@ void QGraphicsShaderEffect::setUniforms(QGLShaderProgram *program)
Q_UNUSED(program);
}
-#endif // QT_NO_GRAPHICSVIEW
-
QT_END_NAMESPACE
diff --git a/src/opengl/qgraphicsshadereffect.h b/src/opengl/qgraphicsshadereffect.h
index c4637d7..672973b 100644
--- a/src/opengl/qgraphicsshadereffect.h
+++ b/src/opengl/qgraphicsshadereffect.h
@@ -50,8 +50,6 @@ QT_BEGIN_NAMESPACE
QT_MODULE(OpenGL)
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
-
class QGLShaderProgram;
class QGLCustomShaderEffectStage;
class QGraphicsShaderEffectPrivate;
@@ -78,8 +76,6 @@ private:
friend class QGLCustomShaderEffectStage;
};
-#endif // QT_NO_GRAPHICSVIEW
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index 984ad1b..7fd1efe 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -278,7 +278,7 @@ qsreal ToInteger(qsreal n)
QScriptValue QScriptValuePrivate::property(const JSC::Identifier &id, int resolveMode) const
{
- Q_ASSERT(isJSC());
+ Q_ASSERT(isObject());
JSC::ExecState *exec = engine->currentFrame;
JSC::JSObject *object = jscValue.getObject();
JSC::PropertySlot slot(const_cast<JSC::JSObject*>(object));
@@ -301,7 +301,7 @@ QScriptValue QScriptValuePrivate::property(const JSC::Identifier &id, int resolv
QScriptValue QScriptValuePrivate::property(quint32 index, int resolveMode) const
{
- Q_ASSERT(isJSC());
+ Q_ASSERT(isObject());
JSC::ExecState *exec = engine->currentFrame;
JSC::JSObject *object = jscValue.getObject();
JSC::PropertySlot slot(const_cast<JSC::JSObject*>(object));
@@ -784,7 +784,7 @@ QScriptValue &QScriptValue::operator=(const QScriptValue &other)
bool QScriptValue::isError() const
{
Q_D(const QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return false;
return d->jscValue.isObject(&JSC::ErrorInstance::info);
}
@@ -798,7 +798,7 @@ bool QScriptValue::isError() const
bool QScriptValue::isArray() const
{
Q_D(const QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return false;
return d->jscValue.isObject(&JSC::JSArray::info);
}
@@ -812,7 +812,7 @@ bool QScriptValue::isArray() const
bool QScriptValue::isDate() const
{
Q_D(const QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return false;
return d->jscValue.isObject(&JSC::DateInstance::info);
}
@@ -826,7 +826,7 @@ bool QScriptValue::isDate() const
bool QScriptValue::isRegExp() const
{
Q_D(const QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return false;
return d->jscValue.isObject(&JSC::RegExpObject::info);
}
@@ -841,7 +841,7 @@ bool QScriptValue::isRegExp() const
QScriptValue QScriptValue::prototype() const
{
Q_D(const QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return QScriptValue();
return d->engine->scriptValueFromJSCValue(JSC::asObject(d->jscValue)->prototype());
}
@@ -860,7 +860,7 @@ QScriptValue QScriptValue::prototype() const
void QScriptValue::setPrototype(const QScriptValue &prototype)
{
Q_D(QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return;
if (prototype.isValid() && prototype.engine()
&& (prototype.engine() != engine())) {
@@ -890,7 +890,7 @@ void QScriptValue::setPrototype(const QScriptValue &prototype)
QScriptValue QScriptValue::scope() const
{
Q_D(const QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return QScriptValue();
// ### make hidden property
return d->property(QLatin1String("__qt_scope__"), QScriptValue::ResolveLocal);
@@ -902,7 +902,7 @@ QScriptValue QScriptValue::scope() const
void QScriptValue::setScope(const QScriptValue &scope)
{
Q_D(QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return;
if (scope.isValid() && scope.engine()
&& (scope.engine() != engine())) {
@@ -934,7 +934,7 @@ void QScriptValue::setScope(const QScriptValue &scope)
bool QScriptValue::instanceOf(const QScriptValue &other) const
{
Q_D(const QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject() || !other.isObject())
+ if (!d || !d->isObject() || !other.isObject())
return false;
if (other.engine() != engine()) {
qWarning("QScriptValue::instanceof: "
@@ -1693,7 +1693,7 @@ void QScriptValue::setProperty(const QString &name, const QScriptValue &value,
const PropertyFlags &flags)
{
Q_D(QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return;
JSC::ExecState *exec = d->engine->currentFrame;
d->setProperty(JSC::Identifier(exec, name), value, flags);
@@ -1718,7 +1718,7 @@ QScriptValue QScriptValue::property(const QString &name,
const ResolveFlags &mode) const
{
Q_D(const QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return QScriptValue();
return d->property(name, mode);
}
@@ -1740,7 +1740,7 @@ QScriptValue QScriptValue::property(quint32 arrayIndex,
const ResolveFlags &mode) const
{
Q_D(const QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return QScriptValue();
return d->property(arrayIndex, mode);
}
@@ -1761,7 +1761,7 @@ void QScriptValue::setProperty(quint32 arrayIndex, const QScriptValue &value,
const PropertyFlags &flags)
{
Q_D(const QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return;
if (value.engine() && (value.engine() != engine())) {
qWarning("QScriptValue::setProperty() failed: "
@@ -1811,7 +1811,7 @@ QScriptValue QScriptValue::property(const QScriptString &name,
const ResolveFlags &mode) const
{
Q_D(const QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject() || !name.isValid())
+ if (!d || !d->isObject() || !name.isValid())
return QScriptValue();
return d->property(name.d_ptr->identifier, mode);
}
@@ -1834,7 +1834,7 @@ void QScriptValue::setProperty(const QScriptString &name,
const PropertyFlags &flags)
{
Q_D(QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject() || !name.isValid())
+ if (!d || !d->isObject() || !name.isValid())
return;
d->setProperty(name.d_ptr->identifier, value, flags);
}
@@ -1849,7 +1849,7 @@ QScriptValue::PropertyFlags QScriptValue::propertyFlags(const QString &name,
const ResolveFlags &mode) const
{
Q_D(const QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return 0;
JSC::ExecState *exec = d->engine->currentFrame;
return d->propertyFlags(JSC::Identifier(exec, name), mode);
@@ -1868,7 +1868,7 @@ QScriptValue::PropertyFlags QScriptValue::propertyFlags(const QScriptString &nam
const ResolveFlags &mode) const
{
Q_D(const QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject() || !name.isValid())
+ if (!d || !d->isObject() || !name.isValid())
return 0;
return d->propertyFlags(name.d_ptr->identifier, mode);
}
@@ -2272,7 +2272,7 @@ bool QScriptValue::isUndefined() const
bool QScriptValue::isObject() const
{
Q_D(const QScriptValue);
- return d && d->isJSC() && d->jscValue.isObject();
+ return d && d->isObject();
}
/*!
@@ -2319,10 +2319,9 @@ bool QScriptValue::isQObject() const
bool QScriptValue::isQMetaObject() const
{
Q_D(const QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return false;
return JSC::asObject(d->jscValue)->isObject(&QScript::QMetaObjectWrapperObject::info);
- return false;
}
/*!
@@ -2346,7 +2345,7 @@ bool QScriptValue::isValid() const
QScriptValue QScriptValue::data() const
{
Q_D(const QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return QScriptValue();
if (d->jscValue.isObject(&QScriptObject::info)) {
QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(d->jscValue));
@@ -2368,7 +2367,7 @@ QScriptValue QScriptValue::data() const
void QScriptValue::setData(const QScriptValue &data)
{
Q_D(QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject())
+ if (!d || !d->isObject())
return;
JSC::JSValue other = d->engine->scriptValueToJSCValue(data);
if (d->jscValue.isObject(&QScriptObject::info)) {
diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h
index c440013..6d57d32 100644
--- a/src/script/api/qscriptvalue_p.h
+++ b/src/script/api/qscriptvalue_p.h
@@ -85,6 +85,7 @@ public:
inline void initFrom(const QString &value);
inline bool isJSC() const;
+ inline bool isObject() const;
QVariant &variantValue() const;
void setVariantValue(const QVariant &value);
@@ -144,6 +145,11 @@ inline bool QScriptValuePrivate::isJSC() const
return (type == JSC);
}
+inline bool QScriptValuePrivate::isObject() const
+{
+ return isJSC() && jscValue && jscValue.isObject();
+}
+
// Rest of inline functions implemented in qscriptengine_p.h
QT_END_NAMESPACE
diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/qbytearray/tst_qbytearray.cpp
index 4ec02bc..7951864 100644
--- a/tests/auto/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/qbytearray/tst_qbytearray.cpp
@@ -90,6 +90,8 @@ private slots:
void split();
void base64_data();
void base64();
+ void fromBase64_data();
+ void fromBase64();
void qvsnprintf();
void qstrlen();
void qstrnlen();
@@ -460,6 +462,10 @@ void tst_QByteArray::base64_data()
for (int i = 0; i < 256; ++i)
ba[i] = i;
QTest::newRow("f") << ba << QByteArray("AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==");
+
+ QTest::newRow("g") << QByteArray("foo\0bar", 7) << QByteArray("Zm9vAGJhcg==");
+ QTest::newRow("h") << QByteArray("f\xd1oo\x9cbar") << QByteArray("ZtFvb7py");
+ QTest::newRow("i") << QByteArray("\"\0\0\0\0\0\0\"", 8) << QByteArray("IgAAAAAAACI=");
}
@@ -475,6 +481,54 @@ void tst_QByteArray::base64()
QCOMPARE(arr64, base64);
}
+//different from the previous test as the input are invalid
+void tst_QByteArray::fromBase64_data()
+{
+ QTest::addColumn<QByteArray>("rawdata");
+ QTest::addColumn<QByteArray>("base64");
+
+ QTest::newRow("1") << QByteArray("") << QByteArray(" ");
+ QTest::newRow("2") << QByteArray("1") << QByteArray("MQ");
+ QTest::newRow("3") << QByteArray("12") << QByteArray("MTI ");
+ QTest::newRow("4") << QByteArray("123") << QByteArray("M=TIz");
+ QTest::newRow("5") << QByteArray("1234") << QByteArray("MTI zN A ");
+ QTest::newRow("6") << QByteArray("\n") << QByteArray("Cg");
+ QTest::newRow("7") << QByteArray("a\n") << QByteArray("======YQo=");
+ QTest::newRow("8") << QByteArray("ab\n") << QByteArray("Y\nWIK");
+ QTest::newRow("9") << QByteArray("abc\n") << QByteArray("YWJjCg==");
+ QTest::newRow("a") << QByteArray("abcd\n") << QByteArray("YWJ\1j\x9cZAo=");
+ QTest::newRow("b") << QByteArray("abcde\n") << QByteArray("YW JjZ\n G\tUK");
+ QTest::newRow("c") << QByteArray("abcdef\n") << QByteArray("YWJjZGVmCg=");
+ QTest::newRow("d") << QByteArray("abcdefg\n") << QByteArray("YWJ\rjZGVmZwo");
+ QTest::newRow("e") << QByteArray("abcdefgh\n") << QByteArray("YWJjZGVmZ2gK");
+
+ QByteArray ba;
+ ba.resize(256);
+ for (int i = 0; i < 256; ++i)
+ ba[i] = i;
+ QTest::newRow("f") << ba << QByteArray("AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Nj\n"
+ "c4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1u\n"
+ "b3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpa\n"
+ "anqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd\n"
+ "3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w== ");
+
+
+ QTest::newRow("g") << QByteArray("foo\0bar", 7) << QByteArray("Zm9vAGJhcg");
+ QTest::newRow("h") << QByteArray("f\xd1oo\x9cbar") << QByteArray("ZtFv\0b7py", 9);
+ QTest::newRow("i") << QByteArray("\"\0\0\0\0\0\0\"", 8) << QByteArray("IgAAAAAAACI");
+
+}
+
+
+void tst_QByteArray::fromBase64()
+{
+ QFETCH(QByteArray, rawdata);
+ QFETCH(QByteArray, base64);
+
+ QByteArray arr = QByteArray::fromBase64(base64);
+ QCOMPARE(arr, rawdata);
+}
+
void tst_QByteArray::qvsnprintf()
{
char buf[20];
diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp
index e118c65..9156e5e 100644
--- a/tests/auto/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp
@@ -106,6 +106,7 @@ private slots:
void isSeparator();
void setCursor();
void addToolbarAfterShow();
+ void centralWidgetSize();
};
// Testing get/set functions
@@ -1336,6 +1337,19 @@ public:
}
};
+class MyWidget : public QWidget
+{
+public:
+ MyWidget(QWidget *parent = 0) : QWidget(parent)
+ {
+ }
+
+ QSize sizeHint() const
+ {
+ return QSize(200, 200);
+ }
+};
+
void tst_QMainWindow::hideBeforeLayout()
{
QMainWindow win;
@@ -1650,6 +1664,18 @@ void tst_QMainWindow::addToolbarAfterShow()
QVERIFY(!toolBar.isHidden());
}
+void tst_QMainWindow::centralWidgetSize()
+{
+ QMainWindow mainWindow;
+ mainWindow.menuBar()->addMenu("menu");
+
+ MyWidget widget;
+ mainWindow.setCentralWidget(&widget);
+
+ mainWindow.show();
+ QTest::qWait(100);
+ QCOMPARE(widget.size(), widget.sizeHint());
+}
QTEST_MAIN(tst_QMainWindow)
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index a08f620..65dc742 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -120,6 +120,7 @@ private slots:
void uniqConnection();
void interfaceIid();
void deleteQObjectWhenDeletingEvent();
+ void overloads();
protected:
};
@@ -2903,11 +2904,11 @@ void tst_QObject::uniqConnection()
void tst_QObject::interfaceIid()
{
- QCOMPARE(QByteArray(qobject_interface_iid<Foo::Bleh *>()),
+ QCOMPARE(QByteArray(qobject_interface_iid<Foo::Bleh *>()),
QByteArray(Bleh_iid));
- QCOMPARE(QByteArray(qobject_interface_iid<Foo::Bar *>()),
+ QCOMPARE(QByteArray(qobject_interface_iid<Foo::Bar *>()),
QByteArray("com.qtest.foobar"));
- QCOMPARE(QByteArray(qobject_interface_iid<FooObject *>()),
+ QCOMPARE(QByteArray(qobject_interface_iid<FooObject *>()),
QByteArray());
}
@@ -2927,6 +2928,93 @@ void tst_QObject::deleteQObjectWhenDeletingEvent()
QCoreApplication::removePostedEvents(&o); // here you would get a deadlock
}
+class OverloadObject : public QObject
+{
+ friend class tst_QObject;
+ Q_OBJECT
+ signals:
+ void sig(int i, char c, qreal m = 12) const;
+ void sig(int i, int j = 12);
+ void sig(QObject *o, QObject *p, QObject *q = 0, QObject *r = 0) const;
+ void other(int a = 0);
+ void sig(QObject *o, OverloadObject *p = 0, QObject *q = 0, QObject *r = 0);
+ void sig(double r = 0.5);
+ public slots:
+ void slo(int i, int j = 43)
+ {
+ s_num += 1;
+ i1_num = i;
+ i2_num = j;
+ }
+ void slo(QObject *o, QObject *p = qApp, QObject *q = qApp, QObject *r = qApp)
+ {
+ s_num += 10;
+ o1_obj = o;
+ o2_obj = p;
+ o3_obj = q;
+ o4_obj = r;
+ }
+ void slo()
+ {
+ s_num += 100;
+ }
+
+ public:
+ int s_num;
+ int i1_num;
+ int i2_num;
+ QObject *o1_obj;
+ QObject *o2_obj;
+ QObject *o3_obj;
+ QObject *o4_obj;
+};
+
+void tst_QObject::overloads()
+{
+ OverloadObject obj1;
+ OverloadObject obj2;
+ QObject obj3;
+ obj1.s_num = 0;
+ obj2.s_num = 0;
+
+ connect (&obj1, SIGNAL(sig(int)) , &obj1, SLOT(slo(int)));
+ connect (&obj1, SIGNAL(sig(QObject *, QObject *, QObject *)) , &obj1, SLOT(slo(QObject * , QObject *, QObject *)));
+
+ connect (&obj1, SIGNAL(sig(QObject *, QObject *, QObject *, QObject *)) , &obj2, SLOT(slo(QObject * , QObject *, QObject *)));
+ connect (&obj1, SIGNAL(sig(QObject *)) , &obj2, SLOT(slo()));
+ connect (&obj1, SIGNAL(sig(int, int)) , &obj2, SLOT(slo(int, int)));
+
+ emit obj1.sig(0.5); //connected to nothing
+ emit obj1.sig(1, 'a'); //connected to nothing
+ QCOMPARE(obj1.s_num, 0);
+ QCOMPARE(obj2.s_num, 0);
+
+ emit obj1.sig(1); //this signal is connected
+ QCOMPARE(obj1.s_num, 1);
+ QCOMPARE(obj1.i1_num, 1);
+ QCOMPARE(obj1.i2_num, 43); //default argument of the slot
+
+ QCOMPARE(obj2.s_num, 1);
+ QCOMPARE(obj2.i1_num, 1);
+ QCOMPARE(obj2.i2_num, 12); //default argument of the signal
+
+
+ emit obj1.sig(&obj2); //this signal is conencted to obj2
+ QCOMPARE(obj1.s_num, 1);
+ QCOMPARE(obj2.s_num, 101);
+ emit obj1.sig(&obj2, &obj3); //this signal is connected
+ QCOMPARE(obj1.s_num, 11);
+ QCOMPARE(obj1.o1_obj, &obj2);
+ QCOMPARE(obj1.o2_obj, &obj3);
+ QCOMPARE(obj1.o3_obj, (QObject *)0); //default arg of the signal
+ QCOMPARE(obj1.o4_obj, qApp); //default arg of the slot
+
+ QCOMPARE(obj2.s_num, 111);
+ QCOMPARE(obj2.o1_obj, &obj2);
+ QCOMPARE(obj2.o2_obj, &obj3);
+ QCOMPARE(obj2.o3_obj, (QObject *)0); //default arg of the signal
+ QCOMPARE(obj2.o4_obj, qApp); //default arg of the slot
+}
QTEST_MAIN(tst_QObject)
#include "tst_qobject.moc"
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index e712017..b125965 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -3278,6 +3278,8 @@ void tst_QScriptValue::engineDeleted()
QVERIFY(v4.engine() == 0);
QVERIFY(v5.isValid());
QVERIFY(v5.engine() == 0);
+
+ QVERIFY(!v3.property("foo").isValid());
}
void tst_QScriptValue::valueOfWithClosure()
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index d28c3c3..44185e7 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -232,6 +232,7 @@ private slots:
void task250683_wrongSectionSize();
void task239271_addRowsWithFirstColumnHidden();
void task254234_proxySort();
+ void task248022_changeSelection();
};
class QtTestModel: public QAbstractItemModel
@@ -3435,5 +3436,33 @@ void tst_QTreeView::task254234_proxySort()
QCOMPARE(view.model()->data(view.model()->index(1,1)).toString(), QString::fromLatin1("g"));
}
+class TreeView : public QTreeView
+{
+ Q_OBJECT
+public slots:
+ void handleSelectionChanged()
+ {
+ //let's select the last item
+ QModelIndex idx = model()->index(0, 0);
+ selectionModel()->select(QItemSelection(idx, idx), QItemSelectionModel::Select);
+ disconnect(selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(handleSelectionChanged()));
+ }
+};
+
+void tst_QTreeView::task248022_changeSelection()
+{
+ //we check that changing the selection between the mouse press and the mouse release
+ //works correctly
+ TreeView view;
+ QStringList list = QStringList() << "1" << "2";
+ QStringListModel model(list);
+ view.setSelectionMode(QAbstractItemView::ExtendedSelection);
+ view.setModel(&model);
+ view.connect(view.selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SLOT(handleSelectionChanged()));
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.visualRect(model.index(1)).center());
+ QCOMPARE(view.selectionModel()->selectedIndexes().count(), list.count());
+}
+
+
QTEST_MAIN(tst_QTreeView)
#include "tst_qtreeview.moc"