summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2009-10-02 09:40:07 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2009-10-02 09:40:07 (GMT)
commitcfd31c28f2e30ee725d23c36ea8349f984b57047 (patch)
tree5fcf867475a6fde5b884c9236350460cee0ed95f /src/gui
parent46c17756dfa231d5ce7a8907330d97807880a04c (diff)
parentfe85e470d76f6e53759d0fd508e858add5de1eb0 (diff)
downloadQt-cfd31c28f2e30ee725d23c36ea8349f984b57047.zip
Qt-cfd31c28f2e30ee725d23c36ea8349f984b57047.tar.gz
Qt-cfd31c28f2e30ee725d23c36ea8349f984b57047.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qfiledialog.cpp2
-rw-r--r--src/gui/dialogs/qfontdialog.cpp2
-rw-r--r--src/gui/effects/qgraphicseffect.cpp269
-rw-r--r--src/gui/effects/qgraphicseffect.h51
-rw-r--r--src/gui/effects/qgraphicseffect_p.h12
-rw-r--r--src/gui/embedded/qscreenvfb_qws.cpp8
-rw-r--r--src/gui/embedded/qsoundqss_qws.cpp11
-rw-r--r--src/gui/embedded/qvfbhdr.h19
-rw-r--r--src/gui/embedded/qwscommand_qws_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout.cpp30
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout.h1
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp7
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.h7
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp245
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h11
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp245
-rw-r--r--src/gui/graphicsview/qgraphicsscene_p.h6
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp28
-rw-r--r--src/gui/gui.pro2
-rw-r--r--src/gui/image/qimage.h2
-rw-r--r--src/gui/image/qpixmap.h2
-rw-r--r--src/gui/image/qpixmap_raster_p.h2
-rw-r--r--src/gui/image/qpixmap_s60.cpp6
-rw-r--r--src/gui/image/qpixmap_x11_p.h2
-rw-r--r--src/gui/image/qpixmapcache.cpp66
-rw-r--r--src/gui/image/qpixmapcache_p.h6
-rw-r--r--src/gui/image/qpixmapdata_p.h1
-rw-r--r--src/gui/image/qpixmapfilter.cpp8
-rw-r--r--src/gui/image/qpixmapfilter_p.h9
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp20
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp9
-rw-r--r--src/gui/kernel/qapplication.cpp28
-rw-r--r--src/gui/kernel/qapplication_mac.mm31
-rw-r--r--src/gui/kernel/qapplication_p.h1
-rw-r--r--src/gui/kernel/qapplication_qws.cpp18
-rw-r--r--src/gui/kernel/qapplication_s60.cpp100
-rw-r--r--src/gui/kernel/qapplication_win.cpp80
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm20
-rw-r--r--src/gui/kernel/qdnd_x11.cpp4
-rw-r--r--src/gui/kernel/qevent.cpp2
-rw-r--r--src/gui/kernel/qevent.h2
-rw-r--r--src/gui/kernel/qguifunctions_wince.cpp13
-rw-r--r--src/gui/kernel/qkeymapper_win.cpp25
-rw-r--r--src/gui/kernel/qkeysequence.cpp4
-rw-r--r--src/gui/kernel/qsoftkeymanager.cpp3
-rw-r--r--src/gui/kernel/qt_s60_p.h7
-rw-r--r--src/gui/kernel/qwidget.cpp48
-rw-r--r--src/gui/kernel/qwidget.h3
-rw-r--r--src/gui/kernel/qwidget_p.h15
-rw-r--r--src/gui/kernel/qwidget_s60.cpp318
-rw-r--r--src/gui/kernel/qwidget_win.cpp2
-rw-r--r--src/gui/kernel/qwidget_wince.cpp28
-rw-r--r--src/gui/math3d/qmatrix4x4.h40
-rw-r--r--src/gui/math3d/qquaternion.h34
-rw-r--r--src/gui/math3d/qvector2d.h4
-rw-r--r--src/gui/math3d/qvector3d.h6
-rw-r--r--src/gui/math3d/qvector4d.h8
-rw-r--r--src/gui/s60framework/qs60mainapplication.h2
-rw-r--r--src/gui/s60framework/qs60mainappui.h2
-rw-r--r--src/gui/s60framework/qs60maindocument.h2
-rw-r--r--src/gui/styles/qs60style.cpp19
-rw-r--r--src/gui/styles/qs60style.h3
-rw-r--r--src/gui/styles/qs60style_s60.cpp18
-rw-r--r--src/gui/styles/qwindowsvistastyle.cpp22
-rw-r--r--src/gui/styles/qwindowsvistastyle_p.h1
-rw-r--r--src/gui/text/qfont.h1
-rw-r--r--src/gui/text/qfontengine_qpf.cpp4
-rw-r--r--src/gui/text/qfontengine_qws.cpp4
-rw-r--r--src/gui/widgets/qabstractslider.cpp39
-rw-r--r--src/gui/widgets/qabstractslider_p.h1
-rw-r--r--src/gui/widgets/qcombobox.cpp10
-rw-r--r--src/gui/widgets/qcommandlinkbutton.cpp27
-rw-r--r--src/gui/widgets/qtextedit.cpp5
-rw-r--r--src/gui/widgets/qvalidator.h4
75 files changed, 1472 insertions, 629 deletions
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 14f19f2..297c900 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -317,6 +317,7 @@ QFileDialog::QFileDialog(QWidget *parent, Qt::WindowFlags f)
{
Q_D(QFileDialog);
d->init();
+ d->lineEdit()->selectAll();
}
/*!
@@ -334,6 +335,7 @@ QFileDialog::QFileDialog(QWidget *parent,
{
Q_D(QFileDialog);
d->init(directory, filter, caption);
+ d->lineEdit()->selectAll();
}
/*!
diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp
index ca882c5..60fae27 100644
--- a/src/gui/dialogs/qfontdialog.cpp
+++ b/src/gui/dialogs/qfontdialog.cpp
@@ -602,6 +602,8 @@ void QFontDialogPrivate::updateStyles()
}
if (!found)
styleList->setCurrentItem(0);
+ } else {
+ styleList->setCurrentItem(0);
}
styleEdit->setText(styleList->currentText());
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index eee9bbf..e971fd8 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -67,6 +67,7 @@
\o QGraphicsOpacityEffect - renders the item with an opacity
\o QGraphicsPixelizeEffect - pixelizes the item with any pixel size
\o QGraphicsGrayscaleEffect - renders the item in shades of gray
+ \o QGraphicsBloomEffect - applies a blooming / glowing effect
\endlist
\img graphicseffect-effects.png
@@ -795,7 +796,7 @@ QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent)
: QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent)
{
Q_D(QGraphicsBlurEffect);
- d->filter->setBlurHint(QPixmapBlurFilter::PerformanceHint);
+ d->filter->setBlurHint(Qt::PerformanceHint);
}
/*!
@@ -839,48 +840,34 @@ void QGraphicsBlurEffect::setBlurRadius(int radius)
*/
/*!
- \enum QGraphicsBlurEffect::BlurHint
-
- \since 4.6
-
- This enum describes the hint of a blur graphics effect.
-
- \value PerformanceHint Using this value hints that performance is the
- most important factor, at the potential cost of lower quality.
-
- \value QualityHint Using this value hints that a higher quality blur is
- preferred over a fast blur.
-*/
-
-/*!
\property QGraphicsBlurEffect::blurHint
\brief the blur hint of the effect.
- Use the PerformanceHint blur hint to say that you want a faster blur,
- and the QualityHint blur hint to say that you prefer a higher quality blur.
+ Use the Qt::PerformanceHint hint to say that you want a faster blur,
+ and the Qt::QualityHint hint to say that you prefer a higher quality blur.
- When animating the blur radius it's recommended to use the PerformanceHint.
+ When animating the blur radius it's recommended to use Qt::PerformanceHint.
- By default, the blur hint is PerformanceHint.
+ By default, the blur hint is Qt::PerformanceHint.
*/
-QGraphicsBlurEffect::BlurHint QGraphicsBlurEffect::blurHint() const
+Qt::RenderHint QGraphicsBlurEffect::blurHint() const
{
Q_D(const QGraphicsBlurEffect);
- return BlurHint(d->filter->blurHint());
+ return d->filter->blurHint();
}
-void QGraphicsBlurEffect::setBlurHint(QGraphicsBlurEffect::BlurHint hint)
+void QGraphicsBlurEffect::setBlurHint(Qt::RenderHint hint)
{
Q_D(QGraphicsBlurEffect);
- if (BlurHint(d->filter->blurHint()) == hint)
+ if (d->filter->blurHint() == hint)
return;
- d->filter->setBlurHint(QPixmapBlurFilter::BlurHint(hint));
+ d->filter->setBlurHint(hint);
emit blurHintChanged(hint);
}
/*!
- \fn void QGraphicsBlurEffect::blurHintChanged(QGraphicsBlurEffect::BlurHint hint)
+ \fn void QGraphicsBlurEffect::blurHintChanged(Qt::RenderHint hint)
This signal is emitted whenever the effect's blur hint changes.
The \a hint parameter holds the effect's new blur hint.
@@ -1305,5 +1292,237 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour
painter->restore();
}
+/*!
+ \class QGraphicsBloomEffect
+ \brief The QGraphicsBloomEffect class provides a bloom/glow effect.
+ \since 4.6
+
+ A bloom/glow effect adds fringes of light around bright areas in the source.
+
+ \img graphicseffect-bloom.png
+
+ \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect,
+ QGraphicsGrayscaleEffect, QGraphicsColorizeEffect
+*/
+
+/*!
+ Constructs a new QGraphicsBloomEffect instance.
+ The \a parent parameter is passed to QGraphicsEffect's constructor.
+*/
+QGraphicsBloomEffect::QGraphicsBloomEffect(QObject *parent)
+ : QGraphicsEffect(*new QGraphicsBloomEffectPrivate, parent)
+{
+ Q_D(QGraphicsBloomEffect);
+ for (int i = 0; i < 256; ++i)
+ d->colorTable[i] = qMin(i + d->brightness, 255);
+}
+
+/*!
+ Destroys the effect.
+*/
+QGraphicsBloomEffect::~QGraphicsBloomEffect()
+{
+}
+
+/*!
+ \reimp
+*/
+QRectF QGraphicsBloomEffect::boundingRectFor(const QRectF &rect) const
+{
+ Q_D(const QGraphicsBloomEffect);
+ const qreal delta = d->blurFilter.radius() * 2;
+ return rect.adjusted(-delta, -delta, delta, delta);
+}
+
+/*!
+ \property QGraphicsBloomEffect::blurRadius
+ \brief the blur radius in pixels of the effect.
+
+ Using a smaller radius results in a sharper appearance, whereas a bigger
+ radius results in a more blurred appearance.
+
+ By default, the blur radius is 5 pixels.
+
+ \sa strength(), brightness()
+*/
+int QGraphicsBloomEffect::blurRadius() const
+{
+ Q_D(const QGraphicsBloomEffect);
+ return d->blurFilter.radius();
+}
+
+void QGraphicsBloomEffect::setBlurRadius(int radius)
+{
+ Q_D(QGraphicsBloomEffect);
+ if (d->blurFilter.radius() == radius)
+ return;
+
+ d->blurFilter.setRadius(radius);
+ updateBoundingRect();
+ emit blurRadiusChanged(radius);
+}
+
+/*!
+ \fn void QGraphicsBloomEffect::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.
+*/
+
+/*!
+ \property QGraphicsBloomEffect::blurHint
+ \brief the blur hint of the effect.
+
+ Use the Qt::PerformanceHint hint to say that you want a faster blur,
+ and the Qt::QualityHint hint to say that you prefer a higher quality blur.
+
+ When animating the blur radius it's recommended to use Qt::PerformanceHint.
+
+ By default, the blur hint is Qt::PerformanceHint.
+*/
+Qt::RenderHint QGraphicsBloomEffect::blurHint() const
+{
+ Q_D(const QGraphicsBloomEffect);
+ return d->blurFilter.blurHint();
+}
+
+void QGraphicsBloomEffect::setBlurHint(Qt::RenderHint hint)
+{
+ Q_D(QGraphicsBloomEffect);
+ if (d->blurFilter.blurHint() == hint)
+ return;
+
+ d->blurFilter.setBlurHint(hint);
+ emit blurHintChanged(hint);
+}
+
+/*!
+ \fn void QGraphicsBloomEffect::blurHintChanged(Qt::RenderHint hint)
+
+ This signal is emitted whenever the effect's blur hint changes.
+ The \a hint parameter holds the effect's new blur hint.
+*/
+
+/*!
+ \property QGraphicsBloomEffect::brightness
+ \brief the brightness of the glow.
+
+ The value should be in the range of 0 to 255, where 0 is dark
+ and 255 is bright.
+
+ By default, the brightness is 70.
+
+ \sa strength(), blurRadius()
+*/
+int QGraphicsBloomEffect::brightness() const
+{
+ Q_D(const QGraphicsBloomEffect);
+ return d->brightness;
+}
+
+void QGraphicsBloomEffect::setBrightness(int brightness)
+{
+ Q_D(QGraphicsBloomEffect);
+ brightness = qBound(0, brightness, 255);
+ if (d->brightness == brightness)
+ return;
+
+ d->brightness = brightness;
+ for (int i = 0; i < 256; ++i)
+ d->colorTable[i] = qMin(i + brightness, 255);
+
+ update();
+ emit brightnessChanged(brightness);
+}
+
+/*!
+ \fn void QGraphicsBloomEffect::brightnessChanged(int brightness)
+
+ This signal is emitted whenever the effect's brightness changes.
+ The \a brightness parameter holds the effect's new brightness.
+*/
+
+/*!
+ \property QGraphicsBloomEffect::strength
+ \brief the strength of the effect.
+
+ A strength 0.0 equals to no effect, while 1.0 means maximum glow.
+
+ By default, the strength is 0.7.
+*/
+qreal QGraphicsBloomEffect::strength() const
+{
+ Q_D(const QGraphicsBloomEffect);
+ return d->strength;
+}
+
+void QGraphicsBloomEffect::setStrength(qreal strength)
+{
+ Q_D(QGraphicsBloomEffect);
+ strength = qBound(qreal(0.0), strength, qreal(1.0));
+ if (qFuzzyCompare(d->strength, strength))
+ return;
+
+ d->strength = strength;
+ update();
+ emit strengthChanged(strength);
+}
+
+/*!
+ \fn void QGraphicsBloomEffect::strengthChanged(qreal strength)
+
+ This signal is emitted whenever the effect's strength changes.
+ The \a strength parameter holds the effect's new strength.
+*/
+
+/*!
+ \reimp
+*/
+void QGraphicsBloomEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
+{
+ Q_D(QGraphicsBloomEffect);
+ if (d->strength < 0.001) {
+ source->draw(painter);
+ return;
+ }
+
+ const Qt::CoordinateSystem system = source->isPixmap()
+ ? Qt::LogicalCoordinates : Qt::DeviceCoordinates;
+ QPoint offset;
+ QPixmap pixmap = source->pixmap(system, &offset);
+ QImage result = pixmap.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied);
+
+ // Blur.
+ QPainter blurPainter(&pixmap);
+ d->blurFilter.draw(&blurPainter, QPointF(), pixmap);
+ blurPainter.end();
+
+ // Brighten.
+ QImage overlay = pixmap.toImage().convertToFormat(QImage::Format_ARGB32);
+ const int numBits = overlay.width() * overlay.height();
+ QRgb *bits = reinterpret_cast<QRgb *>(overlay.bits());
+ for (int i = 0; i < numBits; ++i) {
+ const QRgb bit = bits[i];
+ bits[i] = qRgba(d->colorTable[qRed(bit)], d->colorTable[qGreen(bit)],
+ d->colorTable[qBlue(bit)], qAlpha(bit));
+ }
+
+ // Composite.
+ QPainter compPainter(&result);
+ compPainter.setCompositionMode(QPainter::CompositionMode_Overlay);
+ compPainter.setOpacity(d->strength);
+ compPainter.drawImage(0, 0, overlay);
+ compPainter.end();
+
+ if (system == Qt::DeviceCoordinates) {
+ QTransform restoreTransform = painter->worldTransform();
+ painter->setWorldTransform(QTransform());
+ painter->drawImage(offset, result);
+ painter->setWorldTransform(restoreTransform);
+ } else {
+ painter->drawImage(offset, result);
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h
index c256381..c5d3ede 100644
--- a/src/gui/effects/qgraphicseffect.h
+++ b/src/gui/effects/qgraphicseffect.h
@@ -224,27 +224,22 @@ class Q_GUI_EXPORT QGraphicsBlurEffect: public QGraphicsEffect
{
Q_OBJECT
Q_PROPERTY(int blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged)
- Q_PROPERTY(BlurHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged)
+ Q_PROPERTY(Qt::RenderHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged)
public:
- enum BlurHint {
- PerformanceHint,
- QualityHint
- };
-
QGraphicsBlurEffect(QObject *parent = 0);
~QGraphicsBlurEffect();
QRectF boundingRectFor(const QRectF &rect) const;
int blurRadius() const;
- BlurHint blurHint() const;
+ Qt::RenderHint blurHint() const;
public Q_SLOTS:
void setBlurRadius(int blurRadius);
- void setBlurHint(BlurHint blurHint);
+ void setBlurHint(Qt::RenderHint hint);
Q_SIGNALS:
void blurRadiusChanged(int blurRadius);
- void blurHintChanged(BlurHint blurHint);
+ void blurHintChanged(Qt::RenderHint hint);
protected:
void draw(QPainter *painter, QGraphicsEffectSource *source);
@@ -339,6 +334,44 @@ private:
Q_DISABLE_COPY(QGraphicsOpacityEffect)
};
+class QGraphicsBloomEffectPrivate;
+class Q_GUI_EXPORT QGraphicsBloomEffect: public QGraphicsEffect
+{
+ Q_OBJECT
+ Q_PROPERTY(int blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged)
+ Q_PROPERTY(Qt::RenderHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged)
+ Q_PROPERTY(int brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged)
+ Q_PROPERTY(qreal strength READ strength WRITE setStrength NOTIFY strengthChanged)
+public:
+ QGraphicsBloomEffect(QObject *parent = 0);
+ ~QGraphicsBloomEffect();
+
+ QRectF boundingRectFor(const QRectF &rect) const;
+ int blurRadius() const;
+ Qt::RenderHint blurHint() const;
+ int brightness() const;
+ qreal strength() const;
+
+public Q_SLOTS:
+ void setBlurRadius(int blurRadius);
+ void setBlurHint(Qt::RenderHint hint);
+ void setBrightness(int brightness);
+ void setStrength(qreal strength);
+
+Q_SIGNALS:
+ void blurRadiusChanged(int blurRadius);
+ void blurHintChanged(Qt::RenderHint hint);
+ void brightnessChanged(int brightness);
+ void strengthChanged(qreal strength);
+
+protected:
+ void draw(QPainter *painter, QGraphicsEffectSource *source);
+
+private:
+ Q_DECLARE_PRIVATE(QGraphicsBloomEffect)
+ Q_DISABLE_COPY(QGraphicsBloomEffect)
+};
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h
index e109790..ff2fb85 100644
--- a/src/gui/effects/qgraphicseffect_p.h
+++ b/src/gui/effects/qgraphicseffect_p.h
@@ -185,6 +185,18 @@ public:
uint hasOpacityMask : 1;
};
+class QGraphicsBloomEffectPrivate : public QGraphicsEffectPrivate
+{
+ Q_DECLARE_PUBLIC(QGraphicsBlurEffect)
+public:
+ QGraphicsBloomEffectPrivate() : brightness(70), strength(qreal(0.7)) {}
+
+ QPixmapBlurFilter blurFilter;
+ int colorTable[256];
+ int brightness;
+ qreal strength;
+};
+
QT_END_NAMESPACE
#endif // QGRAPHICSEFFECT_P_H
diff --git a/src/gui/embedded/qscreenvfb_qws.cpp b/src/gui/embedded/qscreenvfb_qws.cpp
index 19d4fa8..d71336d 100644
--- a/src/gui/embedded/qscreenvfb_qws.cpp
+++ b/src/gui/embedded/qscreenvfb_qws.cpp
@@ -196,7 +196,7 @@ bool QVFbScreen::connect(const QString &displaySpec)
if (displayArgs.contains(QLatin1String("Gray")))
grayscale = true;
- key_t key = ftok(QByteArray(QT_VFB_MOUSE_PIPE).replace("%1", QByteArray::number(displayId)), 'b');
+ key_t key = ftok(QT_VFB_MOUSE_PIPE(displayId).toLocal8Bit(), 'b');
if (key == -1)
return false;
@@ -330,8 +330,7 @@ void QVFbScreen::disconnect()
bool QVFbScreen::initDevice()
{
#ifndef QT_NO_QWS_MOUSE_QVFB
- const QString mouseDev = QString::fromLatin1(QT_VFB_MOUSE_PIPE)
- .arg(displayId);
+ const QString mouseDev = QT_VFB_MOUSE_PIPE(displayId);
d_ptr->mouse = new QVFbMouseHandler(QLatin1String("QVFbMouse"), mouseDev);
qwsServer->setDefaultMouse("None");
if (d_ptr->mouse)
@@ -339,8 +338,7 @@ bool QVFbScreen::initDevice()
#endif
#if !defined(QT_NO_QWS_KBD_QVFB) && !defined(QT_NO_QWS_KEYBOARD)
- const QString keyboardDev = QString::fromLatin1(QT_VFB_KEYBOARD_PIPE)
- .arg(displayId);
+ const QString keyboardDev = QT_VFB_KEYBOARD_PIPE(displayId);
d_ptr->keyboard = new QVFbKeyboardHandler(keyboardDev);
qwsServer->setDefaultKeyboard("None");
#endif
diff --git a/src/gui/embedded/qsoundqss_qws.cpp b/src/gui/embedded/qsoundqss_qws.cpp
index 6bac8dc..b859be5 100644
--- a/src/gui/embedded/qsoundqss_qws.cpp
+++ b/src/gui/embedded/qsoundqss_qws.cpp
@@ -67,6 +67,8 @@
#include <qdebug.h>
+#include <qvfbhdr.h>
+
extern int errno;
QT_BEGIN_NAMESPACE
@@ -79,7 +81,6 @@ QT_BEGIN_NAMESPACE
static int sound_speed = 44100;
#ifndef QT_NO_QWS_SOUNDSERVER
extern int qws_display_id;
-#define SOUND_PIPE "/tmp/.qt_soundserver-%1"
#endif
static char *zeroMem = 0;
@@ -708,7 +709,7 @@ protected:
#ifndef QT_NO_QWS_SOUNDSERVER
QWSSoundServerSocket::QWSSoundServerSocket(QObject *parent) :
- QWSServerSocket(QString::fromLatin1(SOUND_PIPE).arg(qws_display_id), parent)
+ QWSServerSocket(QT_VFB_SOUND_PIPE(qws_display_id), parent)
{
connect(this, SIGNAL(newConnection()), this, SLOT(newConnection()));
}
@@ -716,7 +717,7 @@ QWSSoundServerSocket::QWSSoundServerSocket(QObject *parent) :
#ifdef QT3_SUPPORT
QWSSoundServerSocket::QWSSoundServerSocket(QObject *parent, const char *name) :
- QWSServerSocket(QString::fromLatin1(SOUND_PIPE).arg(qws_display_id), parent)
+ QWSServerSocket(QT_VFB_SOUND_PIPE(qws_display_id), parent)
{
if (name)
setObjectName(QString::fromAscii(name));
@@ -1395,7 +1396,7 @@ void QWSSoundServer::translateSoundCompleted( int, int sid )
QWSSoundClient::QWSSoundClient(QObject* parent) :
QWSSocket(parent)
{
- connectToLocalFile(QString::fromLatin1(SOUND_PIPE).arg(qws_display_id));
+ connectToLocalFile(QT_VFB_SOUND_PIPE(qws_display_id));
QObject::connect(this,SIGNAL(readyRead()),
this,SLOT(tryReadCommand()));
if( state() == QWS_SOCK_BASE::ConnectedState ) QTimer::singleShot(1, this, SIGNAL(connected()));
@@ -1409,7 +1410,7 @@ QWSSoundClient::~QWSSoundClient( )
void QWSSoundClient::reconnect()
{
- connectToLocalFile(QString::fromLatin1(SOUND_PIPE).arg(qws_display_id));
+ connectToLocalFile(QT_VFB_SOUND_PIPE(qws_display_id));
if( state() == QWS_SOCK_BASE::ConnectedState ) emit connected();
else emit error( QTcpSocket::ConnectionRefusedError );
}
diff --git a/src/gui/embedded/qvfbhdr.h b/src/gui/embedded/qvfbhdr.h
index 73e08e0..f02286e 100644
--- a/src/gui/embedded/qvfbhdr.h
+++ b/src/gui/embedded/qvfbhdr.h
@@ -52,9 +52,22 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-#define QT_VFB_MOUSE_PIPE "/tmp/.qtvfb_mouse-%1"
-#define QT_VFB_KEYBOARD_PIPE "/tmp/.qtvfb_keyboard-%1"
-#define QT_VFB_MAP "/tmp/.qtvfb_map-%1"
+#ifndef QT_QWS_TEMP_DIR
+#define QT_QWS_TEMP_DIR "/tmp"
+#endif
+
+#define QT_VFB_DATADIR(DISPLAY) QString("%1/qtembedded-%2-%3") \
+ .arg(QT_QWS_TEMP_DIR).arg(getuid()).arg(DISPLAY)
+
+#define QT_VFB_MOUSE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
+ .append("/qtvfb_mouse")
+#define QT_VFB_KEYBOARD_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
+ .append("/qtvfb_keyboard")
+#define QT_VFB_MAP(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
+ .append("/qtvfb_map")
+#define QT_VFB_SOUND_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
+ .append("/qt_soundserver")
+#define QTE_PIPE "QtEmbedded"
struct QVFbHeader
{
diff --git a/src/gui/embedded/qwscommand_qws_p.h b/src/gui/embedded/qwscommand_qws_p.h
index d92c6af..f986a9d 100644
--- a/src/gui/embedded/qwscommand_qws_p.h
+++ b/src/gui/embedded/qwscommand_qws_p.h
@@ -75,8 +75,6 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-#define QTE_PIPE "QtEmbedded-%1"
-
class QRect;
/*********************************************************************
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
index b3ebb2b..fdb1708 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
@@ -80,6 +80,24 @@
PM_LayoutHorizontalSpacing (or PM_LayoutVerticalSpacing for vertical anchors).
*/
+/*!
+ \class QGraphicsAnchor
+ \brief The QGraphicsAnchor class represents an anchor between two items in a
+ QGraphicsAnchorLayout.
+ \since 4.6
+ \ingroup appearance
+ \ingroup geomanagement
+ \ingroup graphicsview-api
+
+ The graphics anchor provides an API that enables you to query and manipulate the
+ properties an anchor has. When an anchor is added to the layout with
+ QGraphicsAnchorLayout::addAnchor(), a QGraphicsAnchor instance is returned where the properties
+ are initialized to their default values. The properties can then be further changed, and they
+ will be picked up the next time the layout is activated.
+
+ \sa QGraphicsAnchorLayout::anchor()
+
+*/
#include "qgraphicsanchorlayout_p.h"
QT_BEGIN_NAMESPACE
@@ -288,18 +306,6 @@ void QGraphicsAnchorLayout::addAnchors(QGraphicsLayoutItem *firstItem,
}
/*!
- Returns true if there are no arrangement that satisfies all constraints.
- Otherwise returns false.
-
- \sa addAnchor()
-*/
-bool QGraphicsAnchorLayout::hasConflicts() const
-{
- Q_D(const QGraphicsAnchorLayout);
- return d->hasConflicts();
-}
-
-/*!
Sets the default horizontal spacing for the anchor layout to \a spacing.
\sa horizontalSpacing(), setVerticalSpacing(), setSpacing()
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.h b/src/gui/graphicsview/qgraphicsanchorlayout.h
index 44074d1..d9a87ba 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout.h
+++ b/src/gui/graphicsview/qgraphicsanchorlayout.h
@@ -93,7 +93,6 @@ public:
QGraphicsLayoutItem *secondItem,
Qt::Orientations orientations = Qt::Horizontal | Qt::Vertical);
- bool hasConflicts() const;
void setHorizontalSpacing(qreal spacing);
void setVerticalSpacing(qreal spacing);
void setSpacing(qreal spacing);
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index 49aabf5..f75118b 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -2287,6 +2287,13 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(QList<QSimplexConstraint *> co
return feasible;
}
+/*!
+ \internal
+ Returns true if there are no arrangement that satisfies all constraints.
+ Otherwise returns false.
+
+ \sa addAnchor()
+*/
bool QGraphicsAnchorLayoutPrivate::hasConflicts() const
{
QGraphicsAnchorLayoutPrivate *that = const_cast<QGraphicsAnchorLayoutPrivate*>(this);
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
index 4e1bcd4..c86bfa3 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
@@ -343,7 +343,7 @@ public:
QGraphicsAnchorLayout private methods and attributes.
*/
-class QGraphicsAnchorLayoutPrivate : public QGraphicsLayoutPrivate
+class Q_AUTOTEST_EXPORT QGraphicsAnchorLayoutPrivate : public QGraphicsLayoutPrivate
{
Q_DECLARE_PUBLIC(QGraphicsAnchorLayout)
@@ -370,6 +370,11 @@ public:
QGraphicsAnchorLayoutPrivate();
+ static QGraphicsAnchorLayoutPrivate *get(QGraphicsAnchorLayout *q)
+ {
+ return q ? q->d_func() : 0;
+ }
+
static Qt::AnchorPoint oppositeEdge(
Qt::AnchorPoint edge);
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index c3934c7..0690690 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -186,6 +186,49 @@
high z-values. Stacking order applies to sibling items; parents are always
drawn before their children.
+ \section1 Sorting
+
+ All items are drawn in a defined, stable order, and this same order decides
+ which items will receive mouse input first when you click on the scene.
+ Normally you don't have to worry about sorting, as the items follow a
+ "natural order", following the logical structure of the scene.
+
+ An item's children are stacked on top of the parent, and sibling items are
+ stacked by insertion order (i.e., in the same order that they were either
+ added to the scene, or added to the same parent). If you add item A, and
+ then B, then B will be on top of A. If you then add C, the items' stacking
+ order will be A, then B, then C.
+
+ \image graphicsview-zorder.png
+
+ This example shows the stacking order of all limbs of the robot from the
+ \l{graphicsview/dragdroprobot}{Drag and Drop Robot} example. The torso is
+ the root item (all other items are children or descendants of the torso),
+ so it is drawn first. Next, the head is drawn, as it is the first item in
+ the torso's list of children. Then the upper left arm is drawn. As the
+ lower arm is a child of the upper arm, the lower arm is then drawn,
+ followed by the upper arm's next sibling, which is the upper right arm, and
+ so on.
+
+ For advanced users, there are ways to alter how your items are sorted:
+
+ \list
+ \o You can call setZValue() on an item to explicitly stack it on top of, or
+ under, other sibling items. The default Z value for an item is 0. Items
+ with the same Z value are stacked by insertion order.
+
+ \o You can call stackBefore() to reorder the list of children. This will
+ directly modify the insertion order.
+
+ \o You can set the ItemStacksBehindParent flag to stack a child item behind
+ its parent.
+ \endlist
+
+ The stacking order of two sibling items also counts for each item's
+ children and descendant items. So if one item is on top of another, then
+ all its children will also be on top of all the other item's children as
+ well.
+
\section1 Events
QGraphicsItem receives events from QGraphicsScene through the virtual
@@ -564,6 +607,21 @@
supportsExtension() and setExtension().
*/
+/*!
+ \enum QGraphicsItem::PanelModality
+
+ This enum specifies the behavior of a modal panel. A modal panel
+ is one that blocks input to other panels. Note that items that
+ are children of a modal panel are not blocked.
+
+ The values are:
+ \value NonModal The panel is not modal and does not block input to other panels.
+ \value PanelModal The panel is modal to a single item hierarchy and blocks input to its parent pane, all grandparent panels, and all siblings of its parent and grandparent panels.
+ \value SceneModal The window is modal to the entire scene and blocks input to all panels.
+
+ \sa QGraphicsItem::setPanelModality(), QGraphicsItem::panelModality(), QGraphicsItem::ItemIsPanel
+*/
+
#include "qgraphicsitem.h"
#ifndef QT_NO_GRAPHICSVIEW
@@ -1472,10 +1530,12 @@ QList<QGraphicsItem *> QGraphicsItem::children() const
/*!
\since 4.4
- Returns a list of this item's children. The items are returned in no
- particular order.
+ Returns a list of this item's children.
- \sa setParentItem()
+ The items are sorted by stacking order. This takes into account both the
+ items' insertion order and their Z-values.
+
+ \sa setParentItem(), zValue(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsItem::childItems() const
{
@@ -1649,6 +1709,16 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags)
setFlag(ItemStacksBehindParent, d_ptr->z < qreal(0.0));
}
+ if ((d_ptr->panelModality != NonModal)
+ && d_ptr->scene
+ && (flags & ItemIsPanel) != (oldFlags & ItemIsPanel)) {
+ // update the panel's modal state
+ if (flags & ItemIsPanel)
+ d_ptr->scene->d_func()->enterModal(this);
+ else
+ d_ptr->scene->d_func()->leaveModal(this);
+ }
+
if (d_ptr->scene) {
d_ptr->scene->d_func()->markDirty(this, QRectF(),
/*invalidateChildren=*/true,
@@ -1725,6 +1795,87 @@ void QGraphicsItem::setCacheMode(CacheMode mode, const QSize &logicalCacheSize)
update();
}
+/*!
+ \since 4.6
+
+ Returns the modality for this item.
+*/
+QGraphicsItem::PanelModality QGraphicsItem::panelModality() const
+{
+ return d_ptr->panelModality;
+}
+
+/*!
+ \since 4.6
+
+ Sets the modality for this item to \a panelModality.
+
+ Changing the modality of a visible item takes effect immediately.
+*/
+void QGraphicsItem::setPanelModality(PanelModality panelModality)
+{
+ if (d_ptr->panelModality == panelModality)
+ return;
+
+ PanelModality previousModality = d_ptr->panelModality;
+ bool enterLeaveModal = (isPanel() && d_ptr->scene && isVisible());
+ if (enterLeaveModal && panelModality == NonModal)
+ d_ptr->scene->d_func()->leaveModal(this);
+ d_ptr->panelModality = panelModality;
+ if (enterLeaveModal && d_ptr->panelModality != NonModal)
+ d_ptr->scene->d_func()->enterModal(this, previousModality);
+}
+
+/*!
+ \since 4.6
+
+ Returns true if this item is blocked by a modal panel, false otherwise. If \a blockingPanel is
+ non-zero, \a blockingPanel will be set to the modal panel that is blocking this item. If this
+ item is not blocked, \a blockingPanel will not be set by this function.
+
+ This function always returns false for items not in a scene.
+
+ \sa panelModality() setPanelModality() PanelModality
+*/
+bool QGraphicsItem::isBlockedByModalPanel(QGraphicsItem **blockingPanel) const
+{
+ if (!d_ptr->scene)
+ return false;
+
+
+ QGraphicsItem *dummy = 0;
+ if (!blockingPanel)
+ blockingPanel = &dummy;
+
+ QGraphicsScenePrivate *scene_d = d_ptr->scene->d_func();
+ if (scene_d->modalPanels.isEmpty())
+ return false;
+
+ // ###
+ if (!scene_d->popupWidgets.isEmpty() && scene_d->popupWidgets.first() == this)
+ return false;
+
+ for (int i = 0; i < scene_d->modalPanels.count(); ++i) {
+ QGraphicsItem *modalPanel = scene_d->modalPanels.at(i);
+ if (modalPanel->panelModality() == QGraphicsItem::SceneModal) {
+ // Scene modal panels block all non-descendents.
+ if (modalPanel != this && !modalPanel->isAncestorOf(this)) {
+ *blockingPanel = modalPanel;
+ return true;
+ }
+ } else {
+ // Window modal panels block ancestors and siblings/cousins.
+ if (modalPanel != this
+ && !modalPanel->isAncestorOf(this)
+ && commonAncestorItem(modalPanel)) {
+ *blockingPanel = modalPanel;
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
#ifndef QT_NO_TOOLTIP
/*!
Returns the item's tool tip, or an empty QString if no tool tip has been
@@ -1934,6 +2085,8 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo
q->ungrabMouse();
if (scene->d_func()->keyboardGrabberItems.contains(q))
q->ungrabKeyboard();
+ if (q->isPanel() && panelModality != QGraphicsItem::NonModal)
+ scene->d_func()->leaveModal(q_ptr);
}
if (q_ptr->hasFocus() && scene) {
// Hiding the closest non-panel ancestor of the focus item
@@ -1955,10 +2108,15 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo
} else {
geometryChanged = 1;
paintedViewBoundingRectsNeedRepaint = 1;
- if (isWidget && scene) {
- QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(q_ptr);
- if (widget->windowType() == Qt::Popup)
- scene->d_func()->addPopup(widget);
+ if (scene) {
+ if (isWidget) {
+ QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(q_ptr);
+ if (widget->windowType() == Qt::Popup)
+ scene->d_func()->addPopup(widget);
+ }
+ if (q->isPanel() && panelModality != QGraphicsItem::NonModal) {
+ scene->d_func()->enterModal(q_ptr);
+ }
}
}
@@ -2781,7 +2939,7 @@ bool QGraphicsItem::hasFocus() const
the preferred focus item for its subtree of items, should it later become
visible.
- As a result of calling this function, this item will receive a
+ As a result of calling this function, this item will receive a
\l{focusInEvent()}{focus in event} with \a focusReason. If another item
already has focus, that item will first receive a \l{focusOutEvent()}
{focus out event} indicating that it has lost input focus.
@@ -3299,7 +3457,7 @@ QMatrix QGraphicsItem::matrix() const
The transformation matrix is combined with the item's rotation(), scale()
and transformations() into a combined transformations for the item.
-
+
The default transformation matrix is an identity matrix.
\sa setTransform(), sceneTransform()
@@ -3780,7 +3938,7 @@ void QGraphicsItem::setMatrix(const QMatrix &matrix, bool combine)
// Update and set the new transformation.
d_ptr->setTransformHelper(newTransform);
-
+
// Send post-notification.
itemChange(ItemTransformHasChanged, qVariantFromValue<QTransform>(newTransform));
}
@@ -3914,7 +4072,7 @@ void QGraphicsItem::scale(qreal sx, qreal sy)
/*!
\obsolete
- Use
+ Use
\code
setTransform(QTransform().shear(sh, sv), true);
@@ -3936,7 +4094,7 @@ void QGraphicsItem::shear(qreal sh, qreal sv)
Use setPos() or setTransformOriginPoint() instead. For identical
behavior, use
-
+
\code
setTransform(QTransform::fromTranslate(dx, dy), true);
\endcode
@@ -3977,12 +4135,12 @@ void QGraphicsItem::advance(int phase)
}
/*!
- Returns the Z-value, or the elevation, of the item. The Z-value decides
- the stacking order of sibling (neighboring) items.
+ Returns the Z-value of the item. The Z-value affects the stacking order of
+ sibling (neighboring) items.
The default Z-value is 0.
- \sa setZValue()
+ \sa setZValue(), {QGraphicsItem#Sorting}{Sorting}, stackBefore(), ItemStacksBehindParent
*/
qreal QGraphicsItem::zValue() const
{
@@ -3990,33 +4148,18 @@ qreal QGraphicsItem::zValue() const
}
/*!
- Sets the Z-value, or the elevation, of the item, to \a z. The elevation
- decides the stacking order of sibling (neighboring) items. An item of high
- Z-value will be drawn on top of an item with a lower Z-value if they share
- the same parent item. In addition, children of an item will always be
- drawn on top of the parent, regardless of the child's Z-value. Sibling
- items that share the same Z-value will be drawn in order of insertion; the
- last inserted child is stacked above previous children.
-
- \img graphicsview-zorder.png
+ Sets the Z-value of the item to \a z. The Z value decides the stacking
+ order of sibling (neighboring) items. A sibling item of high Z value will
+ always be drawn on top of another sibling item with a lower Z value.
- Children of different parents are stacked according to the Z-value of
- each item's ancestor item which is an immediate child of the two
- items' closest common ancestor. For example, a robot item might
- define a torso item as the parent of a head item, two arm items,
- and two upper-leg items. The upper-leg items would each be parents
- of one lower-leg item, and each lower-leg item would be parents of
- one foot item. The stacking order of the feet is the same as the
- stacking order of each foot's ancestor that is an immediate child
- of the two feet's common ancestor (i.e., the torso item); so the
- feet are stacked in the same order as the upper-leg items,
- regardless of each foot's Z-value.
+ If you restore the Z value, the item's insertion order will decide its
+ stacking order.
The Z-value does not affect the item's size in any way.
The default Z-value is 0.
- \sa zValue()
+ \sa zValue(), {QGraphicsItem#Sorting}{Sorting}, stackBefore(), ItemStacksBehindParent
*/
void QGraphicsItem::setZValue(qreal z)
{
@@ -4079,12 +4222,13 @@ void QGraphicsItemPrivate::ensureSequentialSiblingIndex()
The \a sibling must have the same Z value as this item, otherwise calling
this function will have no effect.
- By default, all items are stacked by insertion order (i.e., the first item
- you add is drawn before the next item you add). If two items' Z values are
- different, then the item with the highest Z value is drawn on top. When the
- Z values are the same, the insertion order will decide the stacking order.
+ By default, all sibling items are stacked by insertion order (i.e., the
+ first item you add is drawn before the next item you add). If two items' Z
+ values are different, then the item with the highest Z value is drawn on
+ top. When the Z values are the same, the insertion order will decide the
+ stacking order.
- \sa setZValue(), ItemStacksBehindParent
+ \sa setZValue(), ItemStacksBehindParent, {QGraphicsItem#Sorting}{Sorting}
*/
void QGraphicsItem::stackBefore(const QGraphicsItem *sibling)
{
@@ -4446,7 +4590,7 @@ bool QGraphicsItem::collidesWithItem(const QGraphicsItem *other, Qt::ItemSelecti
Note that this function checks whether the item's shape or
bounding rectangle (depending on \a mode) is contained within \a
path, and not whether \a path is contained within the items shape
- or bounding rectangle.
+ or bounding rectangle.
\sa collidesWithItem(), contains(), shape()
*/
@@ -5140,14 +5284,8 @@ void QGraphicsItem::update(const QRectF &rect)
} while ((item = item->d_ptr->parent));
if (CacheMode(d_ptr->cacheMode) != NoCache) {
- QGraphicsItemCache *cache = d_ptr->extraItemCache();
- if (d_ptr->discardUpdateRequest(/* ignoreVisibleBit = */ false,
- /* ignoreClipping = */ false,
- /* ignoreDirtyBit = */ true)) {
- return;
- }
-
// Invalidate cache.
+ QGraphicsItemCache *cache = d_ptr->extraItemCache();
if (!cache->allExposed) {
if (rect.isNull()) {
cache->allExposed = true;
@@ -5161,6 +5299,9 @@ void QGraphicsItem::update(const QRectF &rect)
return;
}
+ if (d_ptr->discardUpdateRequest())
+ return;
+
if (d_ptr->scene)
d_ptr->scene->d_func()->markDirty(this, rect);
}
@@ -6598,7 +6739,7 @@ void QGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (d_ptr->isWidget) {
// Qt::Popup closes when you click outside.
QGraphicsWidget *w = static_cast<QGraphicsWidget *>(this);
- if (w->windowFlags() & Qt::Popup) {
+ if ((w->windowFlags() & Qt::Popup) == Qt::Popup) {
event->accept();
if (!w->rect().contains(event->pos()))
w->close();
@@ -7023,7 +7164,7 @@ void QGraphicsItem::prepareGeometryChange()
// if someone is connected to the changed signal or the scene has no views.
// Note that this has to be done *after* markDirty to ensure that
// _q_processDirtyItems is called before _q_emitUpdated.
- if (scenePrivate->isSignalConnected(scenePrivate->changedSignalIndex)
+ if (scenePrivate->isSignalConnected(scenePrivate->changedSignalIndex)
|| scenePrivate->views.isEmpty()) {
if (d_ptr->hasTranslateOnlySceneTransform()) {
d_ptr->scene->update(boundingRect().translated(d_ptr->sceneTransform.dx(),
@@ -10527,7 +10668,7 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
effectRect.setRight(deviceWidth - 1);
if (bottom + 1 > deviceHeight)
effectRect.setBottom(deviceHeight -1);
-
+
}
if (effectRect.isEmpty())
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index 99d2e12..e6e324a 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -146,6 +146,13 @@ public:
DeviceCoordinateCache
};
+ enum PanelModality
+ {
+ NonModal,
+ PanelModal,
+ SceneModal
+ };
+
QGraphicsItem(QGraphicsItem *parent = 0
#ifndef Q_QDOC
// ### obsolete argument
@@ -183,6 +190,10 @@ public:
CacheMode cacheMode() const;
void setCacheMode(CacheMode mode, const QSize &cacheSize = QSize());
+ PanelModality panelModality() const;
+ void setPanelModality(PanelModality panelModality);
+ bool isBlockedByModalPanel(QGraphicsItem **blockingPanel = 0) const;
+
#ifndef QT_NO_TOOLTIP
QString toolTip() const;
void setToolTip(const QString &toolTip);
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 3feccdc..51bfea1 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -131,6 +131,7 @@ public:
subFocusItem(0),
focusScopeItem(0),
imHints(Qt::ImhNone),
+ panelModality(QGraphicsItem::NonModal),
acceptedMouseButtons(0x1f),
visible(1),
explicitlyHidden(0),
@@ -448,6 +449,7 @@ public:
QGraphicsItem *subFocusItem;
QGraphicsItem *focusScopeItem;
Qt::InputMethodHints imHints;
+ QGraphicsItem::PanelModality panelModality;
// Packed 32 bits
quint32 acceptedMouseButtons : 5;
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 4b74b67..1226722 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -565,6 +565,9 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
q->removeItem(item->d_ptr->children.at(i));
}
+ if (item->isPanel() && item->isVisible() && item->panelModality() != QGraphicsItem::NonModal)
+ leaveModal(item);
+
// Reset the mouse grabber and focus item data.
if (mouseGrabberItems.contains(item))
ungrabMouse(item, /* item is dying */ item->d_ptr->inDestructor);
@@ -1111,6 +1114,9 @@ void QGraphicsScenePrivate::sendMouseEvent(QGraphicsSceneMouseEvent *mouseEvent)
}
QGraphicsItem *item = mouseGrabberItems.last();
+ if (item->isBlockedByModalPanel())
+ return;
+
for (int i = 0x1; i <= 0x10; i <<= 1) {
Qt::MouseButton button = Qt::MouseButton(i);
mouseEvent->setButtonDownPos(button, mouseGrabberButtonDownPos.value(button, item->d_ptr->genericMapFromScene(mouseEvent->scenePos(), mouseEvent->widget())));
@@ -1134,6 +1140,8 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
// Deliver to any existing mouse grabber.
if (!mouseGrabberItems.isEmpty()) {
+ if (mouseGrabberItems.last()->isBlockedByModalPanel())
+ return;
// The event is ignored by default, but we disregard the event's
// accepted state after delivery; the mouse is grabbed, after all.
sendMouseEvent(mouseEvent);
@@ -1151,12 +1159,22 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
// Update window activation.
QGraphicsItem *topItem = cachedItemsUnderMouse.value(0);
QGraphicsWidget *newActiveWindow = topItem ? topItem->window() : 0;
+ if (newActiveWindow && newActiveWindow->isBlockedByModalPanel(&topItem)) {
+ // pass activation to the blocking modal window
+ newActiveWindow = topItem ? topItem->window() : 0;
+ }
+
if (newActiveWindow != q->activeWindow())
q->setActiveWindow(newActiveWindow);
// Set focus on the topmost enabled item that can take focus.
bool setFocus = false;
foreach (QGraphicsItem *item, cachedItemsUnderMouse) {
+ if (item->isBlockedByModalPanel()) {
+ // Make sure we don't clear focus.
+ setFocus = true;
+ break;
+ }
if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable) && item->d_ptr->mouseSetsFocus)) {
if (!item->isWidget() || ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus) {
setFocus = true;
@@ -1165,12 +1183,27 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
break;
}
}
+ if (item->isPanel())
+ break;
+ }
+
+ // Check for scene modality.
+ bool sceneModality = false;
+ for (int i = 0; i < modalPanels.size(); ++i) {
+ if (modalPanels.at(i)->panelModality() == QGraphicsItem::SceneModal) {
+ sceneModality = true;
+ break;
+ }
}
// If nobody could take focus, clear it.
- if (!stickyFocus && !setFocus)
+ if (!stickyFocus && !setFocus && !sceneModality)
q->setFocusItem(0, Qt::MouseFocusReason);
+ // Any item will do.
+ if (sceneModality && cachedItemsUnderMouse.isEmpty())
+ cachedItemsUnderMouse << modalPanels.first();
+
// Find a mouse grabber by sending mouse press events to all mouse grabber
// candidates one at a time, until the event is accepted. It's accepted by
// default, so the receiver has to explicitly ignore it for it to pass
@@ -1181,6 +1214,10 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
continue;
}
+ // Check if this item is blocked by a modal panel and deliver the mouse event to the
+ // blocking panel instead of this item if blocked.
+ (void) item->isBlockedByModalPanel(&item);
+
grabMouse(item, /* implicit = */ true);
mouseEvent->accept();
@@ -1723,9 +1760,9 @@ QRectF QGraphicsScene::itemsBoundingRect() const
}
/*!
- Returns a list of all items on the scene, in no particular order.
+ Returns a list of all items in the scene in descending stacking order.
- \sa addItem(), removeItem()
+ \sa addItem(), removeItem(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsScene::items() const
{
@@ -1735,9 +1772,9 @@ QList<QGraphicsItem *> QGraphicsScene::items() const
/*!
Returns an ordered list of all items on the scene. \a order decides the
- sorting.
+ stacking order.
- \sa addItem(), removeItem()
+ \sa addItem(), removeItem(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsScene::items(Qt::SortOrder order) const
{
@@ -1756,7 +1793,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(Qt::SortOrder order) const
contains items that ignore transformations. Use the overload that takes
a QTransform instead.
- \sa itemAt()
+ \sa itemAt(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos) const
{
@@ -1778,7 +1815,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos) const
contains items that ignore transformations. Use the overload that takes
a QTransform instead.
- \sa itemAt()
+ \sa itemAt(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rectangle, Qt::ItemSelectionMode mode) const
{
@@ -1799,20 +1836,20 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rectangle, Qt::ItemSe
*/
/*!
- \fn QList<QGraphicsItem *> QGraphicsScene::items(qreal x, qreal y, qreal w, qreal h,
- Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const
+ \fn QList<QGraphicsItem *> QGraphicsScene::items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const
\overload
\since 4.6
- Returns all visible items that, depending on \a mode, are either inside or
- intersect with the rectangle defined by \a x, \a y, \a w and \a h, in a list
- sorted using \a order.
+ \brief Returns all visible items that, depending on \a mode, are
+ either inside or intersect with the rectangle defined by \a x, \a y,
+ \a w and \a h, in a list sorted using \a order.
\a deviceTransform is the transformation that applies to the view, and needs to
be provided if the scene contains items that ignore transformations.
*/
/*!
+ \fn QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode) const
\overload
\obsolete
@@ -1826,7 +1863,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rectangle, Qt::ItemSe
contains items that ignore transformations. Use the overload that takes
a QTransform instead.
- \sa itemAt()
+ \sa itemAt(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode) const
{
@@ -1835,6 +1872,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemS
}
/*!
+ \fn QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode) const
\overload
\obsolete
@@ -1848,7 +1886,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemS
contains items that ignore transformations. Use the overload that takes
a QTransform instead.
- \sa itemAt()
+ \sa itemAt(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode) const
{
@@ -1857,10 +1895,11 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemS
}
/*!
+ \fn QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const
\since 4.6
- Returns all visible items that, depending on \a mode, are at the specified \a pos
- in a list sorted using \a order.
+ \brief Returns all visible items that, depending on \a mode, are at
+ the specified \a pos in a list sorted using \a order.
The default value for \a mode is Qt::IntersectsItemShape; all items whose
exact shape intersects with \a pos are returned.
@@ -1868,7 +1907,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemS
\a deviceTransform is the transformation that applies to the view, and needs to
be provided if the scene contains items that ignore transformations.
- \sa itemAt()
+ \sa itemAt(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos, Qt::ItemSelectionMode mode,
Qt::SortOrder order, const QTransform &deviceTransform) const
@@ -1878,11 +1917,13 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos, Qt::ItemSelecti
}
/*!
+ \fn QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const
\overload
\since 4.6
- Returns all visible items that, depending on \a mode, are either inside or
- intersect with the specified \a rect and return a list sorted using \a order.
+ \brief Returns all visible items that, depending on \a mode, are
+ either inside or intersect with the specified \a rect and return a
+ list sorted using \a order.
The default value for \a mode is Qt::IntersectsItemShape; all items whose
exact shape intersects with or is contained by \a rect are returned.
@@ -1890,7 +1931,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos, Qt::ItemSelecti
\a deviceTransform is the transformation that applies to the view, and needs to
be provided if the scene contains items that ignore transformations.
- \sa itemAt()
+ \sa itemAt(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rect, Qt::ItemSelectionMode mode,
Qt::SortOrder order, const QTransform &deviceTransform) const
@@ -1900,11 +1941,13 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rect, Qt::ItemSelecti
}
/*!
+ \fn QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const
\overload
\since 4.6
- Returns all visible items that, depending on \a mode, are either inside or
- intersect with the specified \a polygon and return a list sorted using \a order.
+ \brief Returns all visible items that, depending on \a mode, are
+ either inside or intersect with the specified \a polygon and return
+ a list sorted using \a order.
The default value for \a mode is Qt::IntersectsItemShape; all items whose
exact shape intersects with or is contained by \a polygon are returned.
@@ -1912,7 +1955,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rect, Qt::ItemSelecti
\a deviceTransform is the transformation that applies to the view, and needs to
be provided if the scene contains items that ignore transformations.
- \sa itemAt()
+ \sa itemAt(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode,
Qt::SortOrder order, const QTransform &deviceTransform) const
@@ -1922,11 +1965,13 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemS
}
/*!
+ \fn QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const
\overload
\since 4.6
- Returns all visible items that, depending on \a mode, are either inside or
- intersect with the specified \a path and return a list sorted using \a order.
+ \brief Returns all visible items that, depending on \a mode, are
+ either inside or intersect with the specified \a path and return a
+ list sorted using \a order.
The default value for \a mode is Qt::IntersectsItemShape; all items whose
exact shape intersects with or is contained by \a path are returned.
@@ -1934,7 +1979,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemS
\a deviceTransform is the transformation that applies to the view, and needs to
be provided if the scene contains items that ignore transformations.
- \sa itemAt()
+ \sa itemAt(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode,
Qt::SortOrder order, const QTransform &deviceTransform) const
@@ -1949,10 +1994,11 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemS
detection is determined by \a mode. By default, all items whose shape
intersects \a item or is contained inside \a item's shape are returned.
- The items are returned in descending Z order (i.e., the first item in the
- list is the top-most item, and the last item is the bottom-most item).
+ The items are returned in descending stacking order (i.e., the first item
+ in the list is the uppermost item, and the last item is the lowermost
+ item).
- \sa items(), itemAt(), QGraphicsItem::collidesWithItem()
+ \sa items(), itemAt(), QGraphicsItem::collidesWithItem(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsScene::collidingItems(const QGraphicsItem *item,
Qt::ItemSelectionMode mode) const
@@ -1979,13 +2025,11 @@ QList<QGraphicsItem *> QGraphicsScene::collidingItems(const QGraphicsItem *item,
Returns the topmost visible item at the specified \a position, or 0 if
there are no items at this position.
- \note The topmost item is the one with the highest Z-value.
-
This function is deprecated and returns incorrect results if the scene
contains items that ignore transformations. Use the overload that takes
a QTransform instead.
- \sa items(), collidingItems(), QGraphicsItem::setZValue()
+ \sa items(), collidingItems(), {QGraphicsItem#Sorting}{Sorting}
*/
QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position) const
{
@@ -2002,10 +2046,8 @@ QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position) const
\a deviceTransform is the transformation that applies to the view, and needs to
be provided if the scene contains items that ignore transformations.
- \note The topmost item is the one with the highest Z-value.
-
- \sa items(), collidingItems(), QGraphicsItem::setZValue()
- */
+ \sa items(), collidingItems(), {QGraphicsItem#Sorting}{Sorting}
+*/
QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform &deviceTransform) const
{
QList<QGraphicsItem *> itemsAtPoint = items(position, Qt::IntersectsItemShape,
@@ -2026,8 +2068,6 @@ QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform
This convenience function is equivalent to calling \c
{itemAt(QPointF(x, y), deviceTransform)}.
-
- \note The topmost item is the one with the highest Z-value.
*/
/*!
@@ -2044,8 +2084,6 @@ QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform
This function is deprecated and returns incorrect results if the scene
contains items that ignore transformations. Use the overload that takes
a QTransform instead.
-
- \note The topmost item is the one with the highest Z-value.
*/
/*!
@@ -2324,7 +2362,7 @@ void QGraphicsScene::destroyItemGroup(QGraphicsItemGroup *group)
in the scene, then the item will be activated.
\sa removeItem(), addEllipse(), addLine(), addPath(), addPixmap(),
- addRect(), addText(), addWidget()
+ addRect(), addText(), addWidget(), {QGraphicsItem#Sorting}{Sorting}
*/
void QGraphicsScene::addItem(QGraphicsItem *item)
{
@@ -2403,6 +2441,8 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
d->selectedItems << item;
if (item->isWidget() && item->isVisible() && static_cast<QGraphicsWidget *>(item)->windowType() == Qt::Popup)
d->addPopup(static_cast<QGraphicsWidget *>(item));
+ if (item->isPanel() && item->isVisible() && item->panelModality() != QGraphicsItem::NonModal)
+ d->enterModal(item);
// Update creation order focus chain. Make sure to leave the widget's
// internal tab order intact.
@@ -3205,8 +3245,12 @@ bool QGraphicsScene::event(QEvent *event)
}
return false;
case QEvent::GraphicsSceneMouseMove:
- mouseMoveEvent(static_cast<QGraphicsSceneMouseEvent *>(event));
+ {
+ QGraphicsSceneMouseEvent *mouseEvent = static_cast<QGraphicsSceneMouseEvent *>(event);
+ d->lastSceneMousePos = mouseEvent->scenePos();
+ mouseMoveEvent(mouseEvent);
break;
+ }
case QEvent::GraphicsSceneMousePress:
mousePressEvent(static_cast<QGraphicsSceneMouseEvent *>(event));
break;
@@ -3228,8 +3272,12 @@ bool QGraphicsScene::event(QEvent *event)
case QEvent::GraphicsSceneHoverEnter:
case QEvent::GraphicsSceneHoverLeave:
case QEvent::GraphicsSceneHoverMove:
- d->dispatchHoverEvent(static_cast<QGraphicsSceneHoverEvent *>(event));
+ {
+ QGraphicsSceneHoverEvent *hoverEvent = static_cast<QGraphicsSceneHoverEvent *>(event);
+ d->lastSceneMousePos = hoverEvent->scenePos();
+ d->dispatchHoverEvent(hoverEvent);
break;
+ }
case QEvent::Leave:
d->leaveScene();
break;
@@ -3599,8 +3647,10 @@ void QGraphicsScene::helpEvent(QGraphicsSceneHelpEvent *helpEvent)
bool QGraphicsScenePrivate::itemAcceptsHoverEvents_helper(const QGraphicsItem *item) const
{
- return item->acceptHoverEvents()
- || (item->isWidget() && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration());
+ return (!item->isBlockedByModalPanel() &&
+ (item->acceptHoverEvents()
+ || (item->isWidget()
+ && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration())));
}
/*!
@@ -3674,7 +3724,9 @@ bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEv
}
// Generate a move event for the item itself
- if (item && !hoverItems.isEmpty() && item == hoverItems.last()) {
+ if (item
+ && !hoverItems.isEmpty()
+ && item == hoverItems.last()) {
sendHoverEvent(QEvent::GraphicsSceneHoverMove, item, hoverEvent);
return true;
}
@@ -3708,8 +3760,7 @@ void QGraphicsScenePrivate::leaveScene()
while (!hoverItems.isEmpty()) {
QGraphicsItem *lastItem = hoverItems.takeLast();
- if (lastItem->acceptHoverEvents()
- || (lastItem->isWidget() && static_cast<QGraphicsWidget*>(lastItem)->d_func()->hasDecoration()))
+ if (itemAcceptsHoverEvents_helper(lastItem))
sendHoverEvent(QEvent::GraphicsSceneHoverLeave, lastItem, &hoverEvent);
}
}
@@ -3736,6 +3787,8 @@ void QGraphicsScene::keyPressEvent(QKeyEvent *keyEvent)
keyEvent->accept();
// Send it; QGraphicsItem::keyPressEvent ignores it. If the event
// is filtered out, stop propagating it.
+ if (p->isBlockedByModalPanel())
+ break;
if (!d->sendEvent(p, keyEvent))
break;
} while (!keyEvent->isAccepted() && !p->isPanel() && (p = p->parentItem()));
@@ -3766,6 +3819,8 @@ void QGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent)
keyEvent->accept();
// Send it; QGraphicsItem::keyPressEvent ignores it. If the event
// is filtered out, stop propagating it.
+ if (p->isBlockedByModalPanel())
+ break;
if (!d->sendEvent(p, keyEvent))
break;
} while (!keyEvent->isAccepted() && !p->isPanel() && (p = p->parentItem()));
@@ -5420,6 +5475,8 @@ void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent)
for (; it != end; ++it) {
QGraphicsItem *item = it.key();
+ (void) item->isBlockedByModalPanel(&item);
+
// determine event type from the state mask
QEvent::Type eventType;
switch (it.value().first) {
@@ -5493,6 +5550,8 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve
break;
}
}
+ if (item->isPanel())
+ break;
}
// If nobody could take focus, clear it.
@@ -5518,6 +5577,8 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve
}
break;
}
+ if (item->isPanel())
+ break;
}
touchEvent->setAccepted(eventAccepted);
@@ -5536,6 +5597,94 @@ void QGraphicsScenePrivate::updateInputMethodSensitivityInViews()
views.at(i)->d_func()->updateInputMethodSensitivity();
}
+void QGraphicsScenePrivate::enterModal(QGraphicsItem *panel, QGraphicsItem::PanelModality previousModality)
+{
+ Q_Q(QGraphicsScene);
+ Q_ASSERT(panel && panel->isPanel());
+
+ QGraphicsItem::PanelModality panelModality = panel->d_ptr->panelModality;
+ if (previousModality != QGraphicsItem::NonModal) {
+ // the panel is changing from one modality type to another... temporarily set it back so
+ // that blockedPanels is populated correctly
+ panel->d_ptr->panelModality = previousModality;
+ }
+
+ QSet<QGraphicsItem *> blockedPanels;
+ QList<QGraphicsItem *> items = q->items(); // ### store panels separately
+ for (int i = 0; i < items.count(); ++i) {
+ QGraphicsItem *item = items.at(i);
+ if (item->isPanel() && item->isBlockedByModalPanel())
+ blockedPanels.insert(item);
+ }
+ // blockedPanels contains all currently blocked panels
+
+ if (previousModality != QGraphicsItem::NonModal) {
+ // reset the modality to the proper value, since we changed it above
+ panel->d_ptr->panelModality = panelModality;
+ // remove this panel so that it will be reinserted at the front of the stack
+ modalPanels.removeAll(panel);
+ }
+
+ modalPanels.prepend(panel);
+
+ if (!hoverItems.isEmpty()) {
+ // send GraphicsSceneHoverLeave events to newly blocked hoverItems
+ QGraphicsSceneHoverEvent hoverEvent;
+ hoverEvent.setScenePos(lastSceneMousePos);
+ dispatchHoverEvent(&hoverEvent);
+ }
+
+ if (!mouseGrabberItems.isEmpty() && lastMouseGrabberItemHasImplicitMouseGrab) {
+ QGraphicsItem *item = mouseGrabberItems.last();
+ if (item->isBlockedByModalPanel())
+ ungrabMouse(item, /*itemIsDying =*/ false);
+ }
+
+ QEvent windowBlockedEvent(QEvent::WindowBlocked);
+ QEvent windowUnblockedEvent(QEvent::WindowUnblocked);
+ for (int i = 0; i < items.count(); ++i) {
+ QGraphicsItem *item = items.at(i);
+ if (item->isPanel()) {
+ if (!blockedPanels.contains(item) && item->isBlockedByModalPanel()) {
+ // send QEvent::WindowBlocked to newly blocked panels
+ sendEvent(item, &windowBlockedEvent);
+ } else if (blockedPanels.contains(item) && !item->isBlockedByModalPanel()) {
+ // send QEvent::WindowUnblocked to unblocked panels when downgrading
+ // a panel from SceneModal to PanelModal
+ sendEvent(item, &windowUnblockedEvent);
+ }
+ }
+ }
+}
+
+void QGraphicsScenePrivate::leaveModal(QGraphicsItem *panel)
+{
+ Q_Q(QGraphicsScene);
+ Q_ASSERT(panel && panel->isPanel());
+
+ QSet<QGraphicsItem *> blockedPanels;
+ QList<QGraphicsItem *> items = q->items(); // ### same as above
+ for (int i = 0; i < items.count(); ++i) {
+ QGraphicsItem *item = items.at(i);
+ if (item->isPanel() && item->isBlockedByModalPanel())
+ blockedPanels.insert(item);
+ }
+
+ modalPanels.removeAll(panel);
+
+ QEvent e(QEvent::WindowUnblocked);
+ for (int i = 0; i < items.count(); ++i) {
+ QGraphicsItem *item = items.at(i);
+ if (item->isPanel() && blockedPanels.contains(item) && !item->isBlockedByModalPanel())
+ sendEvent(item, &e);
+ }
+
+ // send GraphicsSceneHoverEnter events to newly unblocked items
+ QGraphicsSceneHoverEvent hoverEvent;
+ hoverEvent.setScenePos(lastSceneMousePos);
+ dispatchHoverEvent(&hoverEvent);
+}
+
QT_END_NAMESPACE
#include "moc_qgraphicsscene.cpp"
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index 46917ce..5000860 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -160,6 +160,7 @@ public:
Qt::DropAction lastDropAction;
QList<QGraphicsItem *> cachedItemsUnderMouse;
QList<QGraphicsItem *> hoverItems;
+ QPointF lastSceneMousePos;
bool allItemsIgnoreHoverEvents;
bool allItemsUseDefaultCursor;
void enableMouseTrackingOnViews();
@@ -282,6 +283,11 @@ public:
void enableTouchEventsOnViews();
void updateInputMethodSensitivityInViews();
+
+ QList<QGraphicsItem *> modalPanels;
+ void enterModal(QGraphicsItem *item,
+ QGraphicsItem::PanelModality panelModality = QGraphicsItem::NonModal);
+ void leaveModal(QGraphicsItem *item);
};
// QRectF::intersects() returns false always if either the source or target
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 98b2c9c..32747cc 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -2016,9 +2016,11 @@ void QGraphicsView::render(QPainter *painter, const QRectF &target, const QRect
}
/*!
- Returns a list of all the items in the associated scene.
+ Returns a list of all the items in the associated scene, in descending
+ stacking order (i.e., the first item in the returned list is the uppermost
+ item).
- \sa QGraphicsScene::items()
+ \sa QGraphicsScene::items(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsView::items() const
{
@@ -2030,9 +2032,9 @@ QList<QGraphicsItem *> QGraphicsView::items() const
/*!
Returns a list of all the items at the position \a pos in the view. The
- items are listed in descending Z order (i.e., the first item in the list
- is the top-most item, and the last item is the bottom-most item). \a pos
- is in viewport coordinates.
+ items are listed in descending stacking order (i.e., the first item in the
+ list is the uppermost item, and the last item is the lowermost item). \a
+ pos is in viewport coordinates.
This function is most commonly called from within mouse event handlers in
a subclass in QGraphicsView. \a pos is in untransformed viewport
@@ -2040,7 +2042,7 @@ QList<QGraphicsItem *> QGraphicsView::items() const
\snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp 5
- \sa QGraphicsScene::items(), QGraphicsItem::zValue()
+ \sa QGraphicsScene::items(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsView::items(const QPoint &pos) const
{
@@ -2082,7 +2084,10 @@ QList<QGraphicsItem *> QGraphicsView::items(const QPoint &pos) const
The default value for \a mode is Qt::IntersectsItemShape; all items whose
exact shape intersects with or is contained by \a rect are returned.
- \sa itemAt(), items(), mapToScene()
+ The items are sorted in descending stacking order (i.e., the first item in
+ the returned list is the uppermost item).
+
+ \sa itemAt(), items(), mapToScene(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsView::items(const QRect &rect, Qt::ItemSelectionMode mode) const
{
@@ -2110,7 +2115,10 @@ QList<QGraphicsItem *> QGraphicsView::items(const QRect &rect, Qt::ItemSelection
The default value for \a mode is Qt::IntersectsItemShape; all items whose
exact shape intersects with or is contained by \a polygon are returned.
- \sa itemAt(), items(), mapToScene()
+ The items are sorted by descending stacking order (i.e., the first item in
+ the returned list is the uppermost item).
+
+ \sa itemAt(), items(), mapToScene(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsView::items(const QPolygon &polygon, Qt::ItemSelectionMode mode) const
{
@@ -2130,7 +2138,7 @@ QList<QGraphicsItem *> QGraphicsView::items(const QPolygon &polygon, Qt::ItemSel
The default value for \a mode is Qt::IntersectsItemShape; all items whose
exact shape intersects with or is contained by \a path are returned.
- \sa itemAt(), items(), mapToScene()
+ \sa itemAt(), items(), mapToScene(), {QGraphicsItem#Sorting}{Sorting}
*/
QList<QGraphicsItem *> QGraphicsView::items(const QPainterPath &path, Qt::ItemSelectionMode mode) const
{
@@ -2149,7 +2157,7 @@ QList<QGraphicsItem *> QGraphicsView::items(const QPainterPath &path, Qt::ItemSe
\snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp 6
- \sa items()
+ \sa items(), {QGraphicsItem#Sorting}{Sorting}
*/
QGraphicsItem *QGraphicsView::itemAt(const QPoint &pos) const
{
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 83ac5fe..7c24002 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -54,4 +54,4 @@ DEFINES += Q_INTERNAL_QAPP_SRC
symbian:TARGET.UID3=0x2001B2DD
# ro-section in gui can exceed default allocated space, so more rw-section little further
-symbian-sbsv2: MMP_RULES += "LINKEROPTION armcc --rw-base 0x800000" \ No newline at end of file
+symbian-sbsv2: MMP_RULES += "LINKEROPTION armcc --rw-base 0x800000"
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 89d7de5..1ac56a7 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -314,7 +314,7 @@ private:
QImageData *d;
friend class QRasterPixmapData;
- friend class QDetachedPixmap;
+ friend class QPixmapCacheEntry;
friend Q_GUI_EXPORT qint64 qt_image_id(const QImage &image);
friend const QVector<QRgb> *qt_image_colortable(const QImage &image);
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index a891637..d11bd03 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -270,7 +270,7 @@ private:
friend class QWidgetPrivate;
friend class QRasterPaintEngine;
friend class QRasterBuffer;
- friend class QDetachedPixmap;
+ friend class QPixmapCacheEntry;
#if !defined(QT_NO_DATASTREAM)
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPixmap &);
#endif
diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h
index 2af2399..da0405e 100644
--- a/src/gui/image/qpixmap_raster_p.h
+++ b/src/gui/image/qpixmap_raster_p.h
@@ -88,7 +88,7 @@ protected:
private:
friend class QPixmap;
friend class QBitmap;
- friend class QDetachedPixmap;
+ friend class QPixmapCacheEntry;
friend class QRasterPaintEngine;
};
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index dccc691..4938442 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -476,9 +476,9 @@ void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags
sourceImage = img.convertToFormat(QImage::Format_MonoLSB);
} else {
if (img.depth() == 1) {
- image = img.hasAlphaChannel()
- ? img.convertToFormat(QImage::Format_ARGB32_Premultiplied)
- : img.convertToFormat(QImage::Format_RGB32);
+ sourceImage = img.hasAlphaChannel()
+ ? img.convertToFormat(QImage::Format_ARGB32_Premultiplied)
+ : img.convertToFormat(QImage::Format_RGB32);
} else {
QImage::Format opaqueFormat = QNativeImage::systemFormat();
diff --git a/src/gui/image/qpixmap_x11_p.h b/src/gui/image/qpixmap_x11_p.h
index ed8678d..e34e690 100644
--- a/src/gui/image/qpixmap_x11_p.h
+++ b/src/gui/image/qpixmap_x11_p.h
@@ -100,6 +100,8 @@ private:
friend class QX11WindowSurface;
friend class QRasterWindowSurface;
friend class QGLContextPrivate; // Needs to access xinfo, gl_surface & flags
+ friend class QEglContext; // Needs gl_surface
+ friend bool qt_createEGLSurfaceForPixmap(QPixmapData*, bool); // Needs gl_surface
void release();
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 8029977..f12d397 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -167,7 +167,7 @@ QPixmapCache::Key &QPixmapCache::Key::operator =(const Key &other)
return *this;
}
-class QPMCache : public QObject, public QCache<QPixmapCache::Key, QDetachedPixmap>
+class QPMCache : public QObject, public QCache<QPixmapCache::Key, QPixmapCacheEntry>
{
Q_OBJECT
public:
@@ -215,7 +215,7 @@ uint qHash(const QPixmapCache::Key &k)
QPMCache::QPMCache()
: QObject(0),
- QCache<QPixmapCache::Key, QDetachedPixmap>(cache_limit * 1024),
+ QCache<QPixmapCache::Key, QPixmapCacheEntry>(cache_limit * 1024),
keyArray(0), theid(0), ps(0), keyArraySize(0), freeKey(0), t(false)
{
}
@@ -238,7 +238,6 @@ void QPMCache::timerEvent(QTimerEvent *)
{
int mc = maxCost();
bool nt = totalCost() == ps;
- QList<QPixmapCache::Key> keys = QCache<QPixmapCache::Key, QDetachedPixmap>::keys();
setMaxCost(nt ? totalCost() * 3 / 4 : totalCost() -1);
setMaxCost(mc);
ps = totalCost();
@@ -252,10 +251,6 @@ void QPMCache::timerEvent(QTimerEvent *)
++it;
}
}
- for (int i = 0; i < keys.size(); ++i) {
- if (!contains(keys.at(i)))
- releaseKey(keys.at(i));
- }
if (!size()) {
killTimer(theid);
@@ -274,11 +269,10 @@ QPixmap *QPMCache::object(const QString &key) const
const_cast<QPMCache *>(this)->cacheKeys.remove(key);
return 0;
}
- QPixmap *ptr = QCache<QPixmapCache::Key, QDetachedPixmap>::object(cacheKey);
+ QPixmap *ptr = QCache<QPixmapCache::Key, QPixmapCacheEntry>::object(cacheKey);
//We didn't find the pixmap in the cache, the key is not valid anymore
if (!ptr) {
const_cast<QPMCache *>(this)->cacheKeys.remove(key);
- const_cast<QPMCache *>(this)->releaseKey(cacheKey);
}
return ptr;
}
@@ -286,7 +280,7 @@ QPixmap *QPMCache::object(const QString &key) const
QPixmap *QPMCache::object(const QPixmapCache::Key &key) const
{
Q_ASSERT(key.d->isValid);
- QPixmap *ptr = QCache<QPixmapCache::Key, QDetachedPixmap>::object(key);
+ QPixmap *ptr = QCache<QPixmapCache::Key, QPixmapCacheEntry>::object(key);
//We didn't find the pixmap in the cache, the key is not valid anymore
if (!ptr)
const_cast<QPMCache *>(this)->releaseKey(key);
@@ -299,13 +293,14 @@ bool QPMCache::insert(const QString& key, const QPixmap &pixmap, int cost)
QPixmapCache::Key oldCacheKey = cacheKeys.value(key);
//If for the same key we add already a pixmap we should delete it
if (oldCacheKey.d) {
- QCache<QPixmapCache::Key, QDetachedPixmap>::remove(oldCacheKey);
- cacheKey = oldCacheKey;
- } else {
- cacheKey = createKey();
- }
+ QCache<QPixmapCache::Key, QPixmapCacheEntry>::remove(oldCacheKey);
+ cacheKeys.remove(key);
+ }
+
+ //we create a new key the old one has been removed
+ cacheKey = createKey();
- bool success = QCache<QPixmapCache::Key, QDetachedPixmap>::insert(cacheKey, new QDetachedPixmap(pixmap), cost);
+ bool success = QCache<QPixmapCache::Key, QPixmapCacheEntry>::insert(cacheKey, new QPixmapCacheEntry(cacheKey, pixmap), cost);
if (success) {
cacheKeys.insert(key, cacheKey);
if (!theid) {
@@ -322,7 +317,7 @@ bool QPMCache::insert(const QString& key, const QPixmap &pixmap, int cost)
QPixmapCache::Key QPMCache::insert(const QPixmap &pixmap, int cost)
{
QPixmapCache::Key cacheKey = createKey();
- bool success = QCache<QPixmapCache::Key, QDetachedPixmap>::insert(cacheKey, new QDetachedPixmap(pixmap), cost);
+ bool success = QCache<QPixmapCache::Key, QPixmapCacheEntry>::insert(cacheKey, new QPixmapCacheEntry(cacheKey, pixmap), cost);
if (success) {
if (!theid) {
theid = startTimer(30000);
@@ -338,13 +333,21 @@ QPixmapCache::Key QPMCache::insert(const QPixmap &pixmap, int cost)
bool QPMCache::replace(const QPixmapCache::Key &key, const QPixmap &pixmap, int cost)
{
Q_ASSERT(key.d->isValid);
- //If for the same key we add already a pixmap we should delete it
- QCache<QPixmapCache::Key, QDetachedPixmap>::remove(key);
+ //If for the same key we had already an entry so we should delete the pixmap and use the new one
+ QCache<QPixmapCache::Key, QPixmapCacheEntry>::remove(key);
+
+ QPixmapCache::Key cacheKey = createKey();
- bool success = QCache<QPixmapCache::Key, QDetachedPixmap>::insert(key, new QDetachedPixmap(pixmap), cost);
- if (success && !theid) {
- theid = startTimer(30000);
- t = false;
+ bool success = QCache<QPixmapCache::Key, QPixmapCacheEntry>::insert(cacheKey, new QPixmapCacheEntry(cacheKey, pixmap), cost);
+ if (success) {
+ if(!theid) {
+ theid = startTimer(30000);
+ t = false;
+ }
+ const_cast<QPixmapCache::Key&>(key) = cacheKey;
+ } else {
+ //Insertion failed we released the key
+ releaseKey(cacheKey);
}
return success;
}
@@ -356,16 +359,12 @@ bool QPMCache::remove(const QString &key)
if (!cacheKey.d)
return false;
cacheKeys.remove(key);
- releaseKey(cacheKey);
- return QCache<QPixmapCache::Key, QDetachedPixmap>::remove(cacheKey);
+ return QCache<QPixmapCache::Key, QPixmapCacheEntry>::remove(cacheKey);
}
bool QPMCache::remove(const QPixmapCache::Key &key)
{
- bool result = QCache<QPixmapCache::Key, QDetachedPixmap>::remove(key);
- //We release the key after we removed it from the cache
- releaseKey(key);
- return result;
+ return QCache<QPixmapCache::Key, QPixmapCacheEntry>::remove(key);
}
void QPMCache::resizeKeyArray(int size)
@@ -409,10 +408,10 @@ void QPMCache::clear()
freeKey = 0;
keyArraySize = 0;
//Mark all keys as invalid
- QList<QPixmapCache::Key> keys = QCache<QPixmapCache::Key, QDetachedPixmap>::keys();
+ QList<QPixmapCache::Key> keys = QCache<QPixmapCache::Key, QPixmapCacheEntry>::keys();
for (int i = 0; i < keys.size(); ++i)
keys.at(i).d->isValid = false;
- QCache<QPixmapCache::Key, QDetachedPixmap>::clear();
+ QCache<QPixmapCache::Key, QPixmapCacheEntry>::clear();
}
QPixmapCache::KeyData* QPMCache::getKeyData(QPixmapCache::Key *key)
@@ -424,6 +423,11 @@ QPixmapCache::KeyData* QPMCache::getKeyData(QPixmapCache::Key *key)
Q_GLOBAL_STATIC(QPMCache, pm_cache)
+QPixmapCacheEntry::~QPixmapCacheEntry()
+{
+ pm_cache()->releaseKey(key);
+}
+
/*!
\obsolete
\overload
diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h
index 33f93bc..84e4a03 100644
--- a/src/gui/image/qpixmapcache_p.h
+++ b/src/gui/image/qpixmapcache_p.h
@@ -76,10 +76,10 @@ public:
};
// XXX: hw: is this a general concept we need to abstract?
-class QDetachedPixmap : public QPixmap
+class QPixmapCacheEntry : public QPixmap
{
public:
- QDetachedPixmap(const QPixmap &pix) : QPixmap(pix)
+ QPixmapCacheEntry(const QPixmapCache::Key &key, const QPixmap &pix) : QPixmap(pix), key(key)
{
if (data && data->classId() == QPixmapData::RasterClass) {
QRasterPixmapData *d = static_cast<QRasterPixmapData*>(data.data());
@@ -91,6 +91,8 @@ public:
}
}
}
+ ~QPixmapCacheEntry();
+ QPixmapCache::Key key;
};
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h
index 3e85236..c26fba3 100644
--- a/src/gui/image/qpixmapdata_p.h
+++ b/src/gui/image/qpixmapdata_p.h
@@ -134,6 +134,7 @@ private:
friend class QS60PixmapData;
friend class QGLTextureCache; //Needs to check the reference count
friend class QExplicitlySharedDataPointer<QPixmapData>;
+ friend bool qt_createEGLSurfaceForPixmap(QPixmapData*, bool); // Needs to set is_cached
QAtomicInt ref;
int detach_no;
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp
index ba9a1e2..749b8f3 100644
--- a/src/gui/image/qpixmapfilter.cpp
+++ b/src/gui/image/qpixmapfilter.cpp
@@ -504,10 +504,10 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q
class QPixmapBlurFilterPrivate : public QPixmapFilterPrivate
{
public:
- QPixmapBlurFilterPrivate() : radius(5), hint(QPixmapBlurFilter::PerformanceHint) {}
+ QPixmapBlurFilterPrivate() : radius(5), hint(Qt::PerformanceHint) {}
int radius;
- QPixmapBlurFilter::BlurHint hint;
+ Qt::RenderHint hint;
};
@@ -561,7 +561,7 @@ int QPixmapBlurFilter::radius() const
\internal
*/
-void QPixmapBlurFilter::setBlurHint(QPixmapBlurFilter::BlurHint hint)
+void QPixmapBlurFilter::setBlurHint(Qt::RenderHint hint)
{
Q_D(QPixmapBlurFilter);
d->hint = hint;
@@ -572,7 +572,7 @@ void QPixmapBlurFilter::setBlurHint(QPixmapBlurFilter::BlurHint hint)
\internal
*/
-QPixmapBlurFilter::BlurHint QPixmapBlurFilter::blurHint() const
+Qt::RenderHint QPixmapBlurFilter::blurHint() const
{
Q_D(const QPixmapBlurFilter);
return d->hint;
diff --git a/src/gui/image/qpixmapfilter_p.h b/src/gui/image/qpixmapfilter_p.h
index 92c8e56..8a2207a 100644
--- a/src/gui/image/qpixmapfilter_p.h
+++ b/src/gui/image/qpixmapfilter_p.h
@@ -126,19 +126,14 @@ class Q_GUI_EXPORT QPixmapBlurFilter : public QPixmapFilter
Q_DECLARE_PRIVATE(QPixmapBlurFilter)
public:
- enum BlurHint {
- PerformanceHint,
- QualityHint
- };
-
QPixmapBlurFilter(QObject *parent = 0);
~QPixmapBlurFilter();
void setRadius(int radius);
- void setBlurHint(BlurHint hint);
+ void setBlurHint(Qt::RenderHint hint);
int radius() const;
- BlurHint blurHint() const;
+ Qt::RenderHint blurHint() const;
QRectF boundingRectFor(const QRectF &rect) const;
void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const;
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index fc55a0f..c4d17ff 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -222,7 +222,7 @@ void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event)
TCoeInputCapabilities QCoeFepInputContext::inputCapabilities()
{
- if (m_inDestruction) {
+ if (m_inDestruction || !focusWidget()) {
return TCoeInputCapabilities(TCoeInputCapabilities::ENone, 0, 0);
}
@@ -554,8 +554,10 @@ void QCoeFepInputContext::SetCursorSelectionForFepL(const TCursorSelection& aCur
void QCoeFepInputContext::GetCursorSelectionForFep(TCursorSelection& aCursorSelection) const
{
QWidget *w = focusWidget();
- if (!w)
+ if (!w) {
+ aCursorSelection.SetSelection(0,0);
return;
+ }
int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt() + m_preeditString.size();
int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt() + m_preeditString.size();
@@ -567,8 +569,10 @@ void QCoeFepInputContext::GetEditorContentForFep(TDes& aEditorContent, TInt aDoc
TInt aLengthToRetrieve) const
{
QWidget *w = focusWidget();
- if (!w)
+ if (!w) {
+ aEditorContent.FillZ(aLengthToRetrieve);
return;
+ }
QString text = w->inputMethodQuery(Qt::ImSurroundingText).value<QString>();
// FEP expects the preedit string to be part of the editor content, so let's mix it in.
@@ -580,8 +584,10 @@ void QCoeFepInputContext::GetEditorContentForFep(TDes& aEditorContent, TInt aDoc
void QCoeFepInputContext::GetFormatForFep(TCharFormat& aFormat, TInt /* aDocumentPosition */) const
{
QWidget *w = focusWidget();
- if (!w)
+ if (!w) {
+ aFormat = TCharFormat();
return;
+ }
QFont font = w->inputMethodQuery(Qt::ImFont).value<QFont>();
QFontMetrics metrics(font);
@@ -595,8 +601,12 @@ void QCoeFepInputContext::GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLin
TInt& aAscent, TInt /* aDocumentPosition */) const
{
QWidget *w = focusWidget();
- if (!w)
+ if (!w) {
+ aLeftSideOfBaseLine = TPoint(0,0);
+ aHeight = 0;
+ aAscent = 0;
return;
+ }
QRect rect = w->inputMethodQuery(Qt::ImMicroFocus).value<QRect>();
aLeftSideOfBaseLine.iX = rect.left();
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 303f45b..0fae959 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -3626,12 +3626,13 @@ QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::extendedSelectionC
case Qt::Key_PageUp:
case Qt::Key_PageDown:
case Qt::Key_Tab:
+ if (modifiers & Qt::ControlModifier
#ifdef QT_KEYPAD_NAVIGATION
- return QItemSelectionModel::NoUpdate;
-#else
- if (modifiers & Qt::ControlModifier)
- return QItemSelectionModel::NoUpdate;
+ // Preserve historical tab order navigation behavior
+ || QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder
#endif
+ )
+ return QItemSelectionModel::NoUpdate;
break;
case Qt::Key_Select:
return QItemSelectionModel::Toggle|selectionBehaviorFlags();
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 2ad89a2..044fedd 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -97,6 +97,10 @@
#include "qapplication.h"
+#ifndef QT_NO_LIBRARY
+#include "qlibrary.h"
+#endif
+
#ifdef Q_WS_WINCE
#include "qdatetime.h"
#include "qguifunctions_wince.h"
@@ -457,6 +461,7 @@ bool QApplicationPrivate::animate_tooltip = false;
bool QApplicationPrivate::fade_tooltip = false;
bool QApplicationPrivate::animate_toolbox = false;
bool QApplicationPrivate::widgetCount = false;
+bool QApplicationPrivate::load_testability = false;
#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
bool QApplicationPrivate::inSizeMove = false;
#endif
@@ -563,6 +568,8 @@ void QApplicationPrivate::process_cmdline()
QApplication::setLayoutDirection(Qt::RightToLeft);
} else if (qstrcmp(arg, "-widgetcount") == 0) {
widgetCount = true;
+ } else if (qstrcmp(arg, "-testability") == 0) {
+ load_testability = true;
} else if (arg == "-graphicssystem" && i < argc-1) {
graphics_system_name = QString::fromLocal8Bit(argv[++i]);
} else {
@@ -765,6 +772,23 @@ void QApplicationPrivate::construct(
extern void qt_gui_eval_init(uint);
qt_gui_eval_init(application_type);
#endif
+
+#ifndef QT_NO_LIBRARY
+ if(load_testability) {
+ QLibrary testLib(QLatin1String("qttestability"));
+ if (testLib.load()) {
+ typedef void (*TasInitialize)(void);
+ TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init");
+ if (initFunction) {
+ initFunction();
+ } else {
+ qCritical("Library qttestability resolve failed!");
+ }
+ } else {
+ qCritical("Library qttestability load failed!");
+ }
+ }
+#endif
}
#if defined(Q_WS_X11)
@@ -901,7 +925,7 @@ void QApplicationPrivate::initialize()
graphics_system = QGraphicsSystemFactory::create(graphics_system_name);
#endif
#ifndef QT_NO_WHEELEVENT
-#ifdef QT_MAC_USE_COCOA
+#ifdef Q_OS_MAC
QApplicationPrivate::wheel_scroll_lines = 1;
#else
QApplicationPrivate::wheel_scroll_lines = 3;
@@ -3047,7 +3071,7 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget)
qt_button_down = 0;
// Send enter/leave events followed by a mouse move on the entered widget.
- QMouseEvent e(QEvent::MouseMove, pos, globalPos, Qt::NoButton, mouse_buttons, modifier_buttons);
+ QMouseEvent e(QEvent::MouseMove, pos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier);
sendMouseEvent(widgetUnderCursor, &e, widgetUnderCursor, tlw, &qt_button_down, qt_last_mouse_receiver);
#endif // QT_NO_CURSOR
}
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index a656c7f..a95ae9d 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -960,7 +960,18 @@ struct QMacAppleEventTypeSpec {
{ kCoreEventClass, kAEQuitApplication },
{ kCoreEventClass, kAEOpenDocuments }
};
+
#ifndef QT_MAC_USE_COCOA
+
+#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
+enum
+{
+ kEventMouseScroll = 11,
+ kEventParamMouseWheelSmoothVerticalDelta = 'saxy',
+ kEventParamMouseWheelSmoothHorizontalDelta = 'saxx',
+};
+#endif
+
/* watched events */
static EventTypeSpec app_events[] = {
{ kEventClassQt, kEventQtRequestWindowChange },
@@ -1675,13 +1686,15 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event
// (actually two events; one for horizontal and one for vertical).
// As a results of this, and to make sure we dont't receive duplicate events,
// we try to detect when this happend by checking the 'compatibilityEvent'.
+ const int scrollFactor = 4 * 8;
SInt32 mdelt = 0;
GetEventParameter(event, kEventParamMouseWheelSmoothHorizontalDelta, typeSInt32, 0,
sizeof(mdelt), 0, &mdelt);
- wheel_deltaX = mdelt;
+ wheel_deltaX = mdelt * scrollFactor;
+ mdelt = 0;
GetEventParameter(event, kEventParamMouseWheelSmoothVerticalDelta, typeSInt32, 0,
sizeof(mdelt), 0, &mdelt);
- wheel_deltaY = mdelt;
+ wheel_deltaY = mdelt * scrollFactor;
GetEventParameter(event, kEventParamEventRef, typeEventRef, 0,
sizeof(compatibilityEvent), 0, &compatibilityEvent);
} else if (ekind == kEventMouseWheelMoved) {
@@ -1693,10 +1706,14 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event
EventMouseWheelAxis axis;
GetEventParameter(event, kEventParamMouseWheelAxis, typeMouseWheelAxis, 0,
sizeof(axis), 0, &axis);
+
+ // The 'new' event has acceleration applied by the OS, while the old (on
+ // Carbon only), has not. So we introduce acceleration here to be consistent:
+ int scrollFactor = 120 * qMin(5, qAbs(mdelt));
if (axis == kEventMouseWheelAxisX)
- wheel_deltaX = mdelt * 120;
+ wheel_deltaX = mdelt * scrollFactor;
else
- wheel_deltaY = mdelt * 120;
+ wheel_deltaY = mdelt * scrollFactor;
}
}
@@ -2649,7 +2666,11 @@ int QApplication::keyboardInputInterval()
void QApplication::setWheelScrollLines(int n)
{
- QApplicationPrivate::wheel_scroll_lines = n;
+ Q_UNUSED(n);
+ // On Mac, acceleration is handled by the OS. Multiplying wheel scroll
+ // deltas with n will not be as cross platform as one might think! So
+ // we choose to go native in this case (and let wheel_scroll_lines == 1).
+ // QApplicationPrivate::wheel_scroll_lines = n;
}
int QApplication::wheelScrollLines()
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index aec21fd..6036196 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -452,6 +452,7 @@ public:
static bool fade_tooltip;
static bool animate_toolbox;
static bool widgetCount; // Coupled with -widgetcount switch
+ static bool load_testability; // Coupled with -testability switch
#ifdef Q_WS_MAC
static bool native_modal_dialog_active;
#endif
diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp
index e9284f7..01c64f1 100644
--- a/src/gui/kernel/qapplication_qws.cpp
+++ b/src/gui/kernel/qapplication_qws.cpp
@@ -110,6 +110,8 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include <qvfbhdr.h>
+
#ifndef QT_NO_QWS_MULTIPROCESS
#ifdef QT_NO_QSHM
#include <sys/ipc.h>
@@ -199,14 +201,9 @@ QString qws_dataDir()
static QString result;
if (!result.isEmpty())
return result;
- QByteArray dataDir;
-#ifdef QT_QWS_TEMP_DIR
- dataDir = QT_QWS_TEMP_DIR;
-#else
- dataDir = "/tmp";
-#endif
- dataDir += "/qtembedded-";
- dataDir += QByteArray::number(qws_display_id);
+ result = QT_VFB_DATADIR(qws_display_id);
+ QByteArray dataDir = result.toLocal8Bit();
+
if (QT_MKDIR(dataDir, 0700)) {
if (errno != EEXIST) {
qFatal("Cannot create Qt for Embedded Linux data directory: %s", dataDir.constData());
@@ -227,16 +224,15 @@ QString qws_dataDir()
if ((buf.st_mode & 0677) != 0600)
qFatal("Qt for Embedded Linux data directory has incorrect permissions: %s", dataDir.constData());
#endif
- dataDir += '/';
- result = QString::fromLocal8Bit(dataDir);
+ result.append("/");
return result;
}
// Get the filename of the pipe Qt for Embedded Linux uses for server/client comms
Q_GUI_EXPORT QString qws_qtePipeFilename()
{
- return (qws_dataDir() + QString::fromLatin1(QTE_PIPE).arg(qws_display_id));
+ return (qws_dataDir().append(QTE_PIPE));
}
static void setMaxWindowRect(const QRect &rect)
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 99d188e..af9fe92 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -91,6 +91,8 @@ extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp
QWidget *qt_button_down = 0; // widget got last button-down
+QSymbianControl *QSymbianControl::lastFocusedControl = 0;
+
QS60Data* qGlobalS60Data()
{
return qt_s60Data();
@@ -320,13 +322,26 @@ QSymbianControl::QSymbianControl(QWidget *w)
{
}
-void QSymbianControl::ConstructL(bool topLevel, bool desktop)
+void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop)
{
if (!desktop)
{
- if (topLevel) {
+ if (isWindowOwning or !qwidget->parentWidget())
CreateWindowL(S60->windowGroup());
- }
+ else
+ /**
+ * TODO: in order to avoid creating windows for all ancestors of
+ * this widget up to the root window, the parameter passed to
+ * CreateWindowL should be
+ * qwidget->parentWidget()->effectiveWinId(). However, if we do
+ * this, then we need to take care of re-parenting when a window
+ * is created for a widget between this one and the root window.
+ */
+ CreateWindowL(qwidget->parentWidget()->winId());
+
+ // Necessary in order to be able to track the activation status of
+ // the control's window
+ qwidget->d_func()->createExtra();
SetFocusing(true);
m_longTapDetector = QLongTapTimer::NewL(this);
@@ -337,6 +352,7 @@ QSymbianControl::~QSymbianControl()
{
if (S60->curWin == this)
S60->curWin = 0;
+ setFocusSafely(false);
S60->appUi()->RemoveFromStack(this);
delete m_longTapDetector;
}
@@ -764,24 +780,31 @@ TCoeInputCapabilities QSymbianControl::InputCapabilities() const
}
#endif
-void QSymbianControl::Draw(const TRect& r) const
+void QSymbianControl::Draw(const TRect& controlRect) const
{
QWindowSurface *surface = qwidget->windowSurface();
- if (!surface)
- return;
+ QPaintEngine *engine = surface ? surface->paintDevice()->paintEngine() : NULL;
- QPaintEngine *engine = surface->paintDevice()->paintEngine();
if (!engine)
return;
+
+ // Map source rectangle into coordinates of the backing store.
+ const QPoint controlBase(controlRect.iTl.iX, controlRect.iTl.iY);
+ const QPoint backingStoreBase = qwidget->mapTo(qwidget->window(), controlBase);
+ const TRect backingStoreRect(TPoint(backingStoreBase.x(), backingStoreBase.y()), controlRect.Size());
+
if (engine->type() == QPaintEngine::Raster) {
QS60WindowSurface *s60Surface = static_cast<QS60WindowSurface *>(qwidget->windowSurface());
CFbsBitmap *bitmap = s60Surface->symbianBitmap();
CWindowGc &gc = SystemGc();
- if (qwidget->d_func()->isOpaque)
- gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
- gc.BitBlt(r.iTl, bitmap, r);
+
+ if(!qwidget->d_func()->extraData()->disableBlit) {
+ if (qwidget->d_func()->isOpaque)
+ gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
+ gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect);
+ }
} else {
- surface->flush(qwidget, QRegion(qt_TRect2QRect(r)), QPoint());
+ surface->flush(qwidget, QRegion(qt_TRect2QRect(backingStoreRect)), QPoint());
}
}
@@ -845,8 +868,23 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
|| (qwidget->windowType() & Qt::Popup) == Qt::Popup)
return;
- QEvent *deferredFocusEvent = new QEvent(QEvent::SymbianDeferredFocusChanged);
- QApplication::postEvent(qwidget, deferredFocusEvent);
+ if (IsFocused() && IsVisible()) {
+ QApplication::setActiveWindow(qwidget->window());
+#ifdef Q_WS_S60
+ // If widget is fullscreen, hide status pane and button container
+ // otherwise show them.
+ CEikStatusPane* statusPane = S60->statusPane();
+ CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer();
+ bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen;
+ if (statusPane && (statusPane->IsVisible() == isFullscreen))
+ statusPane->MakeVisible(!isFullscreen);
+ if (buttonGroup && (buttonGroup->IsVisible() == isFullscreen))
+ buttonGroup->MakeVisible(!isFullscreen);
+#endif
+ } else if (QApplication::activeWindow() == qwidget->window()) {
+ QApplication::setActiveWindow(0);
+ }
+ // else { We don't touch the active window unless we were explicitly activated or deactivated }
}
void QSymbianControl::HandleResourceChange(int resourceType)
@@ -890,6 +928,31 @@ TTypeUid::Ptr QSymbianControl::MopSupplyObject(TTypeUid id)
return CCoeControl::MopSupplyObject(id);
}
+void QSymbianControl::setFocusSafely(bool focus)
+{
+ // The stack hack in here is very unfortunate, but it is the only way to ensure proper
+ // focus in Symbian. If this is not executed, the control which happens to be on
+ // the top of the stack may randomly be assigned focus by Symbian, for example
+ // when creating new windows (specifically in CCoeAppUi::HandleStackChanged()).
+ if (focus) {
+ S60->appUi()->RemoveFromStack(this);
+ // Symbian doesn't automatically remove focus from the last focused control, so we need to
+ // remember it and clear focus ourselves.
+ if (lastFocusedControl && lastFocusedControl != this)
+ lastFocusedControl->SetFocus(false);
+ QT_TRAP_THROWING(S60->appUi()->AddToStackL(this,
+ ECoeStackPriorityDefault + 1, ECoeStackFlagStandard)); // Note the + 1
+ lastFocusedControl = this;
+ this->SetFocus(true);
+ } else {
+ S60->appUi()->RemoveFromStack(this);
+ QT_TRAP_THROWING(S60->appUi()->AddToStackL(this,
+ ECoeStackPriorityDefault, ECoeStackFlagStandard));
+ lastFocusedControl = 0;
+ this->SetFocus(false);
+ }
+}
+
/*!
\typedef QApplication::QS60MainApplicationFactory
@@ -1027,6 +1090,10 @@ void qt_init(QApplicationPrivate * /* priv */, int)
}
#endif
+ QFont systemFont;
+ systemFont.setFamily(systemFont.defaultFamily());
+ QApplicationPrivate::setSystemFont(systemFont);
+
/*
### Commented out for now as parameter handling not needed in SOS(yet). Code below will break testlib with -o flag
int argc = priv->argc;
@@ -1236,14 +1303,14 @@ QWidget * QApplication::topLevelAt(QPoint const& point)
if (widget->geometry().adjusted(0,0,1,1).contains(point)) {
// At this point we know there is a Qt widget under the point.
// Now we need to make sure it is the top most in the z-order.
- RDrawableWindow* rw = widget->d_func()->topData()->rwindow;
- int z = rw->OrdinalPosition();
+ RDrawableWindow *const window = widget->effectiveWinId()->DrawableWindow();
+ int z = window->OrdinalPosition();
if (z < lowestZ) {
lowestZ = z;
found = widget;
}
}
- }
+ }
}
return found;
}
@@ -1457,6 +1524,7 @@ bool QApplication::s60EventFilter(TWsEvent * /* aEvent */)
*/
void QApplication::symbianHandleCommand(int command)
{
+ QScopedLoopLevelCounter counter(d_func()->threadData);
switch (command) {
#ifdef Q_WS_S60
case EAknSoftkeyExit: {
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 6ecd535..44f82b6 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1752,79 +1752,18 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
case APPCOMMAND_BASS_UP:
key = Qt::Key_BassUp;
break;
- case APPCOMMAND_BROWSER_BACKWARD:
- key = Qt::Key_Back;
- break;
- case APPCOMMAND_BROWSER_FAVORITES:
- key = Qt::Key_Favorites;
- break;
- case APPCOMMAND_BROWSER_FORWARD:
- key = Qt::Key_Forward;
- break;
- case APPCOMMAND_BROWSER_HOME:
- key = Qt::Key_HomePage;
- break;
- case APPCOMMAND_BROWSER_REFRESH:
- key = Qt::Key_Refresh;
- break;
- case APPCOMMAND_BROWSER_SEARCH:
- key = Qt::Key_Search;
- break;
- case APPCOMMAND_BROWSER_STOP:
- key = Qt::Key_Stop;
- break;
- case APPCOMMAND_LAUNCH_APP1:
- key = Qt::Key_Launch0;
- break;
- case APPCOMMAND_LAUNCH_APP2:
- key = Qt::Key_Launch1;
- break;
- case APPCOMMAND_LAUNCH_MAIL:
- key = Qt::Key_LaunchMail;
- break;
- case APPCOMMAND_LAUNCH_MEDIA_SELECT:
- key = Qt::Key_LaunchMedia;
- break;
- case APPCOMMAND_MEDIA_NEXTTRACK:
- key = Qt::Key_MediaNext;
- break;
- case APPCOMMAND_MEDIA_PLAY_PAUSE:
- key = Qt::Key_MediaPlay;
- break;
- case APPCOMMAND_MEDIA_PREVIOUSTRACK:
- key = Qt::Key_MediaPrevious;
- break;
- case APPCOMMAND_MEDIA_STOP:
- key = Qt::Key_MediaStop;
- break;
case APPCOMMAND_TREBLE_DOWN:
key = Qt::Key_TrebleDown;
break;
case APPCOMMAND_TREBLE_UP:
key = Qt::Key_TrebleUp;
break;
- case APPCOMMAND_VOLUME_DOWN:
- key = Qt::Key_VolumeDown;
- break;
- case APPCOMMAND_VOLUME_MUTE:
- key = Qt::Key_VolumeMute;
- break;
- case APPCOMMAND_VOLUME_UP:
- key = Qt::Key_VolumeUp;
- break;
- // Commands new in Windows XP
case APPCOMMAND_HELP:
key = Qt::Key_Help;
break;
case APPCOMMAND_FIND:
key = Qt::Key_Search;
break;
- case APPCOMMAND_PRINT:
- key = Qt::Key_Print;
- break;
- case APPCOMMAND_MEDIA_PLAY:
- key = Qt::Key_MediaPlay;
- break;
default:
break;
}
@@ -2028,13 +1967,22 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
// where it got it from; it would simply get a 0 value as the old focus widget.
#ifdef Q_WS_WINCE
{
- if (widget->windowState() & Qt::WindowMinimized) {
- if (widget->windowState() & Qt::WindowMaximized)
- widget->showMaximized();
- else
- widget->show();
+#ifdef Q_WS_WINCE_WM
+ // On Windows mobile we do not receive WM_SYSCOMMAND / SC_MINIMIZE messages.
+ // Thus we have to unset the minimized state explicitly. We must do this for all
+ // top-level widgets, because we get the HWND of a random widget here.
+ foreach (QWidget* tlw, QApplication::topLevelWidgets()) {
+ if (tlw->isMinimized())
+ tlw->setWindowState(tlw->windowState() & ~Qt::WindowMinimized);
}
#else
+ // On Windows CE we do not receive WM_SYSCOMMAND / SC_MINIMIZE messages.
+ // Thus we have to unset the minimized state explicitly.
+ if (widget->windowState() & Qt::WindowMinimized)
+ widget->setWindowState(widget->windowState() & ~Qt::WindowMinimized);
+#endif // Q_WS_WINCE_WM
+
+#else
if (!(widget->windowState() & Qt::WindowMinimized)) {
#endif
// Ignore the activate message send by WindowsXP to a minimized window
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index f482d1c..b1c5fc5 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -789,18 +789,22 @@ extern "C" {
const EventRef carbonEvent = (EventRef)[theEvent eventRef];
const UInt32 carbonEventKind = carbonEvent ? ::GetEventKind(carbonEvent) : 0;
if (carbonEventKind == kEventMouseScroll) {
- // The mouse device containts pixel scroll
- // wheel support (Mighty Mouse, Trackpad)
- deltaX = (int)[theEvent deviceDeltaX] * 120;
- deltaY = (int)[theEvent deviceDeltaY] * 120;
- deltaZ = (int)[theEvent deviceDeltaZ] * 120;
+ // The mouse device containts pixel scroll wheel support (Mighty Mouse, Trackpad).
+ // Since deviceDelta is delivered as pixels rather than degrees, we need to
+ // convert from pixels to degrees in a sensible manner.
+ // It looks like four degrees per pixel behaves most native.
+ // Qt expects the unit for delta to be 1/8 of a degree:
+ const int scrollFactor = 4 * 8;
+ deltaX = (int)[theEvent deviceDeltaX] * scrollFactor;
+ deltaY = (int)[theEvent deviceDeltaY] * scrollFactor;
+ deltaZ = (int)[theEvent deviceDeltaZ] * scrollFactor;
} else { // carbonEventKind == kEventMouseWheelMoved
// Mouse wheel deltas seem to tick in at increments of 0.1.
// Qt widgets expect the delta to be a multiple of 120.
const int scrollFactor = 10 * 120;
- deltaX = [theEvent deltaX] * scrollFactor * qMax(0.6, 1.1 - qAbs([theEvent deltaX]));
- deltaY = [theEvent deltaY] * scrollFactor * qMax(0.6, 1.1 - qAbs([theEvent deltaY]));
- deltaZ = [theEvent deltaZ] * scrollFactor * qMax(0.6, 1.1 - qAbs([theEvent deltaZ]));
+ deltaX = [theEvent deltaX] * scrollFactor;
+ deltaY = [theEvent deltaY] * scrollFactor;
+ deltaZ = [theEvent deltaZ] * scrollFactor;
}
if (deltaX != 0) {
diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp
index 33da0f3..da150fb 100644
--- a/src/gui/kernel/qdnd_x11.cpp
+++ b/src/gui/kernel/qdnd_x11.cpp
@@ -506,6 +506,7 @@ bool QX11Data::xdndMimeDataForAtom(Atom a, QMimeData *mimeData, QByteArray *data
*atomFormat = textprop.encoding;
*dataFormat = textprop.format;
*data = QByteArray((const char *) textprop.value, textprop.nitems * textprop.format / 8);
+ ret = true;
DEBUG(" textprop type %lx\n"
" textprop name '%s'\n"
@@ -541,12 +542,13 @@ bool QX11Data::xdndMimeDataForAtom(Atom a, QMimeData *mimeData, QByteArray *data
dm->xdndMimeTransferedPixmap[dm->xdndMimeTransferedPixmapIndex] = pm;
dm->xdndMimeTransferedPixmapIndex =
(dm->xdndMimeTransferedPixmapIndex + 1) % 2;
+ ret = true;
}
} else {
DEBUG("QClipboard: xdndMimeDataForAtom(): converting to type '%s' is not supported", qPrintable(atomName));
}
}
- return data;
+ return ret && data != 0;
}
//$$$
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index ce64c68..7b9cc9a 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3566,7 +3566,7 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar)
Qt::WA_AcceptTouchEvents attribute set and graphics items need to have the
\l{QGraphicsItem::setAcceptTouchEvents()}{acceptTouchEvents} attribute set to true.
- When using QAbstractScrollArea based widgets, you should enabled the Qt::WA_AcceptTouchEvents
+ When using QAbstractScrollArea based widgets, you should enable the Qt::WA_AcceptTouchEvents
attribute on the scroll area's \l{QAbstractScrollArea::viewport()}{viewport}.
Similarly to QMouseEvent, Qt automatically grabs each touch point on the first press inside a
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index fa2b22f..4396766 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -807,7 +807,7 @@ public:
// internal
inline void setWidget(QWidget *awidget) { _widget = awidget; }
inline void setDeviceType(DeviceType adeviceType) { _deviceType = adeviceType; }
- inline void setTouchPointStates(Qt::TouchPointStates touchPointStates) { _touchPointStates = touchPointStates; }
+ inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; }
inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; }
protected:
diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/gui/kernel/qguifunctions_wince.cpp
index 048780e..58e12ee 100644
--- a/src/gui/kernel/qguifunctions_wince.cpp
+++ b/src/gui/kernel/qguifunctions_wince.cpp
@@ -329,17 +329,14 @@ void qt_wince_maximize(QWidget *widget)
void qt_wince_minimize(HWND hwnd)
{
- uint exstyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
- uint style = GetWindowLongW(hwnd, GWL_STYLE);
- RECT rect;
- RECT crect = {0,0,0,0};
- GetWindowRect(hwnd, &rect);
- AdjustWindowRectEx(&crect, style & ~WS_OVERLAPPED, FALSE, exstyle);
- MoveWindow(hwnd, rect.left - crect.left, rect.top - crect.top, 0, 0, true);
- SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong (hwnd, GWL_EXSTYLE) | WS_EX_NODRAG);
#ifdef Q_OS_WINCE_WM
ShowWindow(hwnd, SW_HIDE);
#else
+ if (!IsWindowVisible(hwnd)) {
+ // Hack for an initial showMinimized.
+ // Without it, our widget doesn't appear in the task bar.
+ ShowWindow(hwnd, SW_SHOW);
+ }
ShowWindow(hwnd, SW_MINIMIZE);
#endif
}
diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp
index 402d88e..10958f3 100644
--- a/src/gui/kernel/qkeymapper_win.cpp
+++ b/src/gui/kernel/qkeymapper_win.cpp
@@ -433,6 +433,23 @@ static const Qt::KeyboardModifiers ModsTbl[] = {
Qt::NoModifier, // Fall-back to raw Key_*
};
+/**
+ Remap return or action key to select key for windows mobile.
+*/
+inline int winceKeyBend(int keyCode)
+{
+#ifdef Q_OS_WINCE_WM
+ // remap return or action key to select key for windows mobile.
+ // will be changed to a table remapping function in the next version (4.6/7).
+ if (keyCode == 13)
+ return Qt::Key_Select;
+ else
+ return KeyTbl[keyCode];
+#else
+ return KeyTbl[keyCode];
+#endif
+}
+
#if defined(Q_OS_WINCE)
// Use the KeyTbl to resolve a Qt::Key out of the virtual keys.
// In case it is not resolvable, continue using the virtual key itself.
@@ -472,7 +489,7 @@ static inline int toKeyOrUnicode(int vk, int scancode, unsigned char *kbdBuffer,
// Qt::Key_*'s are not encoded below 0x20, so try again, and DEL keys (0x7f) is encoded with a
// proper Qt::Key_ code
if (code < 0x20 || code == 0x7f) // Handles res==0 too
- code = KeyTbl[vk];
+ code = winceKeyBend(vk);
if (isDeadkey)
*isDeadkey = (res == -1);
@@ -482,7 +499,7 @@ static inline int toKeyOrUnicode(int vk, int scancode, unsigned char *kbdBuffer,
Q_GUI_EXPORT int qt_translateKeyCode(int vk)
{
- int code = (vk < 0 || vk > 255) ? 0 : KeyTbl[vk];
+ int code = winceKeyBend((vk < 0 || vk > 255) ? 0 : vk);
return code == Qt::Key_unknown ? 0 : code;
}
@@ -689,7 +706,7 @@ void QKeyMapperPrivate::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32
keyLayout[vk_key]->qtKey[7] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x80 : 0;
// Add a fall back key for layouts which don't do composition and show non-latin1 characters
- int fallbackKey = KeyTbl[vk_key];
+ int fallbackKey = winceKeyBend(vk_key);
if (!fallbackKey || fallbackKey == Qt::Key_unknown) {
fallbackKey = 0;
if (vk_key != keyLayout[vk_key]->qtKey[0] && vk_key < 0x5B && vk_key > 0x2F)
@@ -898,7 +915,7 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool
// ..also if we're typing numbers on the keypad, while holding down the Alt modifier.
int code = 0;
if (isNumpad && (nModifiers & AltAny)) {
- code = KeyTbl[msg.wParam];
+ code = winceKeyBend(msg.wParam);
} else if (!isDeadKey) {
unsigned char kbdBuffer[256]; // Will hold the complete keyboard state
GetKeyboardState(kbdBuffer);
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index aec757f..b44ef7f 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -571,7 +571,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
{QKeySequence::Close, 1, Qt::CTRL | Qt::Key_W, QApplicationPrivate::KB_Mac},
{QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, QApplicationPrivate::KB_All},
- {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, QApplicationPrivate::KB_Win},
+ {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_S60},
{QKeySequence::Redo, 0, Qt::CTRL | Qt::Key_Y, QApplicationPrivate::KB_Mac},//different priority from above
{QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, QApplicationPrivate::KB_All},
{QKeySequence::Back, 1, Qt::CTRL | Qt::Key_BracketLeft, QApplicationPrivate::KB_Mac},
@@ -600,7 +600,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QApplicationPrivate::KB_Win},
{QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, QApplicationPrivate::KB_KDE},
{QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_Mac},
- {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
+ {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60},
{QKeySequence::Redo, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Mac}, //different priority from above
{QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
{QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QApplicationPrivate::KB_Mac },//different priority from above
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp
index 91f4163..265f971 100644
--- a/src/gui/kernel/qsoftkeymanager.cpp
+++ b/src/gui/kernel/qsoftkeymanager.cpp
@@ -121,6 +121,7 @@ QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *act
softKeyRole = QAction::PositiveSoftKey;
break;
case CancelSoftKey:
+ default:
softKeyRole = QAction::NegativeSoftKey;
break;
}
@@ -238,7 +239,7 @@ void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &softkeys)
}
if (needsExitButton)
- QT_TRAP_THROWING(nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QObject::tr("Exit"))));
+ QT_TRAP_THROWING(nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QSoftKeyManager::tr("Exit"))));
nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation
}
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 0d48634..d33791b 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -141,7 +141,7 @@ public:
public:
QSymbianControl(QWidget *w);
- void ConstructL(bool topLevel = false, bool desktop = false);
+ void ConstructL(bool isWindowOwning = false, bool desktop = false);
~QSymbianControl();
void HandleResourceChange(int resourceType);
void HandlePointerEventL(const TPointerEvent& aPointerEvent);
@@ -157,6 +157,8 @@ public:
void setIgnoreFocusChanged(bool enabled) { m_ignoreFocusChanged = enabled; }
void CancelLongTapTimer();
+ void setFocusSafely(bool focus);
+
protected:
void Draw(const TRect& aRect) const;
void SizeChanged();
@@ -174,6 +176,9 @@ private:
#endif
private:
+ static QSymbianControl *lastFocusedControl;
+
+private:
QWidget *qwidget;
bool m_ignoreFocusChanged;
QLongTapTimer* m_longTapDetector;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 2397793..0b75b06 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -900,28 +900,30 @@ void QWidget::setAutoFillBackground(bool enabled)
\sa QEvent, QPainter, QGridLayout, QBoxLayout
- \section1 SoftKeys
+ \section1 Softkeys
\since 4.6
- \preliminary
- Softkeys API is a platform independent way of mapping actions to (hardware)keys
- and toolbars provided by the underlying platform.
+ Softkeys are usually physical keys on a device that have a corresponding label or
+ other visual representation on the screen that is generally located next to its
+ physical counterpart. They are most often found on mobile phone platforms. In
+ modern touch based user interfaces it is also possible to have softkeys that do
+ not correspond to any physical keys. Softkeys differ from other onscreen labels
+ in that they are contextual.
- There are three major use cases supported. First one is a mobile device
- with keypad navigation and no touch ui. Second use case is a mobile
- device with touch ui. Third use case is desktop. For now the softkey API is
- only implemented for Series60.
+ In Qt, contextual softkeys are added to a widget by calling addAction() and
+ passing a \c QAction with a softkey role set on it. When the widget
+ containing the softkey actions has focus, its softkeys should appear in
+ the user interface. Softkeys are discovered by traversing the widget
+ heirarchy so it is possible to define a single set of softkeys that are
+ present at all times by calling addAction() for a given top level widget.
- QActions are set to widget(s) via softkey API. Actions in focused widget are
- mapped to native toolbar or hardware keys. Even though the API allows to set
- any amount of widgets there might be physical restrictions to amount of
- softkeys that can be used by the device.
+ On some platforms, this concept overlaps with \c QMenuBar such that if no
+ other softkeys are found and the top level widget is a QMainWindow containing
+ a QMenuBar, the menubar actions may appear on one of the softkeys.
- \e Series60: For series60 menu button is automatically mapped to left
- soft key if there is QMainWindow with QMenuBar in widgets parent hierarchy.
+ Note: Currently softkeys are only supported on the Symbian Platform.
- \sa softKeys()
- \sa setSoftKey()
+ \sa addAction, QAction, QMenuBar
*/
@@ -1175,10 +1177,6 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
if (f & Qt::MSWindowsOwnDC)
q->setAttribute(Qt::WA_NativeWindow);
-#ifdef Q_WS_WINCE
- data.window_state_internal = 0;
-#endif
-
q->setAttribute(Qt::WA_QuitOnClose); // might be cleared in adjustQuitOnCloseAttribute()
adjustQuitOnCloseAttribute();
@@ -8334,12 +8332,6 @@ bool QWidget::event(QEvent *event)
(void) QApplication::sendEvent(this, &mouseEvent);
break;
}
- case QEvent::SymbianDeferredFocusChanged: {
-#ifdef Q_OS_SYMBIAN
- d->handleSymbianDeferredFocusChanged();
-#endif
- break;
- }
#ifndef QT_NO_PROPERTIES
case QEvent::DynamicPropertyChange: {
const QByteArray &propName = static_cast<QDynamicPropertyChangeEvent *>(event)->propertyName();
@@ -11452,6 +11444,10 @@ QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction)
QWidget *targetWidget = 0;
int shortestDistance = INT_MAX;
foreach(QWidget *targetCandidate, QApplication::allWidgets()) {
+
+ if (targetCandidate->focusProxy()) //skip if focus proxy set
+ continue;
+
const QRect targetCandidateRect = targetCandidate->rect().translated(targetCandidate->mapToGlobal(QPoint()));
if ( targetCandidate != sourceWidget
&& targetCandidate->focusPolicy() & Qt::TabFocus
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index 7e250e2..76418af 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -133,9 +133,6 @@ public:
int alloc_region_index;
// int alloc_region_revision;
#endif
-#if defined(Q_WS_WINCE)
- uint window_state_internal : 4;
-#endif
QRect wrect;
};
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 296c5b1..c06ef73 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -169,9 +169,6 @@ struct QTLWExtra {
#ifndef QT_NO_QWS_MANAGER
QWSManager *qwsManager;
#endif
-#elif defined(Q_OS_SYMBIAN) // <--------------------------------------------------------- SYMBIAN
- uint activated : 1; // RWindowBase::Activated has been called
- RDrawableWindow *rwindow;
#endif
};
@@ -224,6 +221,15 @@ struct QWExtra {
QImage maskBits;
CGImageRef imageMask;
#endif
+#elif defined(Q_OS_SYMBIAN) // <----------------------------------------------------- Symbian
+ uint activated : 1; // RWindowBase::Activated has been called
+
+ // If set, QSymbianControl::Draw does not blit this widget
+ // This is to allow, for use cases such as video, widgets which, from the Qt point
+ // of view, are just placeholders in the scene. For these widgets, any necessary
+ // drawing to the UI framebuffer is done by the relevant Symbian subsystem. For
+ // video rendering, this would be an MMF controller, or MDF post-processor.
+ uint disableBlit : 1;
#endif
};
@@ -287,7 +293,8 @@ public:
void setMask_sys(const QRegion &);
#ifdef Q_OS_SYMBIAN
- void handleSymbianDeferredFocusChanged();
+ void setSoftKeys_sys(const QList<QAction*> &softkeys);
+ void activateSymbianWindow();
#endif
void raise_sys();
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 6b5e9b7..3328cee 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -78,14 +78,131 @@ static bool isEqual(const QList<QAction*>& a, const QList<QAction*>& b)
return true;
}
-void QWidgetPrivate::setWSGeometry(bool /* dontShow */, const QRect & /* rect */)
+void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &)
{
+ // Note: based on x11 implementation
+ static const int XCOORD_MAX = 16383;
+ static const int WRECT_MAX = 16383;
+
+ Q_Q(QWidget);
+
+ Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
+
+ /*
+ There are up to four different coordinate systems here:
+ Qt coordinate system for this widget.
+ Symbian coordinate system for this widget (relative to wrect).
+ Qt coordinate system for parent
+ Symbian coordinate system for parent (relative to parent's wrect).
+ */
+
+ QRect validRange(-XCOORD_MAX,-XCOORD_MAX, 2*XCOORD_MAX, 2*XCOORD_MAX);
+ QRect wrectRange(-WRECT_MAX,-WRECT_MAX, 2*WRECT_MAX, 2*WRECT_MAX);
+ QRect wrect;
+ //xrect is the Symbian geometry of my widget. (starts out in parent's Qt coord sys, and ends up in parent's Symbian coord sys)
+ QRect xrect = data.crect;
+
+ const QWidget *const parent = q->parentWidget();
+ QRect parentWRect = parent->data->wrect;
+
+ if (parentWRect.isValid()) {
+ // parent is clipped, and we have to clip to the same limit as parent
+ if (!parentWRect.contains(xrect)) {
+ xrect &= parentWRect;
+ wrect = xrect;
+ //translate from parent's to my Qt coord sys
+ wrect.translate(-data.crect.topLeft());
+ }
+ //translate from parent's Qt coords to parent's X coords
+ xrect.translate(-parentWRect.topLeft());
+
+ } else {
+ // parent is not clipped, we may or may not have to clip
+
+ if (data.wrect.isValid() && QRect(QPoint(),data.crect.size()).contains(data.wrect)) {
+ // This is where the main optimization is: we are already
+ // clipped, and if our clip is still valid, we can just
+ // move our window, and do not need to move or clip
+ // children
+
+ QRect vrect = xrect & parent->rect();
+ vrect.translate(-data.crect.topLeft()); //the part of me that's visible through parent, in my Qt coords
+ if (data.wrect.contains(vrect)) {
+ xrect = data.wrect;
+ xrect.translate(data.crect.topLeft());
+ if (data.winid)
+ data.winid->SetExtent(TPoint(xrect.x(), xrect.y()), TSize(xrect.width(), xrect.height()));
+ return;
+ }
+ }
+
+ if (!validRange.contains(xrect)) {
+ // we are too big, and must clip
+ xrect &=wrectRange;
+ wrect = xrect;
+ wrect.translate(-data.crect.topLeft());
+ //parent's X coord system is equal to parent's Qt coord
+ //sys, so we don't need to map xrect.
+ }
+ }
+
+ // unmap if we are outside the valid window system coord system
+ bool outsideRange = !xrect.isValid();
+ bool mapWindow = false;
+ if (q->testAttribute(Qt::WA_OutsideWSRange) != outsideRange) {
+ q->setAttribute(Qt::WA_OutsideWSRange, outsideRange);
+ if (outsideRange) {
+ if (data.winid)
+ data.winid->DrawableWindow()->SetVisible(EFalse);
+ q->setAttribute(Qt::WA_Mapped, false);
+ } else if (!q->isHidden()) {
+ mapWindow = true;
+ }
+ }
+
+ if (outsideRange)
+ return;
+
+ bool jump = (data.wrect != wrect);
+ data.wrect = wrect;
+
+ // and now recursively for all children...
+ for (int i = 0; i < children.size(); ++i) {
+ QObject *object = children.at(i);
+ if (object->isWidgetType()) {
+ QWidget *w = static_cast<QWidget *>(object);
+ if (!w->isWindow() && w->testAttribute(Qt::WA_WState_Created))
+ w->d_func()->setWSGeometry(jump);
+ }
+ }
+
+ if (data.winid) {
+ // move ourselves to the new position and map (if necessary) after
+ // the movement. Rationale: moving unmapped windows is much faster
+ // than moving mapped windows
+ if (!parent->internalWinId())
+ xrect.translate(parent->mapTo(q->nativeParentWidget(), QPoint(0, 0)));
+
+ data.winid->SetExtent(TPoint(xrect.x(), xrect.y()), TSize(xrect.width(), xrect.height()));
+ }
+
+ if (mapWindow and !dontShow) {
+ q->setAttribute(Qt::WA_Mapped);
+ if (q->internalWinId())
+ q->internalWinId()->DrawableWindow()->SetVisible(ETrue);
+ }
+
+ if (jump && data.winid) {
+ RWindow *const window = static_cast<RWindow *>(data.winid->DrawableWindow());
+ window->Invalidate(TRect(0, 0, wrect.width(), wrect.height()));
+ }
}
void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
{
Q_Q(QWidget);
+
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
if ((q->windowType() == Qt::Desktop))
@@ -129,7 +246,6 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
// put the window in its place and show it
q->internalWinId()->SetRect(TRect(TPoint(x, y), TSize(w, h)));
data.crect.setRect(x, y, w, h);
-
show_sys();
} else {
QRect r = QRect(x, y, w, h);
@@ -251,20 +367,22 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
} else {
stackingFlags = ECoeStackFlagStandard;
}
+ control->MakeVisible(false);
QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags));
+ // Avoid keyboard focus to a hidden window.
+ control->setFocusSafely(false);
- QTLWExtra *topExtra = topData();
- topExtra->rwindow = control->DrawableWindow();
+ RDrawableWindow *const drawableWindow = control->DrawableWindow();
// Request mouse move events.
- topExtra->rwindow->PointerFilter(EPointerFilterEnterExit
+ drawableWindow->PointerFilter(EPointerFilterEnterExit
| EPointerFilterMove | EPointerFilterDrag, 0);
- topExtra->rwindow->EnableVisibilityChangeEvents();
+ drawableWindow->EnableVisibilityChangeEvents();
if (!isOpaque) {
- RWindow *rwindow = static_cast<RWindow*>(topExtra->rwindow);
- TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA);
- if (rwindow->SetTransparencyAlphaChannel() == KErrNone)
- rwindow->SetBackgroundColor(TRgb(255, 255, 255, 0));
+ RWindow *const window = static_cast<RWindow *>(drawableWindow);
+ const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA));
+ if (window->SetTransparencyAlphaChannel() == KErrNone)
+ window->SetBackgroundColor(TRgb(255, 255, 255, 0));
}
}
@@ -284,15 +402,23 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
} else {
stackingFlags = ECoeStackFlagStandard;
}
+ control->MakeVisible(false);
QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags));
-
- WId parentw = parentWidget->effectiveWinId();
- QT_TRAP_THROWING(control->SetContainerWindowL(*parentw));
+ // Avoid keyboard focus to a hidden window.
+ control->setFocusSafely(false);
q->setAttribute(Qt::WA_WState_Created);
int x, y, w, h;
data.crect.getRect(&x, &y, &w, &h);
control->SetRect(TRect(TPoint(x, y), TSize(w, h)));
+
+ RDrawableWindow *const drawableWindow = control->DrawableWindow();
+ // Request mouse move events.
+ drawableWindow->PointerFilter(EPointerFilterEnterExit
+ | EPointerFilterMove | EPointerFilterDrag, 0);
+
+ if (q->isVisible() && q->testAttribute(Qt::WA_Mapped))
+ activateSymbianWindow();
}
if (destroyw) {
@@ -308,7 +434,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
void QWidgetPrivate::show_sys()
{
Q_Q(QWidget);
-
+
if (q->testAttribute(Qt::WA_OutsideWSRange))
return;
@@ -321,34 +447,51 @@ void QWidgetPrivate::show_sys()
return;
}
- if (q->isWindow() && q->internalWinId()) {
+ if (q->internalWinId()) {
+ if (!extra->activated)
+ activateSymbianWindow();
+
+ QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId());
- WId id = q->internalWinId();
- if (!extra->topextra->activated) {
- QT_TRAP_THROWING(id->ActivateL());
- extra->topextra->activated = 1;
- }
id->MakeVisible(true);
- id->SetFocus(true);
+
+ if(q->isWindow())
+ id->setFocusSafely(true);
// Force setting of the icon after window is made visible,
// this is needed even WA_SetWindowIcon is not set, as in that case we need
// to reset to the application level window icon
- setWindowIcon_sys(true);
+ if(q->isWindow())
+ setWindowIcon_sys(true);
}
invalidateBuffer(q->rect());
}
+void QWidgetPrivate::activateSymbianWindow()
+{
+ Q_Q(QWidget);
+
+ Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
+ Q_ASSERT(q->testAttribute(Qt::WA_Mapped));
+ Q_ASSERT(!extra->activated);
+
+ WId id = q->internalWinId();
+ QT_TRAP_THROWING(id->ActivateL());
+ extra->activated = 1;
+}
+
void QWidgetPrivate::hide_sys()
{
Q_Q(QWidget);
+
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
deactivateWidgetCleanup();
- WId id = q->internalWinId();
- if (q->isWindow() && id) {
- if (id->IsFocused()) // Avoid unnecessary calls to FocusChanged()
- id->SetFocus(false);
+ QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId());
+
+ if (id) {
+ if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged()
+ id->setFocusSafely(false);
id->MakeVisible(false);
if (QWidgetBackingStore *bs = maybeBackingStore())
bs->releaseBuffer();
@@ -364,55 +507,26 @@ void QWidgetPrivate::setFocus_sys()
Q_Q(QWidget);
if (q->testAttribute(Qt::WA_WState_Created) && q->window()->windowType() != Qt::Popup)
if (!q->effectiveWinId()->IsFocused()) // Avoid unnecessry calls to FocusChanged()
- q->effectiveWinId()->SetFocus(true);
-}
-
-void QWidgetPrivate::handleSymbianDeferredFocusChanged()
-{
- Q_Q(QWidget);
- WId control = q->internalWinId();
- if (!control) {
- // This could happen if the widget was reparented, while the focuschange
- // was in the event queue.
- return;
- }
-
- if (control->IsFocused()) {
- QApplication::setActiveWindow(q);
-#ifdef Q_WS_S60
- // If widget is fullscreen, hide status pane and button container
- // otherwise show them.
- CEikStatusPane* statusPane = S60->statusPane();
- CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer();
- bool isFullscreen = q->windowState() & Qt::WindowFullScreen;
- if (statusPane && (statusPane->IsVisible() == isFullscreen))
- statusPane->MakeVisible(!isFullscreen);
- if (buttonGroup && (buttonGroup->IsVisible() == isFullscreen))
- buttonGroup->MakeVisible(!isFullscreen);
-#endif
- } else {
- QApplication::setActiveWindow(0);
- }
+ static_cast<QSymbianControl *>(q->effectiveWinId())->setFocusSafely(true);
}
void QWidgetPrivate::raise_sys()
{
Q_Q(QWidget);
+
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- QTLWExtra *tlwExtra = maybeTopData();
- if (q->internalWinId() && tlwExtra) {
- tlwExtra->rwindow->SetOrdinalPosition(0);
- }
+ if (q->internalWinId())
+ q->internalWinId()->DrawableWindow()->SetOrdinalPosition(0);
}
void QWidgetPrivate::lower_sys()
{
Q_Q(QWidget);
+
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- QTLWExtra *tlwExtra = maybeTopData();
- if (q->internalWinId() && tlwExtra) {
- tlwExtra->rwindow->SetOrdinalPosition(-1);
- }
+ if (q->internalWinId())
+ q->internalWinId()->DrawableWindow()->SetOrdinalPosition(-1);
+
if (!q->isWindow())
invalidateBuffer(q->rect());
}
@@ -426,10 +540,13 @@ void QWidgetPrivate::stackUnder_sys(QWidget* w)
{
Q_Q(QWidget);
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- QTLWExtra *tlwExtra = maybeTopData();
- QTLWExtra *tlwExtraSibling = w->d_func()->maybeTopData();
- if (q->internalWinId() && tlwExtra && w->internalWinId() && tlwExtraSibling)
- tlwExtra->rwindow->SetOrdinalPosition(tlwExtraSibling->rwindow->OrdinalPosition() + 1);
+
+ if (q->internalWinId() && w->internalWinId()) {
+ RDrawableWindow *const thisWindow = q->internalWinId()->DrawableWindow();
+ RDrawableWindow *const otherWindow = w->internalWinId()->DrawableWindow();
+ thisWindow->SetOrdinalPosition(otherWindow->OrdinalPosition() + 1);
+ }
+
if (!q->isWindow() || !w->internalWinId())
invalidateBuffer(q->rect());
}
@@ -437,6 +554,7 @@ void QWidgetPrivate::stackUnder_sys(QWidget* w)
void QWidgetPrivate::reparentChildren()
{
Q_Q(QWidget);
+
QObjectList chlist = q->children();
for (int i = 0; i < chlist.size(); ++i) { // reparent children
QObject *obj = chlist.at(i);
@@ -467,6 +585,7 @@ void QWidgetPrivate::reparentChildren()
void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
{
Q_Q(QWidget);
+
bool wasCreated = q->testAttribute(Qt::WA_WState_Created);
if (q->isVisible() && q->parentWidget() && parent != q->parentWidget())
@@ -475,7 +594,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
if (q->testAttribute(Qt::WA_DropSiteRegistered))
q->setAttribute(Qt::WA_DropSiteRegistered, false);
- WId old_winid = wasCreated ? data.winid : 0;
+ QSymbianControl *old_winid = static_cast<QSymbianControl *>(wasCreated ? data.winid : 0);
if ((q->windowType() == Qt::Desktop))
old_winid = 0;
setWinId(0);
@@ -485,7 +604,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
if (wasCreated && old_winid) {
old_winid->MakeVisible(false);
if (old_winid->IsFocused()) // Avoid unnecessary calls to FocusChanged()
- old_winid->SetFocus(false);
+ old_winid->setFocusSafely(false);
old_winid->SetParent(0);
}
@@ -536,17 +655,14 @@ void QWidgetPrivate::s60UpdateIsOpaque()
if ((data.window_flags & Qt::FramelessWindowHint) == 0)
return;
+ RWindow *const window = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow());
+
if (!isOpaque) {
- QTLWExtra *topExtra = topData();
- RWindow *rwindow = static_cast<RWindow*>(topExtra->rwindow);
- TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA);
- if (rwindow->SetTransparencyAlphaChannel() == KErrNone)
- rwindow->SetBackgroundColor(TRgb(255, 255, 255, 0));
- } else {
- QTLWExtra *topExtra = topData();
- RWindow *rwindow = static_cast<RWindow*>(topExtra->rwindow);
- rwindow->SetTransparentRegion(TRegionFix<1>());
- }
+ const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA));
+ if (window->SetTransparencyAlphaChannel() == KErrNone)
+ window->SetBackgroundColor(TRgb(255, 255, 255, 0));
+ } else
+ window->SetTransparentRegion(TRegionFix<1>());
}
CFbsBitmap* qt_pixmapToNativeBitmap(QPixmap pixmap, bool invert)
@@ -722,8 +838,8 @@ void QWidgetPrivate::scroll_sys(int dx, int dy)
scrollRect(q->rect(), dx, dy);
} else {
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- RDrawableWindow* rw = topData()->rwindow;
- rw->Scroll(TPoint(dx, dy));
+ RDrawableWindow *const window = q->internalWinId()->DrawableWindow();
+ window->Scroll(TPoint(dx, dy));
}
}
@@ -735,8 +851,8 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r)
scrollRect(r, dx, dy);
} else {
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- RDrawableWindow* rw = topData()->rwindow;
- rw->Scroll(TPoint(dx, dy), qt_QRect2TRect(r));
+ RDrawableWindow *const window = q->internalWinId()->DrawableWindow();
+ window->Scroll(TPoint(dx, dy), qt_QRect2TRect(r));
}
}
@@ -768,8 +884,6 @@ void QWidgetPrivate::registerDropSite(bool /* on */)
void QWidgetPrivate::createTLSysExtra()
{
extra->topextra->backingStore = 0;
- extra->topextra->activated = 0;
- extra->topextra->rwindow = 0;
}
void QWidgetPrivate::deleteTLSysExtra()
@@ -780,7 +894,8 @@ void QWidgetPrivate::deleteTLSysExtra()
void QWidgetPrivate::createSysExtra()
{
-
+ extra->activated = 0;
+ extra->disableBlit = 0;
}
void QWidgetPrivate::deleteSysExtra()
@@ -903,9 +1018,10 @@ QPoint QWidget::mapToGlobal(const QPoint &pos) const
return pos + tp;
}
- // This is the native window case. Consider using CCoeControl::PositionRelativeToScreen()
- // if we decide to go with CCoeControl
- return QPoint();
+ // Native window case
+ const TPoint widgetScreenOffset = internalWinId()->PositionRelativeToScreen();
+ const QPoint globalPos = QPoint(widgetScreenOffset.iX, widgetScreenOffset.iY) + pos;
+ return globalPos;
}
QPoint QWidget::mapFromGlobal(const QPoint &pos) const
@@ -919,13 +1035,16 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const
return pos - tp;
}
- // ### TODO native window
- return QPoint();
+ // Native window case
+ const TPoint widgetScreenOffset = internalWinId()->PositionRelativeToScreen();
+ const QPoint widgetPos = pos - QPoint(widgetScreenOffset.iX, widgetScreenOffset.iY);
+ return widgetPos;
}
void QWidget::setWindowState(Qt::WindowStates newstate)
{
Q_D(QWidget);
+
Qt::WindowStates oldstate = windowState();
if (oldstate == newstate)
return;
@@ -1002,17 +1121,17 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
if ((oldstate & Qt::WindowMinimized) != (newstate & Qt::WindowMinimized)) {
if (newstate & Qt::WindowMinimized) {
if (isVisible()) {
- WId id = effectiveWinId();
+ QSymbianControl *id = static_cast<QSymbianControl *>(effectiveWinId());
if (id->IsFocused()) // Avoid unnecessary calls to FocusChanged()
- id->SetFocus(false);
+ id->setFocusSafely(false);
id->MakeVisible(false);
}
} else {
if (isVisible()) {
- WId id = effectiveWinId();
+ QSymbianControl *id = static_cast<QSymbianControl *>(effectiveWinId());
id->MakeVisible(true);
if (!id->IsFocused()) // Avoid unnecessary calls to FocusChanged()
- id->SetFocus(true);
+ id->setFocusSafely(true);
}
const QRect normalGeometry = geometry();
const QRect r = top->normalGeometry;
@@ -1039,7 +1158,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
if (!isWindow() && parentWidget())
parentWidget()->d_func()->invalidateBuffer(geometry());
d->deactivateWidgetCleanup();
- WId id = internalWinId();
+ QSymbianControl *id = static_cast<QSymbianControl *>(internalWinId());
if (testAttribute(Qt::WA_WState_Created)) {
#ifndef QT_NO_IM
@@ -1067,7 +1186,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
}
if (destroyWindow && !(windowType() == Qt::Desktop) && id) {
if (id->IsFocused()) // Avoid unnecessry calls to FocusChanged()
- id->SetFocus(false);
+ id->setFocusSafely(false);
id->ControlEnv()->AppUi()->RemoveFromStack(id);
// Hack to activate window under destroyed one. With this activation
@@ -1173,11 +1292,12 @@ void QWidget::releaseMouse()
void QWidget::activateWindow()
{
Q_D(QWidget);
+
QWidget *tlw = window();
if (tlw->isVisible()) {
window()->createWinId();
- WId id = tlw->internalWinId();
- id->SetFocus(true);
+ QSymbianControl *id = static_cast<QSymbianControl *>(tlw->internalWinId());
+ id->setFocusSafely(true);
}
}
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index c705e2a..a0982f4 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -1402,7 +1402,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
SetWindowPlacement(q->internalWinId(), &wndpl);
} else {
#else
- if (data.window_state_internal & Qt::WindowMaximized) {
+ if (data.window_state & Qt::WindowMaximized) {
qt_wince_maximize(q);
} else {
#endif
diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp
index 32e8e7f..4a0d30c 100644
--- a/src/gui/kernel/qwidget_wince.cpp
+++ b/src/gui/kernel/qwidget_wince.cpp
@@ -416,6 +416,10 @@ void QWidgetPrivate::show_sys() {
SetWindowLong(q->internalWinId(), GWL_STYLE, style | WS_MAXIMIZEBOX);
}
} else
+#else
+ // Imitate minimizing on Windows mobile by hiding the widget.
+ if (q->isMinimized())
+ sm = SW_HIDE;
#endif
if (q->isHidden()) {
sm = SW_HIDE;
@@ -428,8 +432,7 @@ void QWidgetPrivate::show_sys() {
sm = SW_SHOWNOACTIVATE;
}
- if (!(data.window_state & Qt::WindowMinimized))
- ShowWindow(q->internalWinId(), sm);
+ ShowWindow(q->internalWinId(), sm);
if (q->isMaximized() && q->isWindow())
qt_wince_maximize(q);
@@ -438,7 +441,7 @@ void QWidgetPrivate::show_sys() {
if (!qt_wince_is_mobile() && q->isFullScreen()) {
HWND handle = FindWindow(L"HHTaskBar", L"");
if (handle) {
- ShowWindow(handle, 0);
+ ShowWindow(handle, SW_HIDE);
EnableWindow(handle, false);
}
}
@@ -468,21 +471,15 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
return;
int max = SW_SHOWNORMAL;
- int min = SW_SHOWNOACTIVATE;
-
int normal = SW_SHOWNOACTIVATE;
if ((oldstate & Qt::WindowMinimized) && !(newstate & Qt::WindowMinimized))
newstate |= Qt::WindowActive;
- if (newstate & Qt::WindowActive) {
- max = SW_SHOWNORMAL;
- min = SW_SHOWNORMAL;
+ if (newstate & Qt::WindowActive)
normal = SW_SHOWNORMAL;
- }
if (isWindow()) {
createWinId();
Q_ASSERT(testAttribute(Qt::WA_WState_Created));
- data->window_state_internal = newstate;
// Ensure the initial size is valid, since we store it as normalGeometry below.
if ((!testAttribute(Qt::WA_Resized) && !isVisible()))
adjustSize();
@@ -556,13 +553,11 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
}
}
if ((oldstate & Qt::WindowMinimized) != (newstate & Qt::WindowMinimized)) {
- if (isVisible()) {
- ShowWindow(internalWinId(), (newstate & Qt::WindowMinimized) ? min :
- (newstate & Qt::WindowMaximized) ? max : normal);
- if (newstate & Qt::WindowMaximized)
- qt_wince_maximize(this);
if (newstate & Qt::WindowMinimized)
qt_wince_minimize(internalWinId());
+ else if (newstate & Qt::WindowMaximized) {
+ ShowWindow(internalWinId(), max);
+ qt_wince_maximize(this);
}
}
if ((newstate & Qt::WindowMaximized) && !(newstate & Qt::WindowFullScreen)) {
@@ -577,7 +572,6 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
}
}
data->window_state = newstate;
- data->window_state_internal = newstate;
QWindowStateChangeEvent e(oldstate);
QApplication::sendEvent(this, &e);
}
@@ -588,7 +582,7 @@ void QWidgetPrivate::deleteSysExtra()
if (!qt_wince_is_mobile() && q->isFullScreen()) {
HWND handle = FindWindow(L"HHTaskBar", L"");
if (handle) {
- ShowWindow(handle, 1);
+ ShowWindow(handle, SW_SHOWNORMAL);
EnableWindow(handle, true);
}
}
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index cfa3f2a..b32e00a 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -228,14 +228,14 @@ Q_INLINE_TEMPLATE QMatrix4x4::QMatrix4x4
(const QGenericMatrix<N, M, qreal>& matrix)
{
const qreal *values = matrix.constData();
- for (int col = 0; col < 4; ++col) {
- for (int row = 0; row < 4; ++row) {
- if (col < N && row < M)
- m[col][row] = values[col * M + row];
- else if (col == row)
- m[col][row] = 1.0f;
+ for (int matrixCol = 0; matrixCol < 4; ++matrixCol) {
+ for (int matrixRow = 0; matrixRow < 4; ++matrixRow) {
+ if (matrixCol < N && matrixRow < M)
+ m[matrixCol][matrixRow] = values[matrixCol * M + matrixRow];
+ else if (matrixCol == matrixRow)
+ m[matrixCol][matrixRow] = 1.0f;
else
- m[col][row] = 0.0f;
+ m[matrixCol][matrixRow] = 0.0f;
}
}
flagBits = General;
@@ -246,14 +246,14 @@ QGenericMatrix<N, M, qreal> QMatrix4x4::toGenericMatrix() const
{
QGenericMatrix<N, M, qreal> result;
qreal *values = result.data();
- for (int col = 0; col < N; ++col) {
- for (int row = 0; row < M; ++row) {
- if (col < 4 && row < 4)
- values[col * M + row] = m[col][row];
- else if (col == row)
- values[col * M + row] = 1.0f;
+ for (int matrixCol = 0; matrixCol < N; ++matrixCol) {
+ for (int matrixRow = 0; matrixRow < M; ++matrixRow) {
+ if (matrixCol < 4 && matrixRow < 4)
+ values[matrixCol * M + matrixRow] = m[matrixCol][matrixRow];
+ else if (matrixCol == matrixRow)
+ values[matrixCol * M + matrixRow] = 1.0f;
else
- values[col * M + row] = 0.0f;
+ values[matrixCol * M + matrixRow] = 0.0f;
}
}
return result;
@@ -261,17 +261,17 @@ QGenericMatrix<N, M, qreal> QMatrix4x4::toGenericMatrix() const
#endif
-inline const qreal& QMatrix4x4::operator()(int row, int column) const
+inline const qreal& QMatrix4x4::operator()(int aRow, int aColumn) const
{
- Q_ASSERT(row >= 0 && row < 4 && column >= 0 && column < 4);
- return m[column][row];
+ Q_ASSERT(aRow >= 0 && aRow < 4 && aColumn >= 0 && aColumn < 4);
+ return m[aColumn][aRow];
}
-inline qreal& QMatrix4x4::operator()(int row, int column)
+inline qreal& QMatrix4x4::operator()(int aRow, int aColumn)
{
- Q_ASSERT(row >= 0 && row < 4 && column >= 0 && column < 4);
+ Q_ASSERT(aRow >= 0 && aRow < 4 && aColumn >= 0 && aColumn < 4);
flagBits = General;
- return m[column][row];
+ return m[aColumn][aRow];
}
inline QVector4D QMatrix4x4::column(int index) const
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index dd5dddc..7480a5c 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -138,7 +138,7 @@ private:
inline QQuaternion::QQuaternion() : wp(1.0f), xp(0.0f), yp(0.0f), zp(0.0f) {}
-inline QQuaternion::QQuaternion(qreal scalar, qreal xpos, qreal ypos, qreal zpos) : wp(scalar), xp(xpos), yp(ypos), zp(zpos) {}
+inline QQuaternion::QQuaternion(qreal aScalar, qreal xpos, qreal ypos, qreal zpos) : wp(aScalar), xp(xpos), yp(ypos), zp(zpos) {}
inline bool QQuaternion::isNull() const
@@ -156,10 +156,10 @@ inline qreal QQuaternion::y() const { return qreal(yp); }
inline qreal QQuaternion::z() const { return qreal(zp); }
inline qreal QQuaternion::scalar() const { return qreal(wp); }
-inline void QQuaternion::setX(qreal x) { xp = x; }
-inline void QQuaternion::setY(qreal y) { yp = y; }
-inline void QQuaternion::setZ(qreal z) { zp = z; }
-inline void QQuaternion::setScalar(qreal scalar) { wp = scalar; }
+inline void QQuaternion::setX(qreal aX) { xp = aX; }
+inline void QQuaternion::setY(qreal aY) { yp = aY; }
+inline void QQuaternion::setZ(qreal aZ) { zp = aZ; }
+inline void QQuaternion::setScalar(qreal aScalar) { wp = aScalar; }
inline QQuaternion QQuaternion::conjugate() const
{
@@ -274,14 +274,14 @@ inline bool qFuzzyCompare(const QQuaternion& q1, const QQuaternion& q2)
#ifndef QT_NO_VECTOR3D
-inline QQuaternion::QQuaternion(qreal scalar, const QVector3D& vector)
- : wp(scalar), xp(vector.x()), yp(vector.y()), zp(vector.z()) {}
+inline QQuaternion::QQuaternion(qreal aScalar, const QVector3D& aVector)
+ : wp(aScalar), xp(aVector.x()), yp(aVector.y()), zp(aVector.z()) {}
-inline void QQuaternion::setVector(const QVector3D& vector)
+inline void QQuaternion::setVector(const QVector3D& aVector)
{
- xp = vector.x();
- yp = vector.y();
- zp = vector.z();
+ xp = aVector.x();
+ yp = aVector.y();
+ zp = aVector.z();
}
inline QVector3D QQuaternion::vector() const
@@ -291,17 +291,17 @@ inline QVector3D QQuaternion::vector() const
#endif
-inline void QQuaternion::setVector(qreal x, qreal y, qreal z)
+inline void QQuaternion::setVector(qreal aX, qreal aY, qreal aZ)
{
- xp = x;
- yp = y;
- zp = z;
+ xp = aX;
+ yp = aY;
+ zp = aZ;
}
#ifndef QT_NO_VECTOR4D
-inline QQuaternion::QQuaternion(const QVector4D& vector)
- : wp(vector.w()), xp(vector.x()), yp(vector.y()), zp(vector.z()) {}
+inline QQuaternion::QQuaternion(const QVector4D& aVector)
+ : wp(aVector.w()), xp(aVector.x()), yp(aVector.y()), zp(aVector.z()) {}
inline QVector4D QQuaternion::toVector4D() const
{
diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h
index 570e864..cd9a12c 100644
--- a/src/gui/math3d/qvector2d.h
+++ b/src/gui/math3d/qvector2d.h
@@ -144,8 +144,8 @@ inline bool QVector2D::isNull() const
inline qreal QVector2D::x() const { return qreal(xp); }
inline qreal QVector2D::y() const { return qreal(yp); }
-inline void QVector2D::setX(qreal x) { xp = x; }
-inline void QVector2D::setY(qreal y) { yp = y; }
+inline void QVector2D::setX(qreal aX) { xp = aX; }
+inline void QVector2D::setY(qreal aY) { yp = aY; }
inline QVector2D &QVector2D::operator+=(const QVector2D &vector)
{
diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h
index 1291c96..60bd693 100644
--- a/src/gui/math3d/qvector3d.h
+++ b/src/gui/math3d/qvector3d.h
@@ -160,9 +160,9 @@ inline qreal QVector3D::x() const { return qreal(xp); }
inline qreal QVector3D::y() const { return qreal(yp); }
inline qreal QVector3D::z() const { return qreal(zp); }
-inline void QVector3D::setX(qreal x) { xp = x; }
-inline void QVector3D::setY(qreal y) { yp = y; }
-inline void QVector3D::setZ(qreal z) { zp = z; }
+inline void QVector3D::setX(qreal aX) { xp = aX; }
+inline void QVector3D::setY(qreal aY) { yp = aY; }
+inline void QVector3D::setZ(qreal aZ) { zp = aZ; }
inline QVector3D &QVector3D::operator+=(const QVector3D &vector)
{
diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h
index ad0718a..c35b536 100644
--- a/src/gui/math3d/qvector4d.h
+++ b/src/gui/math3d/qvector4d.h
@@ -158,10 +158,10 @@ inline qreal QVector4D::y() const { return qreal(yp); }
inline qreal QVector4D::z() const { return qreal(zp); }
inline qreal QVector4D::w() const { return qreal(wp); }
-inline void QVector4D::setX(qreal x) { xp = x; }
-inline void QVector4D::setY(qreal y) { yp = y; }
-inline void QVector4D::setZ(qreal z) { zp = z; }
-inline void QVector4D::setW(qreal w) { wp = w; }
+inline void QVector4D::setX(qreal aX) { xp = aX; }
+inline void QVector4D::setY(qreal aY) { yp = aY; }
+inline void QVector4D::setZ(qreal aZ) { zp = aZ; }
+inline void QVector4D::setW(qreal aW) { wp = aW; }
inline QVector4D &QVector4D::operator+=(const QVector4D &vector)
{
diff --git a/src/gui/s60framework/qs60mainapplication.h b/src/gui/s60framework/qs60mainapplication.h
index 457764c..5f621e0 100644
--- a/src/gui/s60framework/qs60mainapplication.h
+++ b/src/gui/s60framework/qs60mainapplication.h
@@ -42,7 +42,7 @@
#ifndef QS60MAINAPPLICATION_H
#define QS60MAINAPPLICATION_H
-#include <qglobal.h>
+#include <QtCore/qglobal.h>
#ifdef Q_WS_S60
diff --git a/src/gui/s60framework/qs60mainappui.h b/src/gui/s60framework/qs60mainappui.h
index c2c6ef2..321d8d6 100644
--- a/src/gui/s60framework/qs60mainappui.h
+++ b/src/gui/s60framework/qs60mainappui.h
@@ -42,7 +42,7 @@
#ifndef QS60MAINAPPUI_H
#define QS60MAINAPPUI_H
-#include <qglobal.h>
+#include <QtCore/qglobal.h>
#ifdef Q_WS_S60
diff --git a/src/gui/s60framework/qs60maindocument.h b/src/gui/s60framework/qs60maindocument.h
index 366d311..1327349 100644
--- a/src/gui/s60framework/qs60maindocument.h
+++ b/src/gui/s60framework/qs60maindocument.h
@@ -42,7 +42,7 @@
#ifndef QS60MAINDOCUMENT_H
#define QS60MAINDOCUMENT_H
-#include <qglobal.h>
+#include <QtCore/qglobal.h>
#ifdef Q_WS_S60
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 1e57167..6bdb79e 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -2397,8 +2397,6 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
// lets use spinbox frame here as well, as no combobox specific value available.
const int frameThickness = cmb->frame ? pixelMetric(PM_SpinBoxFrameWidth, cmb, widget) : 0;
const int buttonWidth = QS60StylePrivate::pixelMetric(QStyle::PM_ButtonIconSize);
- const int xposMod = (cmb->rect.x()) + width - buttonMargin - buttonWidth;
- const int ypos = cmb->rect.y();
QSize buttonSize;
buttonSize.setHeight(qMax(8, (cmb->rect.height()>>1) - frameThickness)); //minimum of 8 pixels
@@ -2406,15 +2404,18 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
buttonSize = buttonSize.expandedTo(QApplication::globalStrut());
switch (scontrol) {
case SC_ComboBoxArrow:
- ret.setRect(xposMod, ypos + buttonMargin, buttonWidth, height - 2*buttonMargin);
+ ret.setRect(
+ ret.x() + ret.width() - buttonMargin - buttonWidth,
+ ret.y() + buttonMargin,
+ buttonWidth,
+ height - 2*buttonMargin);
break;
case SC_ComboBoxEditField: {
- const int withFrameX = cmb->rect.x() + cmb->rect.width() - frameThickness - buttonSize.width();
- ret = QRect(
- frameThickness,
- frameThickness,
- withFrameX - frameThickness,
- cmb->rect.height() - 2*frameThickness);
+ ret.setRect(
+ ret.x() + frameThickness,
+ ret.y() + frameThickness,
+ ret.width() - 2*frameThickness - buttonSize.width(),
+ ret.height() - 2*frameThickness);
}
break;
default:
diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h
index fd18bc3..6be3197 100644
--- a/src/gui/styles/qs60style.h
+++ b/src/gui/styles/qs60style.h
@@ -76,6 +76,9 @@ public:
void unpolish(QWidget *widget);
void polish(QApplication *application);
void unpolish(QApplication *application);
+#ifndef Q_NO_USING_KEYWORD
+ using QCommonStyle::polish;
+#endif
void setStyleProperty(const char *name, const QVariant &value);
QVariant styleProperty(const char *name) const;
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index 131d8bc..cde48d8 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -635,8 +635,18 @@ bool QS60StylePrivate::isToolBarBackground()
QPoint qt_s60_fill_background_offset(const QWidget *targetWidget)
{
CCoeControl *control = targetWidget->effectiveWinId();
- TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0);
- return QPoint(globalPos.iX, globalPos.iY);
+ TPoint pos(0,0);
+ if (control) {
+ // FIXME properly: S60 3.1 has a bug that CCoeControl::PositionRelativeToScreen sometimes
+ // freezes the device, possibly in cases where we run out of memory.
+ // We use CCoeControl::Position instead in S60 3.1, which returns same values
+ // in most cases.
+ if (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1)
+ pos = control->Position();
+ else
+ pos = control->PositionRelativeToScreen();
+ }
+ return QPoint(pos.iX, pos.iY);
}
QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(
@@ -1137,11 +1147,11 @@ QPixmap QS60StylePrivate::part(QS60StyleEnums::SkinParts part,
const QSize &size, SkinElementFlags flags)
{
QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
-
+
QPixmap result = (flags & SF_ColorSkinned)?
QS60StyleModeSpecifics::colorSkinnedGraphics(part, size, flags)
: QS60StyleModeSpecifics::skinnedGraphics(part, size, flags);
-
+
lock.relock();
if (flags & SF_StateDisabled && !QS60StyleModeSpecifics::disabledPartGraphic(part)) {
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp
index b062a3f..6cb8b40 100644
--- a/src/gui/styles/qwindowsvistastyle.cpp
+++ b/src/gui/styles/qwindowsvistastyle.cpp
@@ -731,14 +731,11 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
{
const QStyleOptionViewItemV4 *vopt;
const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget);
- bool newStyle = false;
+ bool newStyle = true;
+
+ if (qobject_cast<const QTableView*>(widget))
+ newStyle = false;
- if (const QListView *listview = qobject_cast<const QListView *>(widget)) {
- if (listview->viewMode() == QListView::IconMode)
- newStyle = true;
- } else if (qobject_cast<const QTreeView *>(widget)) {
- newStyle = true;
- }
if (newStyle && view && (vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))) {
bool selected = vopt->state & QStyle::State_Selected;
bool hover = vopt->state & QStyle::State_MouseOver;
@@ -1496,14 +1493,11 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
{
const QStyleOptionViewItemV4 *vopt;
const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget);
- bool newStyle = false;
+ bool newStyle = true;
+
+ if (qobject_cast<const QTableView*>(widget))
+ newStyle = false;
- if (const QListView *listview = qobject_cast<const QListView *>(widget)) {
- if (listview->viewMode() == QListView::IconMode)
- newStyle = true;
- } else if (qobject_cast<const QTreeView *>(widget)) {
- newStyle = true;
- }
if (newStyle && view && (vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))) {
/*
// We cannot currently get the correct selection color for "explorer style" views
diff --git a/src/gui/styles/qwindowsvistastyle_p.h b/src/gui/styles/qwindowsvistastyle_p.h
index d4170aa..e9bbb77 100644
--- a/src/gui/styles/qwindowsvistastyle_p.h
+++ b/src/gui/styles/qwindowsvistastyle_p.h
@@ -84,6 +84,7 @@
#include <qinputdialog.h>
#include <qtreeview.h>
#include <qlistview.h>
+#include <qtableview.h>
#include <qbasictimer.h>
#include <qcommandlinkbutton.h>
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index ef91983..d73e1c4 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -309,6 +309,7 @@ private:
friend class QPicturePaintEngine;
friend class QPainterReplayer;
friend class QPaintBufferEngine;
+ friend class QCommandLinkButtonPrivate;
#ifndef QT_NO_DATASTREAM
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QFont &);
diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp
index 996e471..ef3f2ae 100644
--- a/src/gui/text/qfontengine_qpf.cpp
+++ b/src/gui/text/qfontengine_qpf.cpp
@@ -628,13 +628,13 @@ QImage QFontEngineQPF::alphaMapForGlyph(glyph_t g)
{
const Glyph *glyph = findGlyph(g);
if (!glyph)
- QImage();
+ return QImage();
const uchar *bits = ((const uchar *) glyph) + sizeof(Glyph);
QImage image(glyph->width, glyph->height, QImage::Format_Indexed8);
for (int j=0; j<256; ++j)
- image.setColor(j, 0xff000000 | j | (j<<8) | (j<<16));
+ image.setColor(j, qRgba(0, 0, 0, j));
for (int i=0; i<glyph->height; ++i) {
memcpy(image.scanLine(i), bits, glyph->bytesPerLine);
diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp
index 888e1be..de8028c 100644
--- a/src/gui/text/qfontengine_qws.cpp
+++ b/src/gui/text/qfontengine_qws.cpp
@@ -528,10 +528,12 @@ QImage QFontEngineQPF1::alphaMapForGlyph(glyph_t g)
QImage image;
if (mono) {
image = QImage((glyph->metrics->width+7)&~7, glyph->metrics->height, QImage::Format_Mono);
+ image.setColor(0, qRgba(0, 0, 0, 0));
+ image.setColor(1, qRgba(0, 0, 0, 255));
} else {
image = QImage(glyph->metrics->width, glyph->metrics->height, QImage::Format_Indexed8);
for (int j=0; j<256; ++j)
- image.setColor(j, 0xff000000 | j | (j<<8) | (j<<16));
+ image.setColor(j, qRgba(0, 0, 0, j));
}
for (int i=0; i<glyph->metrics->height; ++i) {
memcpy(image.scanLine(i), bits, glyph->metrics->linestep);
diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp
index a50c105..c3289b4 100644
--- a/src/gui/widgets/qabstractslider.cpp
+++ b/src/gui/widgets/qabstractslider.cpp
@@ -215,7 +215,8 @@ QT_BEGIN_NAMESPACE
QAbstractSliderPrivate::QAbstractSliderPrivate()
: minimum(0), maximum(99), singleStep(1), pageStep(10),
- value(0), position(0), pressValue(-1), tracking(true), blocktracking(false), pressed(false),
+ value(0), position(0), pressValue(-1), offset_accumulated(0), tracking(true),
+ blocktracking(false), pressed(false),
invertedAppearance(false), invertedControls(false),
orientation(Qt::Horizontal), repeatAction(QAbstractSlider::SliderNoAction)
{
@@ -691,38 +692,30 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e)
e->ignore();
if (e->orientation() != d->orientation && !rect().contains(e->pos()))
return;
- static qreal offset = 0;
- static QAbstractSlider *offset_owner = 0;
- if (offset_owner != this){
- offset_owner = this;
- offset = 0;
- }
- // On Mac/Cocoa, always scroll one step. The mouse wheel acceleration
- // is higher than on other systems, so this works well in practice.
-#ifdef QT_MAC_USE_COCOA
- int step = 1;
-#else
int step = qMin(QApplication::wheelScrollLines() * d->singleStep, d->pageStep);
-#endif
if ((e->modifiers() & Qt::ControlModifier) || (e->modifiers() & Qt::ShiftModifier))
step = d->pageStep;
- int currentOffset = qRound(qreal(e->delta()) * step / 120);
- if (currentOffset == 0)
- currentOffset = (e->delta() < 0 ? -1 : 1);
- offset += currentOffset;
- if (d->invertedControls)
- offset = -offset;
+ qreal currentOffset = qreal(e->delta()) * step / 120;
+ d->offset_accumulated += d->invertedControls ? -currentOffset : currentOffset;
- int prevValue = d->value;
- d->position = d->overflowSafeAdd(int(offset)); // value will be updated by triggerAction()
+ if (int(d->offset_accumulated) == 0) {
+ // QAbstractSlider works on integer values. So if the accumulated
+ // offset is less than +/- 1, we need to wait until we get more
+ // wheel events (this means that the wheel resolution is higher than
+ // 15 degrees, e.g. when using mac mighty mouse/trackpad):
+ return;
+ }
+ int prevValue = d->value;
+ d->position = d->overflowSafeAdd(int(d->offset_accumulated)); // value will be updated by triggerAction()
triggerAction(SliderMove);
+
if (prevValue == d->value) {
- offset = 0;
+ d->offset_accumulated = 0;
} else {
- offset -= int(offset);
+ d->offset_accumulated -= int(d->offset_accumulated);
e->accept();
}
}
diff --git a/src/gui/widgets/qabstractslider_p.h b/src/gui/widgets/qabstractslider_p.h
index 071b8df..9324d44 100644
--- a/src/gui/widgets/qabstractslider_p.h
+++ b/src/gui/widgets/qabstractslider_p.h
@@ -69,6 +69,7 @@ public:
void setSteps(int single, int page);
int minimum, maximum, singleStep, pageStep, value, position, pressValue;
+ float offset_accumulated;
uint tracking : 1;
uint blocktracking :1;
uint pressed : 1;
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 61532b9..95ff4c1 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -403,8 +403,8 @@ QComboBoxPrivateContainer::QComboBoxPrivateContainer(QAbstractItemView *itemView
layout->setMargin(0);
#ifdef QT_SOFTKEYS_ENABLED
- selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, itemView);
- cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Escape, itemView);
+ selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, this);
+ cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Escape, this);
addAction(selectAction);
addAction(cancelAction);
#endif
@@ -534,6 +534,7 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView)
this, SLOT(setCurrentIndex(QModelIndex)));
disconnect(view, SIGNAL(destroyed()),
this, SLOT(viewDestroyed()));
+
delete view;
view = 0;
}
@@ -571,11 +572,6 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView)
this, SLOT(setCurrentIndex(QModelIndex)));
connect(view, SIGNAL(destroyed()),
this, SLOT(viewDestroyed()));
-
-#ifdef QT_SOFTKEYS_ENABLED
- selectAction->setParent(itemView);
- cancelAction->setParent(itemView);
-#endif
}
/*!
diff --git a/src/gui/widgets/qcommandlinkbutton.cpp b/src/gui/widgets/qcommandlinkbutton.cpp
index e64f687..9adf280 100644
--- a/src/gui/widgets/qcommandlinkbutton.cpp
+++ b/src/gui/widgets/qcommandlinkbutton.cpp
@@ -140,23 +140,34 @@ QFont QCommandLinkButtonPrivate::titleFont() const
Q_Q(const QCommandLinkButton);
QFont font = q->font();
if (usingVistaStyle()) {
- if (!q->testAttribute(Qt::WA_SetFont))
- font.setPointSizeF(12.0);
+ font.setPointSizeF(12.0);
} else {
font.setBold(true);
- if (!q->testAttribute(Qt::WA_SetFont))
- font.setPointSizeF(9.0);
+ font.setPointSizeF(9.0);
}
- return font;
+
+ // Note the font will be resolved against
+ // QPainters font, so we need to restore the mask
+ int resolve_mask = font.resolve_mask;
+ QFont modifiedFont = q->font().resolve(font);
+ modifiedFont.detach();
+ modifiedFont.resolve_mask = resolve_mask;
+ return modifiedFont;
}
QFont QCommandLinkButtonPrivate::descriptionFont() const
{
Q_Q(const QCommandLinkButton);
QFont font = q->font();
- if (!q->testAttribute(Qt::WA_SetFont))
- font.setPointSizeF(9.0);
- return font;
+ font.setPointSizeF(9.0);
+
+ // Note the font will be resolved against
+ // QPainters font, so we need to restore the mask
+ int resolve_mask = font.resolve_mask;
+ QFont modifiedFont = q->font().resolve(font);
+ modifiedFont.detach();
+ modifiedFont.resolve_mask = resolve_mask;
+ return modifiedFont;
}
QRect QCommandLinkButtonPrivate::titleRect() const
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp
index dc78fd5..3fe9bb4 100644
--- a/src/gui/widgets/qtextedit.cpp
+++ b/src/gui/widgets/qtextedit.cpp
@@ -174,8 +174,13 @@ void QTextEditPrivate::init(const QString &html)
if (!html.isEmpty())
control->setHtml(html);
+#ifdef Q_OS_MAC
+ hbar->setSingleStep(1);
+ vbar->setSingleStep(1);
+#else
hbar->setSingleStep(20);
vbar->setSingleStep(20);
+#endif
viewport->setBackgroundRole(QPalette::Base);
q->setAcceptDrops(true);
diff --git a/src/gui/widgets/qvalidator.h b/src/gui/widgets/qvalidator.h
index 268ecaa..a0d9534 100644
--- a/src/gui/widgets/qvalidator.h
+++ b/src/gui/widgets/qvalidator.h
@@ -61,7 +61,7 @@ class Q_GUI_EXPORT QValidator : public QObject
{
Q_OBJECT
public:
- explicit QValidator(QObject * parent=0);
+ explicit QValidator(QObject * parent = 0);
~QValidator();
enum State {
@@ -100,7 +100,7 @@ class Q_GUI_EXPORT QIntValidator : public QValidator
Q_PROPERTY(int top READ top WRITE setTop)
public:
- explicit QIntValidator(QObject * parent=0);
+ explicit QIntValidator(QObject * parent = 0);
QIntValidator(int bottom, int top, QObject * parent);
~QIntValidator();