summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKurt Korbatits <kurt.korbatits@nokia.com>2009-10-21 04:32:32 (GMT)
committerKurt Korbatits <kurt.korbatits@nokia.com>2009-10-21 04:32:32 (GMT)
commitda433db6b88cc82b9897a95ce790a02bea14d900 (patch)
tree4ca554455bec2a9c3be88a4b3535ef3bd9c114f0 /src
parent0cb251e67ae45d8ab5ad715a4bc6dcf89209d2ab (diff)
parent7997279bc22d30bf1d1a30a567bda33ecc9aeb2d (diff)
downloadQt-da433db6b88cc82b9897a95ce790a02bea14d900.zip
Qt-da433db6b88cc82b9897a95ce790a02bea14d900.tar.gz
Qt-da433db6b88cc82b9897a95ce790a02bea14d900.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/phonon/mmf/audiooutput.cpp8
-rw-r--r--src/3rdparty/phonon/mmf/mmf_videoplayer.cpp2
-rw-r--r--src/corelib/global/qnamespace.qdoc4
-rw-r--r--src/corelib/io/qdir.cpp5
-rw-r--r--src/gui/accessible/qaccessible.h7
-rw-r--r--src/gui/accessible/qaccessible2.cpp12
-rw-r--r--src/gui/accessible/qaccessible2.h16
-rw-r--r--src/gui/dialogs/qfiledialog_win.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout.cpp43
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout.h2
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp817
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.h36
-rw-r--r--src/gui/graphicsview/qgraphicsgridlayout.cpp30
-rw-r--r--src/gui/graphicsview/qgraphicslinearlayout.cpp4
-rw-r--r--src/gui/image/qpixmap_s60.cpp19
-rw-r--r--src/gui/itemviews/qlistview.cpp6
-rw-r--r--src/gui/itemviews/qtableview.cpp2
-rw-r--r--src/gui/kernel/qapplication.cpp25
-rw-r--r--src/gui/kernel/qapplication_s60.cpp7
-rw-r--r--src/gui/kernel/qt_s60_p.h10
-rw-r--r--src/gui/kernel/qwidget_mac.mm15
-rw-r--r--src/gui/styles/qs60style.cpp24
-rw-r--r--src/gui/styles/qs60style_s60.cpp7
-rw-r--r--src/gui/text/qfontengine_mac.mm14
-rw-r--r--src/gui/text/qtextengine_mac.cpp9
-rw-r--r--src/gui/widgets/qdialogbuttonbox.cpp10
-rw-r--r--src/gui/widgets/qmenu_mac.mm20
-rw-r--r--src/gui/widgets/qmenubar.cpp9
-rw-r--r--src/gui/widgets/qmenubar_p.h1
-rw-r--r--src/opengl/gl2paintengineex/qglcustomshaderstage.cpp2
-rw-r--r--src/plugins/accessible/widgets/main.cpp4
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.cpp84
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.h33
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c62
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h15
-rw-r--r--src/plugins/gfxdrivers/powervr/README7
-rw-r--r--src/s60installs/eabi/QtGuiu.def39
-rw-r--r--src/s60installs/eabi/QtMultimediau.def6
-rw-r--r--src/s60installs/eabi/QtNetworku.def2
-rw-r--r--src/s60installs/eabi/QtScriptu.def1
-rw-r--r--src/s60installs/eabi/QtXmlu.def1
-rw-r--r--src/s60installs/eabi/phononu.def10
42 files changed, 871 insertions, 563 deletions
diff --git a/src/3rdparty/phonon/mmf/audiooutput.cpp b/src/3rdparty/phonon/mmf/audiooutput.cpp
index 5a00f60..82af9f1 100644
--- a/src/3rdparty/phonon/mmf/audiooutput.cpp
+++ b/src/3rdparty/phonon/mmf/audiooutput.cpp
@@ -102,15 +102,15 @@ bool MMF::AudioOutput::activateOnMediaObject(MediaObject *mo)
QHash<QByteArray, QVariant> MMF::AudioOutput::audioOutputDescription(int index)
{
- if (index == AudioOutputDeviceID) {
- QHash<QByteArray, QVariant> retval;
+ QHash<QByteArray, QVariant> retval;
+ if (index == AudioOutputDeviceID) {
retval.insert("name", QCoreApplication::translate("Phonon::MMF", "Audio Output"));
retval.insert("description", QCoreApplication::translate("Phonon::MMF", "The audio output device"));
retval.insert("available", true);
-
- return retval;
}
+
+ return retval;
}
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp
index a93aca0..d1d2337 100644
--- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp
+++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp
@@ -300,8 +300,8 @@ void MMF::VideoPlayer::MvpuoPlayComplete(TInt aError)
TRACE_CONTEXT(VideoPlayer::MvpuoPlayComplete, EVideoApi)
TRACE_ENTRY("state %d error %d", state(), aError);
- // TODO
Q_UNUSED(aError); // suppress warnings in release builds
+ changeState(StoppedState);
TRACE_EXIT_0();
}
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index ba05b00..e8d6df0 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1827,7 +1827,9 @@
\value TabFocus the widget accepts focus by tabbing.
\value ClickFocus the widget accepts focus by clicking.
\value StrongFocus the widget accepts focus by both tabbing
- and clicking.
+ and clicking. On Mac OS X this will also
+ be indicate that the widget accepts tab focus
+ when in 'Text/List focus mode'.
\value WheelFocus like Qt::StrongFocus plus the widget accepts
focus by using the mouse wheel.
\value NoFocus the widget does not accept focus.
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index a67b3bd..59db9a6 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1930,7 +1930,7 @@ QString QDir::currentPath()
Under non-Windows operating systems the \c HOME environment
variable is used if it exists, otherwise the path returned by the
- rootPath().
+ rootPath(). On Symbian always the same as the path returned by the rootPath().
\sa home(), currentPath(), rootPath(), tempPath()
*/
@@ -2002,7 +2002,8 @@ QString QDir::tempPath()
Returns the absolute path of the root directory.
For Unix operating systems this returns "/". For Windows file
- systems this normally returns "c:/".
+ systems this normally returns "c:/". On Symbian this typically returns
+ "c:/data", i.e. the same as native PathInfo::PhoneMemoryRootPath().
\sa root(), drives(), currentPath(), homePath(), tempPath()
*/
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 96fe91c..8f6d9d9 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -310,7 +310,8 @@ namespace QAccessible2
TextInterface,
EditableTextInterface,
ValueInterface,
- TableInterface
+ TableInterface,
+ ActionInterface
};
}
@@ -319,6 +320,7 @@ class QAccessibleTextInterface;
class QAccessibleEditableTextInterface;
class QAccessibleValueInterface;
class QAccessibleTableInterface;
+class QAccessibleActionInterface;
class Q_GUI_EXPORT QAccessibleInterface : public QAccessible
{
@@ -376,6 +378,9 @@ public:
inline QAccessibleTableInterface *tableInterface()
{ return reinterpret_cast<QAccessibleTableInterface *>(cast_helper(QAccessible2::TableInterface)); }
+ inline QAccessibleActionInterface *actionInterface()
+ { return reinterpret_cast<QAccessibleActionInterface *>(cast_helper(QAccessible2::ActionInterface)); }
+
private:
QAccessible2Interface *cast_helper(QAccessible2::InterfaceType);
};
diff --git a/src/gui/accessible/qaccessible2.cpp b/src/gui/accessible/qaccessible2.cpp
index f731962..0867368 100644
--- a/src/gui/accessible/qaccessible2.cpp
+++ b/src/gui/accessible/qaccessible2.cpp
@@ -108,6 +108,18 @@ QT_BEGIN_NAMESPACE
\link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
*/
+/*!
+ \class QAccessibleActionInterface
+ \ingroup accessibility
+ \internal
+ \preliminary
+
+ \brief The QAccessibleActionInterface class implements support for
+ the IAccessibleAction interface.
+
+ \link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
+*/
+
QAccessibleSimpleEditableTextInterface::QAccessibleSimpleEditableTextInterface(
QAccessibleInterface *accessibleInterface)
: iface(accessibleInterface)
diff --git a/src/gui/accessible/qaccessible2.h b/src/gui/accessible/qaccessible2.h
index 3281509..435c640 100644
--- a/src/gui/accessible/qaccessible2.h
+++ b/src/gui/accessible/qaccessible2.h
@@ -81,6 +81,7 @@ inline QAccessible2Interface *qAccessibleValueCastHelper() { return 0; }
inline QAccessible2Interface *qAccessibleTextCastHelper() { return 0; }
inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return 0; }
inline QAccessible2Interface *qAccessibleTableCastHelper() { return 0; }
+inline QAccessible2Interface *qAccessibleActionCastHelper() { return 0; }
#define Q_ACCESSIBLE_OBJECT \
public: \
@@ -95,6 +96,8 @@ inline QAccessible2Interface *qAccessibleTableCastHelper() { return 0; }
return qAccessibleValueCastHelper(); \
case QAccessible2::TableInterface: \
return qAccessibleTableCastHelper(); \
+ case QAccessible2::ActionInterface: \
+ return qAccessibleActionCastHelper(); \
} \
return 0; \
} \
@@ -208,6 +211,19 @@ public:
int *columnSpan, bool *isSelected) = 0;
};
+class Q_GUI_EXPORT QAccessibleActionInterface : public QAccessible2Interface
+{
+public:
+ inline QAccessible2Interface *qAccessibleActionCastHelper() { return this; }
+
+ virtual int actionCount() = 0;
+ virtual void doAction(int actionIndex) = 0;
+ virtual QString description(int actionIndex) = 0;
+ virtual QString name(int actionIndex) = 0;
+ virtual QString localizedName(int actionIndex) = 0;
+ virtual QStringList keyBindings(int actionIndex) = 0;
+};
+
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE
diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp
index b59c28b..8089b43 100644
--- a/src/gui/dialogs/qfiledialog_win.cpp
+++ b/src/gui/dialogs/qfiledialog_win.cpp
@@ -251,10 +251,10 @@ static OPENFILENAME* qt_win_make_OFN(QWidget *parent,
ofn->nMaxFile = maxLen;
ofn->lpstrInitialDir = (wchar_t*)tInitDir.utf16();
ofn->lpstrTitle = (wchar_t*)tTitle.utf16();
- ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_EXPLORER);
+ ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_EXPLORER | OFN_PATHMUSTEXIST);
if (mode == QFileDialog::ExistingFile ||
mode == QFileDialog::ExistingFiles)
- ofn->Flags |= (OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST);
+ ofn->Flags |= (OFN_FILEMUSTEXIST);
if (mode == QFileDialog::ExistingFiles)
ofn->Flags |= (OFN_ALLOWMULTISELECT);
if (!(options & QFileDialog::DontConfirmOverwrite))
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
index ffbb67c..c39e8a6 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
@@ -118,6 +118,23 @@ QGraphicsAnchor::~QGraphicsAnchor()
}
/*!
+ Sets the size policy of the anchor to \a policy.
+*/
+void QGraphicsAnchor::setSizePolicy(QSizePolicy::Policy policy)
+{
+ Q_D(QGraphicsAnchor);
+ d->setSizePolicy(policy);
+}
+/*!
+ Returns the size policy of the anchor. The default size policy is QSizePolicy::Fixed
+*/
+QSizePolicy::Policy QGraphicsAnchor::sizePolicy() const
+{
+ Q_D(const QGraphicsAnchor);
+ return d->sizePolicy;
+}
+
+/*!
\property QGraphicsAnchor::spacing
\brief the space between items in the QGraphicsAnchorLayout.
@@ -306,6 +323,13 @@ void QGraphicsAnchorLayout::addAnchors(QGraphicsLayoutItem *firstItem,
void QGraphicsAnchorLayout::setHorizontalSpacing(qreal spacing)
{
Q_D(QGraphicsAnchorLayout);
+
+ // ### We don't support negative spacing yet
+ if (spacing < 0) {
+ spacing = 0;
+ qWarning() << "QGraphicsAnchorLayout does not support negative spacing.";
+ }
+
d->spacings[0] = spacing;
invalidate();
}
@@ -318,6 +342,13 @@ void QGraphicsAnchorLayout::setHorizontalSpacing(qreal spacing)
void QGraphicsAnchorLayout::setVerticalSpacing(qreal spacing)
{
Q_D(QGraphicsAnchorLayout);
+
+ // ### We don't support negative spacing yet
+ if (spacing < 0) {
+ spacing = 0;
+ qWarning() << "QGraphicsAnchorLayout does not support negative spacing.";
+ }
+
d->spacings[1] = spacing;
invalidate();
}
@@ -327,11 +358,23 @@ void QGraphicsAnchorLayout::setVerticalSpacing(qreal spacing)
If an item is anchored with no spacing associated with the anchor, it will use the default
spacing.
+
+ Currently QGraphicsAnchorLayout does not support negative default spacings.
+
\sa setHorizontalSpacing(), setVerticalSpacing()
*/
void QGraphicsAnchorLayout::setSpacing(qreal spacing)
{
Q_D(QGraphicsAnchorLayout);
+
+ // ### Currently we do not support negative anchors inside the graph.
+ // To avoid those being created by a negative spacing, we must
+ // make this test.
+ if (spacing < 0) {
+ spacing = 0;
+ qWarning() << "QGraphicsAnchorLayout does not support negative spacing.";
+ }
+
d->spacings[0] = d->spacings[1] = spacing;
invalidate();
}
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.h b/src/gui/graphicsview/qgraphicsanchorlayout.h
index 99dbf92..f09ac43 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout.h
+++ b/src/gui/graphicsview/qgraphicsanchorlayout.h
@@ -65,6 +65,8 @@ class Q_GUI_EXPORT QGraphicsAnchor : public QObject
public:
void setSpacing(qreal spacing);
void unsetSpacing();
+ void setSizePolicy(QSizePolicy::Policy policy);
+ QSizePolicy::Policy sizePolicy() const;
qreal spacing() const;
~QGraphicsAnchor();
private:
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index f9b5c8c..8c8c303 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -53,7 +53,8 @@ QT_BEGIN_NAMESPACE
QGraphicsAnchorPrivate::QGraphicsAnchorPrivate(int version)
- : QObjectPrivate(version), layoutPrivate(0), data(0)
+ : QObjectPrivate(version), layoutPrivate(0), data(0),
+ sizePolicy(QSizePolicy::Fixed)
{
}
@@ -62,6 +63,14 @@ QGraphicsAnchorPrivate::~QGraphicsAnchorPrivate()
layoutPrivate->removeAnchor(data->from, data->to);
}
+void QGraphicsAnchorPrivate::setSizePolicy(QSizePolicy::Policy policy)
+{
+ if (sizePolicy != policy) {
+ sizePolicy = policy;
+ layoutPrivate->q_func()->invalidate();
+ }
+}
+
void QGraphicsAnchorPrivate::setSpacing(qreal value)
{
if (data) {
@@ -92,28 +101,11 @@ qreal QGraphicsAnchorPrivate::spacing() const
}
-static void sizeHintsFromItem(QGraphicsLayoutItem *item,
- const QGraphicsAnchorLayoutPrivate::Orientation orient,
- qreal *minSize, qreal *prefSize,
- qreal *expSize, qreal *maxSize)
+static void internalSizeHints(QSizePolicy::Policy policy,
+ qreal minSizeHint, qreal prefSizeHint, qreal maxSizeHint,
+ qreal *minSize, qreal *prefSize,
+ qreal *expSize, qreal *maxSize)
{
- QSizePolicy::Policy policy;
- qreal minSizeHint;
- qreal prefSizeHint;
- qreal maxSizeHint;
-
- if (orient == QGraphicsAnchorLayoutPrivate::Horizontal) {
- policy = item->sizePolicy().horizontalPolicy();
- minSizeHint = item->effectiveSizeHint(Qt::MinimumSize).width();
- prefSizeHint = item->effectiveSizeHint(Qt::PreferredSize).width();
- maxSizeHint = item->effectiveSizeHint(Qt::MaximumSize).width();
- } else {
- policy = item->sizePolicy().verticalPolicy();
- minSizeHint = item->effectiveSizeHint(Qt::MinimumSize).height();
- prefSizeHint = item->effectiveSizeHint(Qt::PreferredSize).height();
- maxSizeHint = item->effectiveSizeHint(Qt::MaximumSize).height();
- }
-
// minSize, prefSize and maxSize are initialized
// with item's preferred Size: this is QSizePolicy::Fixed.
//
@@ -139,7 +131,7 @@ static void sizeHintsFromItem(QGraphicsLayoutItem *item,
// Note that these two initializations are affected by the previous flags
if (policy & QSizePolicy::IgnoreFlag)
- *prefSize = *maxSize;
+ *prefSize = *minSize;
else
*prefSize = prefSizeHint;
@@ -153,38 +145,63 @@ void AnchorData::refreshSizeHints(qreal effectiveSpacing)
{
const bool isInternalAnchor = from->m_item == to->m_item;
+ QSizePolicy::Policy policy;
+ qreal minSizeHint;
+ qreal prefSizeHint;
+ qreal maxSizeHint;
+
if (isInternalAnchor) {
const QGraphicsAnchorLayoutPrivate::Orientation orient =
QGraphicsAnchorLayoutPrivate::edgeOrientation(from->m_edge);
+ const Qt::AnchorPoint centerEdge =
+ QGraphicsAnchorLayoutPrivate::pickEdge(Qt::AnchorHorizontalCenter, orient);
+ bool hasCenter = (from->m_edge == centerEdge || to->m_edge == centerEdge);
if (isLayoutAnchor) {
minSize = 0;
prefSize = 0;
expSize = 0;
maxSize = QWIDGETSIZE_MAX;
+ if (hasCenter)
+ maxSize /= 2;
+ return;
} else {
- QGraphicsLayoutItem *item = from->m_item;
- sizeHintsFromItem(item, orient, &minSize, &prefSize, &expSize, &maxSize);
- }
- const Qt::AnchorPoint centerEdge =
- QGraphicsAnchorLayoutPrivate::pickEdge(Qt::AnchorHorizontalCenter, orient);
- bool hasCenter = (from->m_edge == centerEdge || to->m_edge == centerEdge);
+ QGraphicsLayoutItem *item = from->m_item;
+ if (orient == QGraphicsAnchorLayoutPrivate::Horizontal) {
+ policy = item->sizePolicy().horizontalPolicy();
+ minSizeHint = item->effectiveSizeHint(Qt::MinimumSize).width();
+ prefSizeHint = item->effectiveSizeHint(Qt::PreferredSize).width();
+ maxSizeHint = item->effectiveSizeHint(Qt::MaximumSize).width();
+ } else {
+ policy = item->sizePolicy().verticalPolicy();
+ minSizeHint = item->effectiveSizeHint(Qt::MinimumSize).height();
+ prefSizeHint = item->effectiveSizeHint(Qt::PreferredSize).height();
+ maxSizeHint = item->effectiveSizeHint(Qt::MaximumSize).height();
+ }
- if (hasCenter) {
- minSize /= 2;
- prefSize /= 2;
- expSize /= 2;
- maxSize /= 2;
+ if (hasCenter) {
+ minSizeHint /= 2;
+ prefSizeHint /= 2;
+ maxSizeHint /= 2;
+ }
}
-
- } else if (!hasSize) {
- // Anchor has no size defined, use given default information
- minSize = effectiveSpacing;
- prefSize = effectiveSpacing;
- expSize = effectiveSpacing;
- maxSize = effectiveSpacing;
+ } else {
+ Q_ASSERT(graphicsAnchor);
+ policy = graphicsAnchor->sizePolicy();
+ minSizeHint = 0;
+ if (hasSize) {
+ // One can only configure the preferred size of a normal anchor. Their minimum and
+ // maximum "size hints" are always 0 and QWIDGETSIZE_MAX, correspondingly. However,
+ // their effective size hints might be narrowed down due to their size policies.
+ prefSizeHint = prefSize;
+ } else {
+ prefSizeHint = effectiveSpacing;
+ }
+ maxSizeHint = QWIDGETSIZE_MAX;
}
+ internalSizeHints(policy, minSizeHint, prefSizeHint, maxSizeHint,
+ &minSize, &prefSize, &expSize, &maxSize);
// Set the anchor effective sizes to preferred.
//
@@ -250,44 +267,61 @@ void ParallelAnchorData::refreshSizeHints_helper(qreal effectiveSpacing,
0 is at Preferred
1 is at Maximum
*/
-static qreal getFactor(qreal value, qreal min, qreal pref, qreal max)
-{
- // ### Maybe remove some of the assertions? (since outside is asserting us)
- Q_ASSERT(value > min || qFuzzyCompare(value, min));
- Q_ASSERT(value < max || qFuzzyCompare(value, max));
-
- if (qFuzzyCompare(value, min)) {
- return -1.0;
- } else if (qFuzzyCompare(value, pref)) {
- return 0.0;
- } else if (qFuzzyCompare(value, max)) {
- return 1.0;
- } else if (value < pref) {
- // Since value < pref and value != pref and min <= value,
- // we can assert that min < pref.
- Q_ASSERT(min < pref);
- return (value - min) / (pref - min) - 1;
+static QPair<QGraphicsAnchorLayoutPrivate::Interval, qreal> getFactor(qreal value, qreal min,
+ qreal pref, qreal exp,
+ qreal max)
+{
+ QGraphicsAnchorLayoutPrivate::Interval interval;
+ qreal lower;
+ qreal upper;
+
+ if (value < pref) {
+ interval = QGraphicsAnchorLayoutPrivate::MinToPreferred;
+ lower = min;
+ upper = pref;
+ } else if (value < exp) {
+ interval = QGraphicsAnchorLayoutPrivate::PreferredToExpanding;
+ lower = pref;
+ upper = exp;
} else {
- // Since value > pref and value != pref and max >= value,
- // we can assert that max > pref.
- Q_ASSERT(max > pref);
- return (value - pref) / (max - pref);
+ interval = QGraphicsAnchorLayoutPrivate::ExpandingToMax;
+ lower = exp;
+ upper = max;
}
+
+ qreal progress;
+ if (upper == lower) {
+ progress = 0;
+ } else {
+ progress = (value - lower) / (upper - lower);
+ }
+
+ return qMakePair(interval, progress);
}
-static qreal getExpandingFactor(const qreal &expSize, const qreal &sizeAtPreferred,
- const qreal &sizeAtExpanding, const qreal &sizeAtMaximum)
+static qreal interpolate(const QPair<QGraphicsAnchorLayoutPrivate::Interval, qreal> &factor,
+ qreal min, qreal pref,
+ qreal exp, qreal max)
{
- const qreal lower = qMin(sizeAtPreferred, sizeAtMaximum);
- const qreal upper = qMax(sizeAtPreferred, sizeAtMaximum);
- const qreal boundedExpSize = qBound(lower, expSize, upper);
+ qreal lower;
+ qreal upper;
- const qreal bandSize = sizeAtMaximum - boundedExpSize;
- if (bandSize == 0) {
- return 0;
- } else {
- return (sizeAtExpanding - boundedExpSize) / bandSize;
+ switch (factor.first) {
+ case QGraphicsAnchorLayoutPrivate::MinToPreferred:
+ lower = min;
+ upper = pref;
+ break;
+ case QGraphicsAnchorLayoutPrivate::PreferredToExpanding:
+ lower = pref;
+ upper = exp;
+ break;
+ case QGraphicsAnchorLayoutPrivate::ExpandingToMax:
+ lower = exp;
+ upper = max;
+ break;
}
+
+ return lower + factor.second * (upper - lower);
}
void SequentialAnchorData::updateChildrenSizes()
@@ -307,27 +341,22 @@ void SequentialAnchorData::updateChildrenSizes()
// Band here refers if the value is in the Minimum To Preferred
// band (the lower band) or the Preferred To Maximum (the upper band).
- const qreal minFactor = getFactor(sizeAtMinimum, minSize, prefSize, maxSize);
- const qreal prefFactor = getFactor(sizeAtPreferred, minSize, prefSize, maxSize);
- const qreal maxFactor = getFactor(sizeAtMaximum, minSize, prefSize, maxSize);
- const qreal expFactor = getExpandingFactor(expSize, sizeAtPreferred, sizeAtExpanding, sizeAtMaximum);
+ const QPair<QGraphicsAnchorLayoutPrivate::Interval, qreal> minFactor =
+ getFactor(sizeAtMinimum, minSize, prefSize, expSize, maxSize);
+ const QPair<QGraphicsAnchorLayoutPrivate::Interval, qreal> prefFactor =
+ getFactor(sizeAtPreferred, minSize, prefSize, expSize, maxSize);
+ const QPair<QGraphicsAnchorLayoutPrivate::Interval, qreal> expFactor =
+ getFactor(sizeAtExpanding, minSize, prefSize, expSize, maxSize);
+ const QPair<QGraphicsAnchorLayoutPrivate::Interval, qreal> maxFactor =
+ getFactor(sizeAtMaximum, minSize, prefSize, expSize, maxSize);
for (int i = 0; i < m_edges.count(); ++i) {
AnchorData *e = m_edges.at(i);
- qreal bandSize = minFactor > 0 ? e->maxSize - e->prefSize : e->prefSize - e->minSize;
- e->sizeAtMinimum = e->prefSize + bandSize * minFactor;
-
- bandSize = prefFactor > 0 ? e->maxSize - e->prefSize : e->prefSize - e->minSize;
- e->sizeAtPreferred = e->prefSize + bandSize * prefFactor;
-
- bandSize = maxFactor > 0 ? e->maxSize - e->prefSize : e->prefSize - e->minSize;
- e->sizeAtMaximum = e->prefSize + bandSize * maxFactor;
-
- const qreal lower = qMin(e->sizeAtPreferred, e->sizeAtMaximum);
- const qreal upper = qMax(e->sizeAtPreferred, e->sizeAtMaximum);
- const qreal edgeBoundedExpSize = qBound(lower, e->expSize, upper);
- e->sizeAtExpanding = edgeBoundedExpSize + expFactor * (e->sizeAtMaximum - edgeBoundedExpSize);
+ e->sizeAtMinimum = interpolate(minFactor, e->minSize, e->prefSize, e->expSize, e->maxSize);
+ e->sizeAtPreferred = interpolate(prefFactor, e->minSize, e->prefSize, e->expSize, e->maxSize);
+ e->sizeAtExpanding = interpolate(expFactor, e->minSize, e->prefSize, e->expSize, e->maxSize);
+ e->sizeAtMaximum = interpolate(maxFactor, e->minSize, e->prefSize, e->expSize, e->maxSize);
e->updateChildrenSizes();
}
@@ -494,36 +523,46 @@ static bool simplifySequentialChunk(Graph<AnchorVertex, AnchorData> *graph,
const QVector<AnchorVertex*> &vertices,
AnchorVertex *after)
{
- int i;
+ AnchorData *data = graph->edgeData(before, vertices.first());
+ Q_ASSERT(data);
+
+ const bool forward = (before == data->from);
+ QVector<AnchorVertex *> orderedVertices;
+
+ if (forward) {
+ orderedVertices = vertices;
+ } else {
+ qSwap(before, after);
+ for (int i = vertices.count() - 1; i >= 0; --i)
+ orderedVertices.append(vertices.at(i));
+ }
+
#if defined(QT_DEBUG) && 0
QString strVertices;
- for (i = 0; i < vertices.count(); ++i)
- strVertices += QString::fromAscii("%1 - ").arg(vertices.at(i)->toString());
+ for (int i = 0; i < orderedVertices.count(); ++i) {
+ strVertices += QString::fromAscii("%1 - ").arg(orderedVertices.at(i)->toString());
+ }
QString strPath = QString::fromAscii("%1 - %2%3").arg(before->toString(), strVertices, after->toString());
qDebug("simplifying [%s] to [%s - %s]", qPrintable(strPath), qPrintable(before->toString()), qPrintable(after->toString()));
#endif
SequentialAnchorData *sequence = new SequentialAnchorData;
AnchorVertex *prev = before;
- AnchorData *data;
- for (i = 0; i <= vertices.count(); ++i) {
- AnchorVertex *next = (i < vertices.count()) ? vertices.at(i) : after;
- data = graph->takeEdge(prev, next);
- sequence->m_edges.append(data);
+
+ for (int i = 0; i <= orderedVertices.count(); ++i) {
+ AnchorVertex *next = (i < orderedVertices.count()) ? orderedVertices.at(i) : after;
+ AnchorData *ad = graph->takeEdge(prev, next);
+ Q_ASSERT(ad);
+ sequence->m_edges.append(ad);
prev = next;
}
- sequence->setVertices(vertices);
+
+ sequence->setVertices(orderedVertices);
sequence->from = before;
sequence->to = after;
sequence->refreshSizeHints_helper(0, false);
- // data here is the last edge in the sequence
- // ### this seems to be here for supporting reverse order sequences,
- // but doesnt seem to be used right now
- if (data->from != vertices.last())
- qSwap(sequence->from, sequence->to);
-
// Note that since layout 'edges' can't be simplified away from
// the graph, it's safe to assume that if there's a layout
// 'edge', it'll be in the boundaries of the sequence.
@@ -578,15 +617,6 @@ static bool simplifySequentialChunk(Graph<AnchorVertex, AnchorData> *graph,
2. Go to (1)
3. Done
-
- * Gathering sequential anchors *
- The algorithm walks the graph in depth-first order, and only collects vertices that has two
- edges connected to it. If the vertex does not have two edges or if it is a layout edge,
- it will take all the previously collected vertices and try to create a simplified sequential
- anchor representing all the previously collected vertices.
- Once the simplified anchor is inserted, the collected list is cleared in order to find the next
- sequence to simplify.
- Note that there are some catches to this that are not covered by the above explanation.
*/
void QGraphicsAnchorLayoutPrivate::simplifyGraph(Orientation orientation)
{
@@ -603,9 +633,7 @@ void QGraphicsAnchorLayoutPrivate::simplifyGraph(Orientation orientation)
orientation == Horizontal ? "Horizontal" : "Vertical");
#endif
- AnchorVertex *rootVertex = graph[orientation].rootVertex();
-
- if (!rootVertex)
+ if (!graph[orientation].rootVertex())
return;
bool dirty;
@@ -614,164 +642,171 @@ void QGraphicsAnchorLayoutPrivate::simplifyGraph(Orientation orientation)
} while (dirty);
}
+/*!
+ \internal
+
+ One iteration of the simplification algorithm. Returns true if another iteration is needed.
+
+ The algorithm walks the graph in depth-first order, and only collects vertices that has two
+ edges connected to it. If the vertex does not have two edges or if it is a layout edge, it
+ will take all the previously collected vertices and try to create a simplified sequential
+ anchor representing all the previously collected vertices. Once the simplified anchor is
+ inserted, the collected list is cleared in order to find the next sequence to simplify.
+
+ Note that there are some catches to this that are not covered by the above explanation, see
+ the function comments for more details.
+*/
bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutPrivate::Orientation orientation)
{
Q_Q(QGraphicsAnchorLayout);
Graph<AnchorVertex, AnchorData> &g = graph[orientation];
- AnchorVertex *v = g.rootVertex();
QSet<AnchorVertex *> visited;
- QStack<AnchorVertex *> stack;
- stack.push(v);
+ QStack<QPair<AnchorVertex *, AnchorVertex *> > stack;
+ stack.push(qMakePair(static_cast<AnchorVertex *>(0), g.rootVertex()));
QVector<AnchorVertex*> candidates;
+ bool candidatesForward;
const Qt::AnchorPoint centerEdge = pickEdge(Qt::AnchorHorizontalCenter, orientation);
- const Qt::AnchorPoint layoutEdge = oppositeEdge(v->m_edge);
- bool dirty = false;
-
- // walk depth-first.
+ // Walk depth-first, in the stack we store start of the candidate sequence (beforeSequence)
+ // and the vertex to be visited.
while (!stack.isEmpty()) {
- v = stack.pop();
- QList<AnchorVertex *> vertices = g.adjacentVertices(v);
- const int count = vertices.count();
- bool endOfSequence = (v->m_item == q && v->m_edge == layoutEdge) || count != 2;
- if (count == 2 && v->m_item != q) {
- candidates.append(v);
- if (visited.contains(vertices.first()) && visited.contains(vertices.last())) {
- // in case of a cycle
- endOfSequence = true;
+ QPair<AnchorVertex *, AnchorVertex *> pair = stack.pop();
+ AnchorVertex *beforeSequence = pair.first;
+ AnchorVertex *v = pair.second;
+
+ // The basic idea is to determine whether we found an end of sequence,
+ // if that's the case, we stop adding vertices to the candidate list
+ // and do a simplification step.
+ //
+ // A vertex can trigger an end of sequence if
+ // (a) it is a layout vertex, we don't simplify away the layout vertices;
+ // (b) it does not have exactly 2 adjacents;
+ // (c) it will change the direction of the sequence;
+ // (d) its next adjacent is already visited (a cycle in the graph).
+
+ const QList<AnchorVertex *> &adjacents = g.adjacentVertices(v);
+ const bool isLayoutVertex = v->m_item == q;
+ AnchorVertex *afterSequence = v;
+ bool endOfSequence = false;
+
+ //
+ // Identify the end cases.
+ //
+
+ // Identifies cases (a) and (b)
+ endOfSequence = isLayoutVertex || adjacents.count() != 2;
+
+ if (!endOfSequence) {
+ // If this is the first vertice, determine what is the direction to use for this
+ // sequence.
+ if (candidates.isEmpty()) {
+ const AnchorData *data = g.edgeData(beforeSequence, v);
+ Q_ASSERT(data);
+ candidatesForward = (beforeSequence == data->from);
}
- }
- if (endOfSequence && candidates.count() >= 1) {
- int i;
- AnchorVertex *afterSequence= 0;
- AnchorVertex *beforeSequence = 0;
- // find the items before and after the valid sequence
- if (candidates.count() == 1) {
- QList<AnchorVertex *> beforeAndAfterVertices = g.adjacentVertices(candidates.at(0));
- Q_ASSERT(beforeAndAfterVertices.count() == 2);
- // Since we only have one vertex, we can pick
- // any of the two vertices to become before/after.
- afterSequence = beforeAndAfterVertices.last();
- beforeSequence = beforeAndAfterVertices.first();
- } else {
- QList<AnchorVertex *> adjacentOfSecondLastVertex = g.adjacentVertices(candidates.last());
- Q_ASSERT(adjacentOfSecondLastVertex.count() == 2);
- if (adjacentOfSecondLastVertex.first() == candidates.at(candidates.count() - 2))
- afterSequence = adjacentOfSecondLastVertex.last();
- else
- afterSequence = adjacentOfSecondLastVertex.first();
- QList<AnchorVertex *> adjacentOfSecondVertex = g.adjacentVertices(candidates.first());
- Q_ASSERT(adjacentOfSecondVertex.count() == 2);
- if (adjacentOfSecondVertex.first() == candidates.at(1))
- beforeSequence = adjacentOfSecondVertex.last();
- else
- beforeSequence = adjacentOfSecondVertex.first();
+ // This is a tricky part. We peek at the next vertex to find out
+ //
+ // - whether the edge from this vertex to the next vertex has the same direction;
+ // - whether we already visited the next vertex.
+ //
+ // Those are needed to identify (c) and (d). Note that unlike (a) and (b), we preempt
+ // the end of sequence by looking into the next vertex.
+
+ // Peek at the next vertex
+ AnchorVertex *after;
+ if (candidates.isEmpty())
+ after = (beforeSequence == adjacents.last() ? adjacents.first() : adjacents.last());
+ else
+ after = (candidates.last() == adjacents.last() ? adjacents.first() : adjacents.last());
+
+ // ### At this point we assumed that candidates will not contain 'after', this may not hold
+ // when simplifying FLOATing anchors.
+ Q_ASSERT(!candidates.contains(after));
+
+ const AnchorData *data = g.edgeData(v, after);
+ Q_ASSERT(data);
+ const bool willChangeDirection = (candidatesForward != (v == data->from));
+ const bool cycleFound = visited.contains(after);
+
+ // Now cases (c) and (d)...
+ endOfSequence = willChangeDirection || cycleFound;
+
+ if (endOfSequence) {
+ if (!willChangeDirection) {
+ // If the direction will not change, we can add the current vertex to the
+ // candidates list and we know that 'after' can be used as afterSequence.
+ candidates.append(v);
+ afterSequence = after;
+ }
+ } else {
+ // If it's not an end of sequence, then the vertex didn't trigger neither of the
+ // previously four cases, so it can be added to the candidates list.
+ candidates.append(v);
}
- // The complete path of the sequence to simplify is: beforeSequence, <candidates>, afterSequence
- // where beforeSequence and afterSequence are the endpoints where the anchor is inserted
- // between.
-#if defined(QT_DEBUG) && 0
- // ### DEBUG
- QString strCandidates;
- for (i = 0; i < candidates.count(); ++i)
- strCandidates += QString::fromAscii("%1 - ").arg(candidates.at(i)->toString());
- QString strPath = QString::fromAscii("%1 - %2%3").arg(beforeSequence->toString(), strCandidates, afterSequence->toString());
- qDebug("candidate list for sequential simplification:\n[%s]", qPrintable(strPath));
-#endif
+ }
- bool forward = true;
- AnchorVertex *prev = beforeSequence;
- int intervalFrom = 0;
+ //
+ // Add next non-visited vertices to the stack.
+ //
+ for (int i = 0; i < adjacents.count(); ++i) {
+ AnchorVertex *next = adjacents.at(i);
+ if (visited.contains(next))
+ continue;
- // Check for directionality (from). We don't want to destroy that information,
- // thus we only combine anchors with the same direction.
+ // If current vertex is an end of sequence, and it'll reset the candidates list. So
+ // the next vertices will build candidates lists with the current vertex as 'before'
+ // vertex. If it's not an end of sequence, we keep the original 'before' vertex,
+ // since we are keeping the candidates list.
+ if (endOfSequence)
+ stack.push(qMakePair(v, next));
+ else
+ stack.push(qMakePair(beforeSequence, next));
+ }
- // "i" is the index *including* the beforeSequence and afterSequence vertices.
- for (i = 1; i <= candidates.count() + 1; ++i) {
- bool atVertexAfter = i > candidates.count();
- AnchorVertex *v1 = atVertexAfter ? afterSequence : candidates.at(i - 1);
- AnchorData *data = g.edgeData(prev, v1);
- Q_ASSERT(data);
- if (i == 1) {
- forward = (prev == data->from ? true : false);
- } else if (forward != (prev == data->from) || atVertexAfter) {
- int intervalTo = i;
- if (forward != (prev == data->from))
- --intervalTo;
-
- // intervalFrom and intervalTo should now be indices to the vertex before and
- // after the sequential anchor.
- if (intervalTo - intervalFrom >= 2) {
- // simplify in the range [intervalFrom, intervalTo]
-
- // Trim off internal center anchors (Left-Center/Center-Right) from the
- // start and the end of the sequence. We never want to simplify internal
- // center anchors where there is an external anchor connected to the center.
- AnchorVertex *intervalVertexFrom = intervalFrom == 0 ? beforeSequence : candidates.at(intervalFrom - 1);
- int effectiveIntervalFrom = intervalFrom;
- if (intervalVertexFrom->m_edge == centerEdge
- && intervalVertexFrom->m_item == candidates.at(effectiveIntervalFrom)->m_item) {
- ++effectiveIntervalFrom;
- intervalVertexFrom = candidates.at(effectiveIntervalFrom - 1);
- }
- AnchorVertex *intervalVertexTo = intervalTo <= candidates.count() ? candidates.at(intervalTo - 1) : afterSequence;
- int effectiveIntervalTo = intervalTo;
- if (intervalVertexTo->m_edge == centerEdge
- && intervalVertexTo->m_item == candidates.at(effectiveIntervalTo - 2)->m_item) {
- --effectiveIntervalTo;
- intervalVertexTo = candidates.at(effectiveIntervalTo - 1);
- }
- if (effectiveIntervalTo - effectiveIntervalFrom >= 2) {
- QVector<AnchorVertex*> subCandidates;
- if (forward) {
- subCandidates = candidates.mid(effectiveIntervalFrom, effectiveIntervalTo - effectiveIntervalFrom - 1);
- } else {
- // reverse the order of the candidates.
- qSwap(intervalVertexFrom, intervalVertexTo);
- do {
- ++effectiveIntervalFrom;
- subCandidates.prepend(candidates.at(effectiveIntervalFrom - 1));
- } while (effectiveIntervalFrom < effectiveIntervalTo - 1);
- }
- if (simplifySequentialChunk(&g, intervalVertexFrom, subCandidates, intervalVertexTo)) {
- dirty = true;
- break;
- }
- // finished simplification of chunk with same direction
- }
- }
- if (forward == (prev == data->from))
- --intervalTo;
- intervalFrom = intervalTo;
-
- forward = !forward;
- }
- prev = v1;
- }
+ visited.insert(v);
- if (dirty)
- break;
- }
+ if (!endOfSequence || candidates.isEmpty())
+ continue;
- if (endOfSequence)
- candidates.clear();
+ //
+ // Create a sequence for (beforeSequence, candidates, afterSequence).
+ //
- for (int i = 0; i < count; ++i) {
- AnchorVertex *next = vertices.at(i);
- if (next->m_item == q && next->m_edge == centerEdge)
+ // One restriction we have is to not simplify half of an anchor and let the other half
+ // unsimplified. So we remove center edges before and after the sequence.
+ if (beforeSequence->m_edge == centerEdge && beforeSequence->m_item == candidates.first()->m_item) {
+ beforeSequence = candidates.first();
+ candidates.remove(0);
+
+ // If there's not candidates to be simplified, leave.
+ if (candidates.isEmpty())
continue;
- if (visited.contains(next))
+ }
+
+ if (afterSequence->m_edge == centerEdge && afterSequence->m_item == candidates.last()->m_item) {
+ afterSequence = candidates.last();
+ candidates.remove(candidates.count() - 1);
+
+ if (candidates.isEmpty())
continue;
- stack.push(next);
}
- visited.insert(v);
+ // This function will remove the candidates from the graph and create one edge between
+ // beforeSequence and afterSequence. This function returns true if the sequential
+ // simplification also caused a parallel simplification to be created. In this case we end
+ // the iteration and start again (since all the visited state we have may be outdated).
+ if (simplifySequentialChunk(&g, beforeSequence, candidates, afterSequence))
+ return true;
+
+ // If there was no parallel simplification, we'll keep walking the graph. So we clear the
+ // candidates list to start again.
+ candidates.clear();
}
- return dirty;
+ return false;
}
static void restoreSimplifiedAnchor(Graph<AnchorVertex, AnchorData> &g,
@@ -1173,18 +1208,18 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *fi
|| secondItem == q
|| pickEdge(firstEdge, Horizontal) == Qt::AnchorHorizontalCenter
|| oppositeEdge(firstEdge) != secondEdge) {
- data->setFixedSize(0);
+ data->setPreferredSize(0);
} else {
data->unsetSize();
}
addAnchor_helper(firstItem, firstEdge, secondItem, secondEdge, data);
} else if (*spacing >= 0) {
- data->setFixedSize(*spacing);
+ data->setPreferredSize(*spacing);
addAnchor_helper(firstItem, firstEdge, secondItem, secondEdge, data);
} else {
- data->setFixedSize(-*spacing);
+ data->setPreferredSize(-*spacing);
addAnchor_helper(secondItem, secondEdge, firstItem, firstEdge, data);
}
@@ -1371,9 +1406,9 @@ void QGraphicsAnchorLayoutPrivate::setAnchorSize(AnchorData *data, const qreal *
// positive by definition.
// "negative spacing" is handled by inverting the standard item order.
if (*anchorSize >= 0) {
- data->setFixedSize(*anchorSize);
+ data->setPreferredSize(*anchorSize);
} else {
- data->setFixedSize(-*anchorSize);
+ data->setPreferredSize(-*anchorSize);
qSwap(data->from, data->to);
}
} else {
@@ -1550,6 +1585,13 @@ qreal QGraphicsAnchorLayoutPrivate::effectiveSpacing(Orientation orientation) co
}
}
}
+
+ // ### Currently we do not support negative anchors inside the graph.
+ // To avoid those being created by a negative style spacing, we must
+ // make this test.
+ if (s < 0)
+ s = 0;
+
return s;
}
@@ -1565,13 +1607,24 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs()
if (!calculateGraphCacheDirty)
return;
+#if defined(QT_DEBUG) && 0
+ static int count = 0;
+ count++;
+ dumpGraph(QString::fromAscii("%1-before").arg(count));
+#endif
+
calculateGraphs(Horizontal);
calculateGraphs(Vertical);
+#if defined(QT_DEBUG) && 0
+ dumpGraph(QString::fromAscii("%1-after").arg(count));
+#endif
+
calculateGraphCacheDirty = 0;
}
-// ### remove me:
+// ### Maybe getGraphParts could return the variables when traversing, at least
+// for trunk...
QList<AnchorData *> getVariables(QList<QSimplexConstraint *> constraints)
{
QSet<AnchorData *> variableSet;
@@ -1635,65 +1688,92 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs(
// 2) The floating or semi-floating anchors (items) that are those which
// are connected to only one (or none) of the layout sides, thus are not
// influenced by the layout size.
- QList<QList<QSimplexConstraint *> > parts;
- parts = getGraphParts(orientation);
+ QList<QList<QSimplexConstraint *> > parts = getGraphParts(orientation);
// Now run the simplex solver to calculate Minimum, Preferred and Maximum sizes
// of the "trunk" set of constraints and variables.
// ### does trunk always exist? empty = trunk is the layout left->center->right
QList<QSimplexConstraint *> trunkConstraints = parts[0];
- QList<QSimplexConstraint *> sizeHintConstraints;
- sizeHintConstraints = constraintsFromSizeHints(getVariables(trunkConstraints));
- trunkConstraints += sizeHintConstraints;
+ QList<AnchorData *> trunkVariables = getVariables(trunkConstraints);
// For minimum and maximum, use the path between the two layout sides as the
// objective function.
-
- // Retrieve that path
AnchorVertex *v = internalVertex(q, pickEdge(Qt::AnchorRight, orientation));
GraphPath trunkPath = graphPaths[orientation].value(v);
+ bool feasible = calculateTrunk(orientation, trunkPath, trunkConstraints, trunkVariables);
+
+ // For the other parts that not the trunk, solve only for the preferred size
+ // that is the size they will remain at, since they are not stretched by the
+ // layout.
+
+ // Skipping the first (trunk)
+ for (int i = 1; i < parts.count(); ++i) {
+ if (!feasible)
+ break;
+
+ QList<QSimplexConstraint *> partConstraints = parts[i];
+ QList<AnchorData *> partVariables = getVariables(partConstraints);
+ Q_ASSERT(!partVariables.isEmpty());
+ feasible &= calculateNonTrunk(partConstraints, partVariables);
+ }
+
+ // Propagate the new sizes down the simplified graph, ie. tell the
+ // group anchors to set their children anchors sizes.
+ updateAnchorSizes(orientation);
+
+ graphHasConflicts[orientation] = !feasible;
+
+ // Clean up our data structures. They are not needed anymore since
+ // distribution uses just interpolation.
+ qDeleteAll(constraints[orientation]);
+ constraints[orientation].clear();
+ graphPaths[orientation].clear(); // ###
+}
+
+/*!
+ \internal
+
+ Calculate the sizes for all anchors which are part of the trunk. This works
+ on top of a (possibly) simplified graph.
+*/
+bool QGraphicsAnchorLayoutPrivate::calculateTrunk(Orientation orientation, const GraphPath &path,
+ const QList<QSimplexConstraint *> &constraints,
+ const QList<AnchorData *> &variables)
+{
bool feasible = true;
- if (!trunkConstraints.isEmpty()) {
+ bool needsSimplex = !constraints.isEmpty();
+
#if 0
- qDebug("Simplex used for trunk of %s",
- orientation == Horizontal ? "Horizontal" : "Vertical");
+ qDebug("Simplex %s for trunk of %s", needsSimplex ? "used" : "NOT used",
+ orientation == Horizontal ? "Horizontal" : "Vertical");
#endif
- // Solve min and max size hints for trunk
- qreal min, max;
- feasible = solveMinMax(trunkConstraints, trunkPath, &min, &max);
+ if (needsSimplex) {
- if (feasible) {
- // Solve for preferred. The objective function is calculated from the constraints
- // and variables internally.
- solvePreferred(trunkConstraints);
+ QList<QSimplexConstraint *> sizeHintConstraints = constraintsFromSizeHints(variables);
+ QList<QSimplexConstraint *> allConstraints = constraints + sizeHintConstraints;
- // remove sizeHintConstraints from trunkConstraints
- trunkConstraints = parts[0];
-
- // Solve for expanding. The objective function and the constraints from items
- // are calculated internally.
- solveExpanding(trunkConstraints);
-
- // Propagate the new sizes down the simplified graph, ie. tell the
- // group anchors to set their children anchors sizes.
+ // Solve min and max size hints
+ qreal min, max;
+ feasible = solveMinMax(allConstraints, path, &min, &max);
- // ### we calculated variables already a few times, can't we reuse that?
- QList<AnchorData *> trunkVariables = getVariables(trunkConstraints);
+ if (feasible) {
+ solvePreferred(allConstraints, variables);
- for (int i = 0; i < trunkVariables.count(); ++i)
- trunkVariables.at(i)->updateChildrenSizes();
+ // Note that we don't include the sizeHintConstraints, since they
+ // have a different logic for solveExpanding().
+ solveExpanding(constraints, variables);
// Calculate and set the preferred and expanding sizes for the layout,
// from the edge sizes that were calculated above.
qreal pref(0.0);
qreal expanding(0.0);
- foreach (const AnchorData *ad, trunkPath.positives) {
+ foreach (const AnchorData *ad, path.positives) {
pref += ad->sizeAtPreferred;
expanding += ad->sizeAtExpanding;
}
- foreach (const AnchorData *ad, trunkPath.negatives) {
+ foreach (const AnchorData *ad, path.negatives) {
pref -= ad->sizeAtPreferred;
expanding -= ad->sizeAtExpanding;
}
@@ -1703,76 +1783,57 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs(
sizeHints[orientation][Qt::MaximumSize] = max;
sizeAtExpanding[orientation] = expanding;
}
- } else {
-#if 0
- qDebug("Simplex NOT used for trunk of %s",
- orientation == Horizontal ? "Horizontal" : "Vertical");
-#endif
+ qDeleteAll(sizeHintConstraints);
+
+ } else {
// No Simplex is necessary because the path was simplified all the way to a single
// anchor.
- Q_ASSERT(trunkPath.positives.count() == 1);
- Q_ASSERT(trunkPath.negatives.count() == 0);
+ Q_ASSERT(path.positives.count() == 1);
+ Q_ASSERT(path.negatives.count() == 0);
- AnchorData *ad = trunkPath.positives.toList()[0];
+ AnchorData *ad = path.positives.toList()[0];
ad->sizeAtMinimum = ad->minSize;
ad->sizeAtPreferred = ad->prefSize;
ad->sizeAtExpanding = ad->expSize;
ad->sizeAtMaximum = ad->maxSize;
- // Propagate
- ad->updateChildrenSizes();
-
sizeHints[orientation][Qt::MinimumSize] = ad->sizeAtMinimum;
sizeHints[orientation][Qt::PreferredSize] = ad->sizeAtPreferred;
sizeHints[orientation][Qt::MaximumSize] = ad->sizeAtMaximum;
sizeAtExpanding[orientation] = ad->sizeAtExpanding;
}
- // Delete the constraints, we won't use them anymore.
- qDeleteAll(sizeHintConstraints);
- sizeHintConstraints.clear();
+#if defined(QT_DEBUG) || defined(Q_AUTOTEST_EXPORT)
+ lastCalculationUsedSimplex[orientation] = needsSimplex;
+#endif
- // For the other parts that not the trunk, solve only for the preferred size
- // that is the size they will remain at, since they are not stretched by the
- // layout.
+ return feasible;
+}
- // Solve the other only for preferred, skip trunk
- if (feasible) {
- for (int i = 1; i < parts.count(); ++i) {
- QList<QSimplexConstraint *> partConstraints = parts[i];
- QList<AnchorData *> partVariables = getVariables(partConstraints);
- Q_ASSERT(!partVariables.isEmpty());
-
- sizeHintConstraints = constraintsFromSizeHints(partVariables);
- partConstraints += sizeHintConstraints;
- feasible &= solvePreferred(partConstraints);
- if (!feasible)
- break;
-
- // Propagate size at preferred to other sizes. Semi-floats
- // always will be in their sizeAtPreferred.
- for (int j = 0; j < partVariables.count(); ++j) {
- AnchorData *ad = partVariables[j];
- Q_ASSERT(ad);
- ad->sizeAtMinimum = ad->sizeAtPreferred;
- ad->sizeAtExpanding = ad->sizeAtPreferred;
- ad->sizeAtMaximum = ad->sizeAtPreferred;
- ad->updateChildrenSizes();
- }
+/*!
+ \internal
+*/
+bool QGraphicsAnchorLayoutPrivate::calculateNonTrunk(const QList<QSimplexConstraint *> &constraints,
+ const QList<AnchorData *> &variables)
+{
+ QList<QSimplexConstraint *> sizeHintConstraints = constraintsFromSizeHints(variables);
+ bool feasible = solvePreferred(constraints + sizeHintConstraints, variables);
- // Delete the constraints, we won't use them anymore.
- qDeleteAll(sizeHintConstraints);
- sizeHintConstraints.clear();
+ if (feasible) {
+ // Propagate size at preferred to other sizes. Semi-floats always will be
+ // in their sizeAtPreferred.
+ for (int j = 0; j < variables.count(); ++j) {
+ AnchorData *ad = variables[j];
+ Q_ASSERT(ad);
+ ad->sizeAtMinimum = ad->sizeAtPreferred;
+ ad->sizeAtExpanding = ad->sizeAtPreferred;
+ ad->sizeAtMaximum = ad->sizeAtPreferred;
}
}
- graphHasConflicts[orientation] = !feasible;
- // Clean up our data structures. They are not needed anymore since
- // distribution uses just interpolation.
- qDeleteAll(constraints[orientation]);
- constraints[orientation].clear();
- graphPaths[orientation].clear(); // ###
+ qDeleteAll(sizeHintConstraints);
+ return feasible;
}
/*!
@@ -1876,6 +1937,20 @@ void QGraphicsAnchorLayoutPrivate::constraintsFromPaths(Orientation orientation)
/*!
\internal
+*/
+void QGraphicsAnchorLayoutPrivate::updateAnchorSizes(Orientation orientation)
+{
+ Graph<AnchorVertex, AnchorData> &g = graph[orientation];
+ const QList<QPair<AnchorVertex *, AnchorVertex *> > &vertices = g.connections();
+
+ for (int i = 0; i < vertices.count(); ++i) {
+ AnchorData *ad = g.edgeData(vertices.at(i).first, vertices.at(i).second);
+ ad->updateChildrenSizes();
+ }
+}
+
+/*!
+ \internal
Create LP constraints for each anchor based on its minimum and maximum
sizes, as specified in its size hints
@@ -2160,39 +2235,26 @@ void QGraphicsAnchorLayoutPrivate::calculateVertexPositions(
\internal
Calculate interpolation parameters based on current Layout Size.
- Must once before calling "interpolateEdgeSize()" for each edge.
+ Must be called once before calling "interpolateEdgeSize()" for
+ the edges.
*/
void QGraphicsAnchorLayoutPrivate::setupEdgesInterpolation(
Orientation orientation)
{
Q_Q(QGraphicsAnchorLayout);
- qreal lower, upper, current;
- if (orientation == Horizontal) {
- current = q->contentsRect().width();
- } else {
- current = q->contentsRect().height();
- }
+ qreal current;
+ current = (orientation == Horizontal) ? q->contentsRect().width() : q->contentsRect().height();
- if (current < sizeHints[orientation][Qt::PreferredSize]) {
- interpolationInterval[orientation] = MinToPreferred;
- lower = sizeHints[orientation][Qt::MinimumSize];
- upper = sizeHints[orientation][Qt::PreferredSize];
- } else if (current < sizeAtExpanding[orientation]) {
- interpolationInterval[orientation] = PreferredToExpanding;
- lower = sizeHints[orientation][Qt::PreferredSize];
- upper = sizeAtExpanding[orientation];
- } else {
- interpolationInterval[orientation] = ExpandingToMax;
- lower = sizeAtExpanding[orientation];
- upper = sizeHints[orientation][Qt::MaximumSize];
- }
+ QPair<Interval, qreal> result;
+ result = getFactor(current,
+ sizeHints[orientation][Qt::MinimumSize],
+ sizeHints[orientation][Qt::PreferredSize],
+ sizeAtExpanding[orientation],
+ sizeHints[orientation][Qt::MaximumSize]);
- if (upper == lower) {
- interpolationProgress[orientation] = 0;
- } else {
- interpolationProgress[orientation] = (current - lower) / (upper - lower);
- }
+ interpolationInterval[orientation] = result.first;
+ interpolationProgress[orientation] = result.second;
}
/*!
@@ -2219,20 +2281,11 @@ void QGraphicsAnchorLayoutPrivate::interpolateEdge(AnchorVertex *base,
AnchorData *edge,
Orientation orientation)
{
- qreal lower, upper;
+ const QPair<Interval, qreal> factor(interpolationInterval[orientation],
+ interpolationProgress[orientation]);
- if (interpolationInterval[orientation] == MinToPreferred) {
- lower = edge->sizeAtMinimum;
- upper = edge->sizeAtPreferred;
- } else if (interpolationInterval[orientation] == PreferredToExpanding) {
- lower = edge->sizeAtPreferred;
- upper = edge->sizeAtExpanding;
- } else {
- lower = edge->sizeAtExpanding;
- upper = edge->sizeAtMaximum;
- }
-
- qreal edgeDistance = (interpolationProgress[orientation] * (upper - lower)) + lower;
+ qreal edgeDistance = interpolate(factor, edge->sizeAtMinimum, edge->sizeAtPreferred,
+ edge->sizeAtExpanding, edge->sizeAtMaximum);
Q_ASSERT(edge->from == base || edge->to == base);
@@ -2303,7 +2356,7 @@ void QGraphicsAnchorLayoutPrivate::interpolateSequentialEdges(
interpolateEdge(prev, data->m_edges.last(), orientation);
}
-bool QGraphicsAnchorLayoutPrivate::solveMinMax(QList<QSimplexConstraint *> constraints,
+bool QGraphicsAnchorLayoutPrivate::solveMinMax(const QList<QSimplexConstraint *> &constraints,
GraphPath path, qreal *min, qreal *max)
{
QSimplex simplex;
@@ -2344,9 +2397,9 @@ bool QGraphicsAnchorLayoutPrivate::solveMinMax(QList<QSimplexConstraint *> const
return feasible;
}
-bool QGraphicsAnchorLayoutPrivate::solvePreferred(QList<QSimplexConstraint *> constraints)
+bool QGraphicsAnchorLayoutPrivate::solvePreferred(const QList<QSimplexConstraint *> &constraints,
+ const QList<AnchorData *> &variables)
{
- QList<AnchorData *> variables = getVariables(constraints);
QList<QSimplexConstraint *> preferredConstraints;
QList<QSimplexVariable *> preferredVariables;
QSimplexConstraint objective;
@@ -2369,7 +2422,7 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(QList<QSimplexConstraint *> co
// A + A_shrinker - A_grower = A_pref
//
for (int i = 0; i < variables.size(); ++i) {
- AnchorData *ad = static_cast<AnchorData *>(variables[i]);
+ AnchorData *ad = variables[i];
if (ad->skipInPreferred)
continue;
@@ -2400,7 +2453,7 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(QList<QSimplexConstraint *> co
// Save sizeAtPreferred results
for (int i = 0; i < variables.size(); ++i) {
- AnchorData *ad = static_cast<AnchorData *>(variables[i]);
+ AnchorData *ad = variables[i];
ad->sizeAtPreferred = ad->result;
}
@@ -2461,9 +2514,9 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(QList<QSimplexConstraint *> co
expanding ones will shrink. Only after non-expanding anchors have
shrinked all the way, the expanding anchors will start to shrink too.
*/
-void QGraphicsAnchorLayoutPrivate::solveExpanding(QList<QSimplexConstraint *> constraints)
+void QGraphicsAnchorLayoutPrivate::solveExpanding(const QList<QSimplexConstraint *> &constraints,
+ const QList<AnchorData *> &variables)
{
- QList<AnchorData *> variables = getVariables(constraints);
QList<QSimplexConstraint *> itemConstraints;
QSimplexConstraint *objective = new QSimplexConstraint;
bool hasExpanding = false;
@@ -2566,9 +2619,9 @@ bool QGraphicsAnchorLayoutPrivate::hasConflicts() const
}
#ifdef QT_DEBUG
-void QGraphicsAnchorLayoutPrivate::dumpGraph()
+void QGraphicsAnchorLayoutPrivate::dumpGraph(const QString &name)
{
- QFile file(QString::fromAscii("anchorlayout.dot"));
+ QFile file(QString::fromAscii("anchorlayout.%1.dot").arg(name));
if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate))
qWarning("Could not write to %s", file.fileName().toLocal8Bit().constData());
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
index 9ac0e19..d45c004 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
@@ -169,16 +169,9 @@ struct AnchorData : public QSimplexVariable {
QString name;
#endif
- inline void setFixedSize(qreal size)
+ inline void setPreferredSize(qreal size)
{
- minSize = size;
prefSize = size;
- expSize = size;
- maxSize = size;
- sizeAtMinimum = size;
- sizeAtPreferred = size;
- sizeAtExpanding = size;
- sizeAtMaximum = size;
hasSize = true;
}
@@ -316,8 +309,11 @@ public:
void unsetSpacing();
qreal spacing() const;
+ void setSizePolicy(QSizePolicy::Policy policy);
+
QGraphicsAnchorLayoutPrivate *layoutPrivate;
AnchorData *data;
+ QSizePolicy::Policy sizePolicy;
};
@@ -438,9 +434,17 @@ public:
void calculateGraphs();
void calculateGraphs(Orientation orientation);
+
+ bool calculateTrunk(Orientation orientation, const GraphPath &trunkPath,
+ const QList<QSimplexConstraint *> &constraints,
+ const QList<AnchorData *> &variables);
+ bool calculateNonTrunk(const QList<QSimplexConstraint *> &constraints,
+ const QList<AnchorData *> &variables);
+
void setAnchorSizeHintsFromItems(Orientation orientation);
void findPaths(Orientation orientation);
void constraintsFromPaths(Orientation orientation);
+ void updateAnchorSizes(Orientation orientation);
QList<QSimplexConstraint *> constraintsFromSizeHints(const QList<AnchorData *> &anchors);
QList<QList<QSimplexConstraint *> > getGraphParts(Orientation orientation);
void identifyFloatItems(const QSet<AnchorData *> &visited, Orientation orientation);
@@ -471,14 +475,16 @@ public:
Orientation orientation);
// Linear Programming solver methods
- bool solveMinMax(QList<QSimplexConstraint *> constraints,
+ bool solveMinMax(const QList<QSimplexConstraint *> &constraints,
GraphPath path, qreal *min, qreal *max);
- bool solvePreferred(QList<QSimplexConstraint *> constraints);
- void solveExpanding(QList<QSimplexConstraint *> constraints);
+ bool solvePreferred(const QList<QSimplexConstraint *> &constraints,
+ const QList<AnchorData *> &variables);
+ void solveExpanding(const QList<QSimplexConstraint *> &constraints,
+ const QList<AnchorData *> &variables);
bool hasConflicts() const;
#ifdef QT_DEBUG
- void dumpGraph();
+ void dumpGraph(const QString &name = QString());
#endif
@@ -513,7 +519,13 @@ public:
bool graphHasConflicts[2];
QSet<QGraphicsLayoutItem *> m_floatItems[2];
+#if defined(QT_DEBUG) || defined(Q_AUTOTEST_EXPORT)
+ bool lastCalculationUsedSimplex[2];
+#endif
+
uint calculateGraphCacheDirty : 1;
+
+ friend class QGraphicsAnchorPrivate;
};
QT_END_NAMESPACE
diff --git a/src/gui/graphicsview/qgraphicsgridlayout.cpp b/src/gui/graphicsview/qgraphicsgridlayout.cpp
index d1d91db..9a8dba0 100644
--- a/src/gui/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsgridlayout.cpp
@@ -63,7 +63,7 @@
You can access each item in the layout by calling count() and itemAt(). Calling
removeAt() will remove an item from the layout, without
destroying it.
-
+
\sa QGraphicsLinearLayout, QGraphicsWidget
*/
@@ -89,7 +89,7 @@ public:
QLayoutStyleInfo styleInfo() const;
QGridLayoutEngine engine;
-#ifdef QT_DEBUG
+#ifdef QT_DEBUG
void dump(int indent) const;
#endif
};
@@ -121,7 +121,7 @@ QGraphicsGridLayout::~QGraphicsGridLayout()
for (int i = count() - 1; i >= 0; --i) {
QGraphicsLayoutItem *item = itemAt(i);
// The following lines can be removed, but this removes the item
- // from the layout more efficiently than the implementation of
+ // from the layout more efficiently than the implementation of
// ~QGraphicsLayoutItem.
removeAt(i);
if (item) {
@@ -141,18 +141,22 @@ void QGraphicsGridLayout::addItem(QGraphicsLayoutItem *item, int row, int column
{
Q_D(QGraphicsGridLayout);
if (row < 0 || column < 0) {
- qWarning("QGraphicsGridLayout::addItem: invalid row/column: %d",
- row < 0 ? row : column);
- return;
+ qWarning("QGraphicsGridLayout::addItem: invalid row/column: %d",
+ row < 0 ? row : column);
+ return;
}
if (columnSpan < 1 || rowSpan < 1) {
- qWarning("QGraphicsGridLayout::addItem: invalid row span/column span: %d",
- rowSpan < 1 ? rowSpan : columnSpan);
- return;
+ qWarning("QGraphicsGridLayout::addItem: invalid row span/column span: %d",
+ rowSpan < 1 ? rowSpan : columnSpan);
+ return;
}
if (!item) {
- qWarning("QGraphicsGridLayout::addItem: cannot add null item");
- return;
+ qWarning("QGraphicsGridLayout::addItem: cannot add null item");
+ return;
+ }
+ if (item == this) {
+ qWarning("QGraphicsGridLayout::addItem: cannot insert itself");
+ return;
}
d->addChildLayoutItem(item);
@@ -647,5 +651,5 @@ QSizePolicy::ControlTypes QGraphicsGridLayout::controlTypes(LayoutSide side) con
#endif
QT_END_NAMESPACE
-
-#endif //QT_NO_GRAPHICSVIEW
+
+#endif //QT_NO_GRAPHICSVIEW
diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp
index 0aa68df..7ff7c9b 100644
--- a/src/gui/graphicsview/qgraphicslinearlayout.cpp
+++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp
@@ -272,6 +272,10 @@ void QGraphicsLinearLayout::insertItem(int index, QGraphicsLayoutItem *item)
qWarning("QGraphicsLinearLayout::insertItem: cannot insert null item");
return;
}
+ if (item == this) {
+ qWarning("QGraphicsLinearLayout::insertItem: cannot insert itself");
+ return;
+ }
d->addChildLayoutItem(item);
Q_ASSERT(item);
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 9ae8d72..666d608 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -496,11 +496,12 @@ void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags
mode = EColor16MU;
break;
case QImage::Format_ARGB32_Premultiplied:
-#if !defined(__SERIES60_31__) && !defined(__S60_32__)
- mode = EColor16MAP;
- break;
-#endif
- destFormat = QImage::Format_ARGB32;
+ if (S60->supportsPremultipliedAlpha) {
+ mode = Q_SYMBIAN_ECOLOR16MAP;
+ break;
+ } else {
+ destFormat = QImage::Format_ARGB32;
+ }
// Fall through intended
case QImage::Format_ARGB32:
mode = EColor16MA;
@@ -690,6 +691,10 @@ void QS60PixmapData::beginDataAccess()
bytes = newBytes;
TDisplayMode mode = cfbsBitmap->DisplayMode();
QImage::Format format = qt_TDisplayMode2Format(mode);
+ //on S60 3.1, premultiplied alpha pixels are stored in a bitmap with 16MA type
+ if (format == QImage::Format_ARGB32)
+ format = QImage::Format_ARGB32_Premultiplied; // pixel data is actually in premultiplied format
+
TSize size = cfbsBitmap->SizeInPixels();
QVector<QRgb> savedColorTable;
@@ -794,8 +799,8 @@ void* QS60PixmapData::toNativeType(NativeType type)
bool needsCopy = false;
QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
- if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) {
- // Convert argb32_premultiplied to argb32 since Symbian 9.2 and Symbian 9.3 do
+ if (!(S60->supportsPremultipliedAlpha)) {
+ // Convert argb32_premultiplied to argb32 since Symbian 9.2 does
// not support premultipied format.
if (image.format() == QImage::Format_ARGB32_Premultiplied) {
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index 9b0b00f..1d9b6e0 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -1105,13 +1105,13 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
++row;
if (row >= rowCount)
return QModelIndex();
- return d->model->index(row, 0, d->root);
+ return d->model->index(row, d->column, d->root);
}
const QRect initialRect = rectForIndex(current);
QRect rect = initialRect;
if (rect.isEmpty()) {
- return d->model->index(0, 0, d->root);
+ return d->model->index(0, d->column, d->root);
}
if (d->gridSize().isValid()) rect.setSize(d->gridSize());
@@ -2490,7 +2490,7 @@ bool QIconModeViewBase::filterDropEvent(QDropEvent *e)
for (int i = 0; i < indexes.count(); ++i) {
QModelIndex index = indexes.at(i);
QRect rect = dd->rectForIndex(index);
- viewport()->update(mapToViewport(rect));
+ viewport()->update(dd->mapToViewport(rect, false));
QPoint dest = rect.topLeft() + delta;
if (qq->isRightToLeft())
dest.setX(dd->flipX(dest.x()) - rect.width());
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index a610b73..2a937f1 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -1599,7 +1599,7 @@ QModelIndex QTableView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifi
break;
visualColumn = right + 1;
if (visualRow == 0) {
- wrapped == true;
+ wrapped = true;
visualRow = bottom;
} else {
--visualRow;
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 6f6d706..f48c551 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -68,9 +68,6 @@
#include "private/qstylesheetstyle_p.h"
#include "private/qstyle_p.h"
#include "qmessagebox.h"
-#include "qlineedit.h"
-#include "qlistview.h"
-#include "qtextedit.h"
#include <QtGui/qgraphicsproxywidget.h>
#include "qinputcontext.h"
@@ -2501,6 +2498,8 @@ void QApplication::setActiveWindow(QWidget* act)
*/
QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool next)
{
+ uint focus_flag = qt_tab_all_widgets ? Qt::TabFocus : Qt::StrongFocus;
+
QWidget *f = toplevel->focusWidget();
if (!f)
f = toplevel;
@@ -2508,22 +2507,11 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool
QWidget *w = f;
QWidget *test = f->d_func()->focus_next;
while (test && test != f) {
- if ((test->focusPolicy() & Qt::TabFocus)
+ if ((test->focusPolicy() & focus_flag) == focus_flag
&& !(test->d_func()->extra && test->d_func()->extra->focus_proxy)
&& test->isVisibleTo(toplevel) && test->isEnabled()
&& !(w->windowType() == Qt::SubWindow && !w->isAncestorOf(test))
- && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))
- && (qt_tab_all_widgets
-#ifndef QT_NO_LINEEDIT
- || qobject_cast<QLineEdit*>(test)
-#endif
-#ifndef QT_NO_TEXTEDIT
- || qobject_cast<QTextEdit*>(test)
-#endif
-#ifndef QT_NO_ITEMVIEWS
- || qobject_cast<QListView*>(test)
-#endif
- )) {
+ && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))) {
w = test;
if (next)
break;
@@ -2662,7 +2650,10 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) {
if (!isAlien(w))
break;
if (w->testAttribute(Qt::WA_SetCursor)) {
- parentOfLeavingCursor = w->parentWidget();
+ QWidget *parent = w->parentWidget();
+ while (parent && parent->d_func()->data.in_destructor)
+ parent = parent->parentWidget();
+ parentOfLeavingCursor = parent;
//continue looping, we need to find the downest alien widget with a cursor.
// (downest on the screen)
}
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index cb9dda4..656bbc9 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1056,6 +1056,13 @@ void qt_init(QApplicationPrivate * /* priv */, int)
TDisplayMode mode = S60->screenDevice()->DisplayMode();
S60->screenDepth = TDisplayModeUtils::NumDisplayModeBitsPerPixel(mode);
+ //NB: RWsSession::GetColorModeList tells you what window modes are supported,
+ //not what bitmap formats.
+ if(QSysInfo::symbianVersion() == QSysInfo::SV_9_2)
+ S60->supportsPremultipliedAlpha = 0;
+ else
+ S60->supportsPremultipliedAlpha = 1;
+
RProcess me;
TSecureId securId = me.SecureId();
S60->uid = securId.operator TUid();
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index d33791b..e25bc81 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -81,6 +81,9 @@ QT_BEGIN_NAMESPACE
// system events seems to start with 0x10
const TInt KInternalStatusPaneChange = 0x50000000;
+//this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2
+#define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13)
+
class QS60Data
{
public:
@@ -108,6 +111,7 @@ public:
int mouseInteractionEnabled : 1;
int virtualMouseRequired : 1;
int qtOwnsS60Environment : 1;
+ int supportsPremultipliedAlpha : 1;
QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type
static inline void updateScreenSize();
static inline RWsSession& wsSession();
@@ -199,7 +203,7 @@ inline void QS60Data::updateScreenSize()
S60->screenHeightInPixels = params.iPixelSize.iHeight;
S60->screenWidthInTwips = params.iTwipsSize.iWidth;
S60->screenHeightInTwips = params.iTwipsSize.iHeight;
-
+
S60->virtualMouseMaxAccel = qMax(S60->screenHeightInPixels, S60->screenWidthInPixels) / 20;
TReal inches = S60->screenHeightInTwips / (TReal)KTwipsPerInch;
@@ -302,11 +306,9 @@ static inline QImage::Format qt_TDisplayMode2Format(TDisplayMode mode)
case EColor16MA:
format = QImage::Format_ARGB32;
break;
-#if !defined(__SERIES60_31__) && !defined(__S60_32__)
- case EColor16MAP:
+ case Q_SYMBIAN_ECOLOR16MAP:
format = QImage::Format_ARGB32_Premultiplied;
break;
-#endif
default:
format = QImage::Format_Invalid;
break;
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index c966aa3..05c6a5b 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -305,6 +305,8 @@ bool qt_mac_insideKeyWindow(const QWidget *w)
{
#ifdef QT_MAC_USE_COCOA
return [[reinterpret_cast<NSView *>(w->winId()) window] isKeyWindow];
+#else
+ Q_UNUSED(w);
#endif
return false;
}
@@ -3301,7 +3303,11 @@ void QWidgetPrivate::show_sys()
[window miniaturize:window];
#endif
} else if (!q->testAttribute(Qt::WA_ShowWithoutActivating)) {
+#ifndef QT_MAC_USE_COCOA
qt_event_request_activate(q);
+#else
+ [qt_mac_window_for(q) makeKeyWindow];
+#endif
}
} else if(topData()->embedded || !q->parentWidget() || q->parentWidget()->isVisible()) {
#ifndef QT_MAC_USE_COCOA
@@ -3404,8 +3410,13 @@ void QWidgetPrivate::hide_sys()
}
#endif
}
- if(w && w->isVisible() && !w->isMinimized())
- qt_event_request_activate(w);
+ if(w && w->isVisible() && !w->isMinimized()) {
+#ifndef QT_MAC_USE_COCOA
+ qt_event_request_activate(w);
+#else
+ [qt_mac_window_for(w) makeKeyWindow];
+#endif
+ }
}
} else {
invalidateBuffer(q->rect());
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 4fa1d03..6d95336 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -1313,7 +1313,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
painter->save();
painter->setClipRect(voptAdj.rect);
- const bool isSelected = (voptAdj.state & QStyle::State_HasFocus);
+ const bool isSelected = (vopt->state & QStyle::State_Selected);
bool isVisible = false;
int scrollBarWidth = 0;
@@ -1358,7 +1358,27 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
// draw the focus rect
if (isSelected) {
- const QRect highlightRect = option->rect.adjusted(1,1,-1,-1);
+ QRect highlightRect = option->rect.adjusted(1,1,-1,-1);
+ const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget);
+ if (view && view->selectionBehavior() != QAbstractItemView::SelectItems) {
+ // set highlight rect so that it is continuous from cell to cell, yet sligthly
+ // smaller than cell rect
+ int xBeginning = 0, yBeginning = 0, xEnd = 0, yEnd = 0;
+ if (view->selectionBehavior() == QAbstractItemView::SelectRows) {
+ yBeginning = 1; yEnd = -1;
+ if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning)
+ xBeginning = 1;
+ else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End)
+ xEnd = -1;
+ } else if (view->selectionBehavior() == QAbstractItemView::SelectColumns) {
+ xBeginning = 1; xEnd = -1;
+ if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning)
+ yBeginning = 1;
+ else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End)
+ yEnd = -1;
+ }
+ highlightRect = option->rect.adjusted(xBeginning, yBeginning, xEnd, xBeginning);
+ }
QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, highlightRect, flags);
}
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index cde48d8..d760016 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -747,9 +747,8 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFr
QPixmap result;
// QS60WindowSurface::unlockBitmapHeap();
- static const bool canDoEColor16MAP = !(QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2);
- static const TDisplayMode displayMode = canDoEColor16MAP ? TDisplayMode(13) : EColor16MA; // 13 = EColor16MAP
- static const TInt drawParam = canDoEColor16MAP ? KAknsDrawParamDefault : KAknsDrawParamNoClearUnderImage|KAknsDrawParamRGBOnly;
+ static const TDisplayMode displayMode = S60->supportsPremultipliedAlpha ? Q_SYMBIAN_ECOLOR16MAP : EColor16MA;
+ static const TInt drawParam = S60->supportsPremultipliedAlpha ? KAknsDrawParamDefault : KAknsDrawParamNoClearUnderImage|KAknsDrawParamRGBOnly;
CFbsBitmap *frame = new (ELeave) CFbsBitmap(); //offscreen
CleanupStack::PushL(frame);
@@ -776,7 +775,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFr
frameSkinID, centerSkinID,
drawParam );
- if (canDoEColor16MAP) {
+ if (S60->supportsPremultipliedAlpha) {
if (drawn)
result = fromFbsBitmap(frame, NULL, flags, QImage::Format_ARGB32_Premultiplied);
} else {
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index d11083f..8ce437d 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -830,7 +830,6 @@ static OSStatus atsuPostLayoutCallback(ATSULayoutOperationSelector selector, ATS
surrogates += (str[i].unicode() >= 0xd800 && str[i].unicode() < 0xdc00
&& str[i+1].unicode() >= 0xdc00 && str[i+1].unicode() < 0xe000);
}
- Q_ASSERT(*nfo->numGlyphs == item->length - surrogates);
#endif
for (nextCharStop = item->from; nextCharStop < item->from + item->length; ++nextCharStop)
if (item->charAttributes[nextCharStop].charStop)
@@ -856,10 +855,13 @@ static OSStatus atsuPostLayoutCallback(ATSULayoutOperationSelector selector, ATS
QFixed xAdvance = FixedToQFixed(layoutData[glyphIdx + 1].realPos - layoutData[glyphIdx].realPos);
if (glyphId != 0xffff || i == 0) {
- nfo->glyphs->glyphs[i] = (glyphId & 0x00ffffff) | (fontIdx << 24);
+ if (i < nfo->glyphs->numGlyphs)
+ {
+ nfo->glyphs->glyphs[i] = (glyphId & 0x00ffffff) | (fontIdx << 24);
- nfo->glyphs->advances_y[i] = yAdvance;
- nfo->glyphs->advances_x[i] = xAdvance;
+ nfo->glyphs->advances_y[i] = yAdvance;
+ nfo->glyphs->advances_x[i] = xAdvance;
+ }
} else {
// ATSUI gives us 0xffff as glyph id at the index in the glyph array for
// a character position that maps to a ligtature. Such a glyph id does not
@@ -1029,6 +1031,8 @@ bool QFontEngineMacMulti::stringToCMapInternal(const QChar *str, int len, QGlyph
nfo.flags = flags;
nfo.shaperItem = shaperItem;
+ int prevNumGlyphs = *nglyphs;
+
QVarLengthArray<int> mappedFonts(len);
for (int i = 0; i < len; ++i)
mappedFonts[i] = 0;
@@ -1140,6 +1144,8 @@ bool QFontEngineMacMulti::stringToCMapInternal(const QChar *str, int len, QGlyph
}
ATSUClearLayoutCache(textLayout, kATSUFromTextBeginning);
+ if (prevNumGlyphs < *nfo.numGlyphs)
+ return false;
return true;
}
diff --git a/src/gui/text/qtextengine_mac.cpp b/src/gui/text/qtextengine_mac.cpp
index 4f20094..e101830 100644
--- a/src/gui/text/qtextengine_mac.cpp
+++ b/src/gui/text/qtextengine_mac.cpp
@@ -50,7 +50,6 @@ static void heuristicSetGlyphAttributes(const QChar *uc, int length, QGlyphLayou
{
// ### zeroWidth and justification are missing here!!!!!
- Q_ASSERT(num_glyphs <= length);
Q_UNUSED(num_glyphs);
// qDebug("QScriptEngine::heuristicSetGlyphAttributes, num_glyphs=%d", item->num_glyphs);
@@ -596,7 +595,7 @@ void QTextEngine::shapeTextMac(int item) const
}
while (true) {
- ensureSpace(num_glyphs);
+ ensureSpace(num_glyphs);
num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used;
QGlyphLayout g = availableGlyphs(&si);
@@ -611,9 +610,9 @@ void QTextEngine::shapeTextMac(int item) const
log_clusters,
attributes())) {
- heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs);
- break;
- }
+ heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs);
+ break;
+ }
}
si.num_glyphs = num_glyphs;
diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp
index 10f8db8..2231b98 100644
--- a/src/gui/widgets/qdialogbuttonbox.cpp
+++ b/src/gui/widgets/qdialogbuttonbox.cpp
@@ -873,6 +873,11 @@ void QDialogButtonBox::setOrientation(Qt::Orientation orientation)
void QDialogButtonBox::clear()
{
Q_D(QDialogButtonBox);
+#ifdef QT_SOFTKEYS_ENABLED
+ // Delete softkey actions as they have the buttons as parents
+ qDeleteAll(d->softKeyActions.values());
+ d->softKeyActions.clear();
+#endif
// Remove the created standard buttons, they should be in the other lists, which will
// do the deletion
d->standardButtonHash.clear();
@@ -1025,6 +1030,11 @@ QPushButton *QDialogButtonBox::addButton(StandardButton button)
void QDialogButtonBox::setStandardButtons(StandardButtons buttons)
{
Q_D(QDialogButtonBox);
+#ifdef QT_SOFTKEYS_ENABLED
+ // Delete softkey actions since they have the buttons as parents
+ qDeleteAll(d->softKeyActions.values());
+ d->softKeyActions.clear();
+#endif
// Clear out all the old standard buttons, then recreate them.
qDeleteAll(d->standardButtonHash.keys());
d->standardButtonHash.clear();
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index cee38ee..b238faf 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -1771,6 +1771,16 @@ QMenuBarPrivate::QMacMenuBarPrivate::removeAction(QMacMenuAction *action)
actionItems.removeAll(action);
}
+bool QMenuBarPrivate::macWidgetHasNativeMenubar(QWidget *widget)
+{
+ // This function is different from q->isNativeMenuBar(), as
+ // it returns true only if a native menu bar is actually
+ // _created_.
+ if (!widget)
+ return false;
+ return menubars()->contains(widget->window());
+}
+
void
QMenuBarPrivate::macCreateMenuBar(QWidget *parent)
{
@@ -1778,16 +1788,22 @@ QMenuBarPrivate::macCreateMenuBar(QWidget *parent)
static int dontUseNativeMenuBar = -1;
// We call the isNativeMenuBar function here
// because that will make sure that local overrides
- // are dealt with correctly.
+ // are dealt with correctly. q->isNativeMenuBar() will, if not
+ // overridden, depend on the attribute Qt::AA_DontUseNativeMenuBar:
bool qt_mac_no_native_menubar = !q->isNativeMenuBar();
if (qt_mac_no_native_menubar == false && dontUseNativeMenuBar < 0) {
+ // The menubar is set to be native. Let's check (one time only
+ // for all menubars) if this is OK with the rest of the environment.
+ // As a result, Qt::AA_DontUseNativeMenuBar is set. NB: the application
+ // might still choose to not respect, or change, this flag.
bool isPlugin = QApplication::testAttribute(Qt::AA_MacPluginApplication);
bool environmentSaysNo = !qgetenv("QT_MAC_NO_NATIVE_MENUBAR").isEmpty();
dontUseNativeMenuBar = isPlugin || environmentSaysNo;
QApplication::instance()->setAttribute(Qt::AA_DontUseNativeMenuBar, dontUseNativeMenuBar);
qt_mac_no_native_menubar = !q->isNativeMenuBar();
}
- if (!qt_mac_no_native_menubar) {
+ if (qt_mac_no_native_menubar == false) {
+ // INVARIANT: Use native menubar.
extern void qt_event_request_menubarupdate(); //qapplication_mac.cpp
qt_event_request_menubarupdate();
if (!parent && !fallback) {
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index 13e7de4..f2f0722 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -1370,8 +1370,13 @@ void QMenuBarPrivate::handleReparent()
oldWindow = newWindow;
#ifdef Q_WS_MAC
- macDestroyMenuBar();
- macCreateMenuBar(newParent);
+ if (q->isNativeMenuBar() && !macWidgetHasNativeMenubar(newParent)) {
+ // If the new parent got a native menubar from before, keep that
+ // menubar rather than replace it with this one (because a parents
+ // menubar has precedence over children menubars).
+ macDestroyMenuBar();
+ macCreateMenuBar(newParent);
+ }
#endif
#ifdef Q_WS_WINCE
diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h
index 0b27b97..7815969 100644
--- a/src/gui/widgets/qmenubar_p.h
+++ b/src/gui/widgets/qmenubar_p.h
@@ -196,6 +196,7 @@ public:
return 0;
}
} *mac_menubar;
+ bool macWidgetHasNativeMenubar(QWidget *widget);
void macCreateMenuBar(QWidget *);
void macDestroyMenuBar();
OSMenuRef macMenu();
diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp
index 24606bc..ab2026c 100644
--- a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp
+++ b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp
@@ -52,7 +52,7 @@ public:
QGLCustomShaderStagePrivate() :
m_manager(0) {}
- QGLEngineShaderManager* m_manager;
+ QPointer<QGLEngineShaderManager> m_manager;
QByteArray m_source;
};
diff --git a/src/plugins/accessible/widgets/main.cpp b/src/plugins/accessible/widgets/main.cpp
index 667de88..9a9a778 100644
--- a/src/plugins/accessible/widgets/main.cpp
+++ b/src/plugins/accessible/widgets/main.cpp
@@ -234,8 +234,10 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
iface = new QAccessibleDisplay(widget, Grouping);
} else if (classname == QLatin1String("QStatusBar")) {
iface = new QAccessibleWidgetEx(widget, StatusBar);
+#ifndef QT_NO_PROGRESSBAR
} else if (classname == QLatin1String("QProgressBar")) {
- iface = new QAccessibleDisplay(widget);
+ iface = new QAccessibleProgressBar(widget);
+#endif
} else if (classname == QLatin1String("QToolBar")) {
iface = new QAccessibleWidgetEx(widget, ToolBar, widget->windowTitle());
#ifndef QT_NO_MENUBAR
diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp
index 1aadd6c..aa51759 100644
--- a/src/plugins/accessible/widgets/simplewidgets.cpp
+++ b/src/plugins/accessible/widgets/simplewidgets.cpp
@@ -209,6 +209,62 @@ QAccessible::State QAccessibleButton::state(int child) const
return state;
}
+int QAccessibleButton::actionCount()
+{
+ return 1;
+}
+
+void QAccessibleButton::doAction(int actionIndex)
+{
+ switch (actionIndex) {
+ case 0:
+ button()->click();
+ break;
+ }
+}
+
+QString QAccessibleButton::description(int actionIndex)
+{
+ switch (actionIndex) {
+ case 0:
+ return QLatin1String("Clicks the button.");
+ default:
+ return QString();
+ }
+}
+
+QString QAccessibleButton::name(int actionIndex)
+{
+ switch (actionIndex) {
+ case 0:
+ return QLatin1String("Press");
+ default:
+ return QString();
+ }
+}
+
+QString QAccessibleButton::localizedName(int actionIndex)
+{
+ switch (actionIndex) {
+ case 0:
+ return tr("Press");
+ default:
+ return QString();
+ }
+}
+
+QStringList QAccessibleButton::keyBindings(int actionIndex)
+{
+ switch (actionIndex) {
+#ifdef QT_NO_SHORTCUT
+ case 0:
+ return button()->shortcut().toString();
+#endif
+ default:
+ return QStringList();
+ }
+}
+
#ifndef QT_NO_TOOLBUTTON
/*!
\class QAccessibleToolButton
@@ -756,6 +812,34 @@ void QAccessibleLineEdit::scrollToSubstring(int startIndex, int endIndex)
#endif // QT_NO_LINEEDIT
+#ifndef QT_NO_PROGRESSBAR
+QAccessibleProgressBar::QAccessibleProgressBar(QWidget *o)
+ : QAccessibleDisplay(o)
+{
+ Q_ASSERT(progressBar());
+}
+
+QVariant QAccessibleProgressBar::currentValue()
+{
+ return progressBar()->value();
+}
+
+QVariant QAccessibleProgressBar::maximumValue()
+{
+ return progressBar()->maximum();
+}
+
+QVariant QAccessibleProgressBar::minimumValue()
+{
+ return progressBar()->minimum();
+}
+
+QProgressBar *QAccessibleProgressBar::progressBar() const
+{
+ return qobject_cast<QProgressBar *>(object());
+}
+#endif
+
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE
diff --git a/src/plugins/accessible/widgets/simplewidgets.h b/src/plugins/accessible/widgets/simplewidgets.h
index abe5bdc..0c1cf5e 100644
--- a/src/plugins/accessible/widgets/simplewidgets.h
+++ b/src/plugins/accessible/widgets/simplewidgets.h
@@ -42,6 +42,7 @@
#ifndef SIMPLEWIDGETS_H
#define SIMPLEWIDGETS_H
+#include <QtCore/qcoreapplication.h>
#include <QtGui/qaccessible2.h>
#include <QtGui/qaccessiblewidget.h>
@@ -52,9 +53,12 @@ QT_BEGIN_NAMESPACE
class QAbstractButton;
class QLineEdit;
class QToolButton;
+class QProgressBar;
-class QAccessibleButton : public QAccessibleWidgetEx
+class QAccessibleButton : public QAccessibleWidgetEx, public QAccessibleActionInterface
{
+ Q_ACCESSIBLE_OBJECT
+ Q_DECLARE_TR_FUNCTIONS(QAccessibleButton)
public:
QAccessibleButton(QWidget *w, Role r);
@@ -64,6 +68,14 @@ public:
QString actionText(int action, Text text, int child) const;
bool doAction(int action, int child, const QVariantList &params);
+ // QAccessibleActionInterface
+ int actionCount();
+ void doAction(int actionIndex);
+ QString description(int actionIndex);
+ QString name(int actionIndex);
+ QString localizedName(int actionIndex);
+ QStringList keyBindings(int actionIndex);
+
protected:
QAbstractButton *button() const;
};
@@ -101,6 +113,7 @@ protected:
class QAccessibleDisplay : public QAccessibleWidgetEx
{
+ Q_ACCESSIBLE_OBJECT
public:
explicit QAccessibleDisplay(QWidget *w, Role role = StaticText);
@@ -150,6 +163,24 @@ protected:
};
#endif // QT_NO_LINEEDIT
+#ifndef QT_NO_PROGRESSBAR
+class QAccessibleProgressBar : public QAccessibleDisplay, public QAccessibleValueInterface
+{
+ Q_ACCESSIBLE_OBJECT
+public:
+ explicit QAccessibleProgressBar(QWidget *o);
+
+ // QAccessibleValueInterface
+ QVariant currentValue();
+ QVariant maximumValue();
+ QVariant minimumValue();
+ inline void setCurrentValue(const QVariant &) {}
+
+protected:
+ QProgressBar *progressBar() const;
+};
+#endif
+
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c
index c1b655a..a9c22ef 100644
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c
+++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c
@@ -662,7 +662,7 @@ int pvrQwsAllocBuffers(PvrQwsDrawable *drawable)
PVR2DMemFree(pvrQwsDisplay.context, drawable->backBuffers[index]);
}
}
- drawable->stridePixels = (drawable->rect.width + 7) & ~7;
+ drawable->stridePixels = (drawable->rect.width + 31) & ~31;
drawable->strideBytes =
drawable->stridePixels *
pvrQwsDisplay.screens[drawable->screen].bytesPerPixel;
@@ -828,63 +828,3 @@ void pvrQwsSetSwapFunction
drawable->swapFunction = func;
drawable->userData = userData;
}
-
-unsigned long pvrQwsGetMemoryId(PvrQwsDrawable *drawable)
-{
- unsigned long addr;
- unsigned long start;
- unsigned long end;
- unsigned long off;
- unsigned long offset;
- FILE *file;
- char buffer[BUFSIZ];
- char flags[16];
-
- if (!drawable->backBuffersValid)
- return 0;
- addr = (unsigned long)
- (drawable->backBuffers[drawable->currentBackBuffer]->pBase);
-
- /* Search /proc/self/maps for the memory region that contains "addr".
- The file offset for that memory region is the identifier we need */
- file = fopen("/proc/self/maps", "r");
- if (!file) {
- perror("/proc/self/maps");
- return 0;
- }
- offset = 0;
- while (fgets(buffer, sizeof(buffer), file)) {
- if (sscanf(buffer, "%lx-%lx %s %lx",
- &start, &end, flags, &off) < 4)
- continue;
- if (start <= addr && addr < end) {
- offset = off;
- break;
- }
- }
- fclose(file);
- return offset;
-}
-
-void *pvrQwsMapMemory(unsigned long id, int size)
-{
- void *addr;
- int fd = open("/dev/pvrsrv", O_RDWR, 0);
- if (fd < 0) {
- perror("/dev/pvrsrv");
- return 0;
- }
- addr = mmap(0, (size_t)size, PROT_READ | PROT_WRITE,
- MAP_SHARED, fd, (off_t)id);
- if (addr == (void *)(-1)) {
- perror("mmap pvr memory region");
- addr = 0;
- }
- close(fd);
- return addr;
-}
-
-void pvrQwsUnmapMemory(void *addr, int size)
-{
- munmap(addr, size);
-}
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h
index b9e035f..55e0310 100644
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h
+++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h
@@ -162,21 +162,6 @@ int pvrQwsSwapBuffers(PvrQwsDrawable *drawable, int repaintOnly);
void pvrQwsSetSwapFunction
(PvrQwsDrawable *drawable, PvrQwsSwapFunction func, void *userData);
-/* Get a memory identifier for the indicated drawable's buffer.
- The identifier can be passed to another process and then
- passed to pvrQwsMapMemory() to map the drawable's buffer into
- the other process's address space. Returns zero if the
- memory identifier could not be determined. This should only
- be used for pixmap drawables */
-unsigned long pvrQwsGetMemoryId(PvrQwsDrawable *drawable);
-
-/* Map the memory buffer of a foreign application's drawable, as
- indicated by "id" and "size". Returns null if the map failed */
-void *pvrQwsMapMemory(unsigned long id, int size);
-
-/* Unmap the memory obtained from pvrQwsMapMemory() */
-void pvrQwsUnmapMemory(void *addr, int size);
-
#ifdef __cplusplus
};
#endif
diff --git a/src/plugins/gfxdrivers/powervr/README b/src/plugins/gfxdrivers/powervr/README
index 322a6b2..513e7f5 100644
--- a/src/plugins/gfxdrivers/powervr/README
+++ b/src/plugins/gfxdrivers/powervr/README
@@ -31,9 +31,10 @@ strictly Unix-style markers.
* IMPORTANT: To build the QScreen plugin and the WSEGL library it depends *
* on, the pvr2d.h, wsegl.h headers for your platform are required. You *
* can find a copy of these headers in src/3rdparty/powervr for SGX based *
-* platforms like the TI OMAP3xxx. They may also work on MBX platforms too *
-* depending on how old your libEGL is. You can tell Qt where to find *
-* these headers by setting QMAKE_INCDIR_POWERVR in the mkspec. *
+* platforms like the TI OMAP3xxx. They probably will not work on MBX *
+* because of differences in the layout of certain PVR2D structures. *
+* You can tell Qt where to find the actual headers for your system by *
+* setting QMAKE_INCDIR_POWERVR in the mkspec. *
***************************************************************************
When you start a Qt/Embedded application, you should modify the QWS_DISPLAY
diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def
index 7c3542e..97d6bee 100644
--- a/src/s60installs/eabi/QtGuiu.def
+++ b/src/s60installs/eabi/QtGuiu.def
@@ -2288,7 +2288,7 @@ EXPORTS
_ZN13QGestureEvent11setAcceptedEP8QGestureb @ 2287 NONAME
_ZN13QGestureEvent6acceptEP8QGesture @ 2288 NONAME
_ZN13QGestureEvent6ignoreEP8QGesture @ 2289 NONAME
- _ZN13QGestureEvent7gestureEN2Qt11GestureTypeE @ 2290 NONAME
+ _ZN13QGestureEvent7gestureEN2Qt11GestureTypeE @ 2290 NONAME ABSENT ; MISSING:
_ZN13QGestureEventC1ERK5QListIP8QGestureE @ 2291 NONAME
_ZN13QGestureEventC2ERK5QListIP8QGestureE @ 2292 NONAME
_ZN13QGraphicsItem10addToIndexEv @ 2293 NONAME
@@ -2651,8 +2651,8 @@ EXPORTS
_ZN13QSwipeGesture13setSwipeAngleEf @ 2650 NONAME
_ZN13QSwipeGesture16staticMetaObjectE @ 2651 NONAME DATA 16
_ZN13QSwipeGesture19getStaticMetaObjectEv @ 2652 NONAME
- _ZN13QSwipeGesture20setVerticalDirectionENS_14SwipeDirectionE @ 2653 NONAME
- _ZN13QSwipeGesture22setHorizontalDirectionENS_14SwipeDirectionE @ 2654 NONAME
+ _ZN13QSwipeGesture20setVerticalDirectionENS_14SwipeDirectionE @ 2653 NONAME ABSENT ; MISSING:
+ _ZN13QSwipeGesture22setHorizontalDirectionENS_14SwipeDirectionE @ 2654 NONAME ABSENT ; MISSING:
_ZN13QSwipeGestureC1EP7QObject @ 2655 NONAME
_ZN13QSwipeGestureC2EP7QObject @ 2656 NONAME
_ZN13QTextDocument10adjustSizeEv @ 2657 NONAME
@@ -6369,12 +6369,12 @@ EXPORTS
_ZN8QGesture15setTargetObjectEP7QObject @ 6368 NONAME
_ZN8QGesture16staticMetaObjectE @ 6369 NONAME DATA 16
_ZN8QGesture19getStaticMetaObjectEv @ 6370 NONAME
- _ZN8QGestureC1EN2Qt11GestureTypeEP7QObject @ 6371 NONAME
+ _ZN8QGestureC1EN2Qt11GestureTypeEP7QObject @ 6371 NONAME ABSENT ; MISSING:
_ZN8QGestureC1EP7QObject @ 6372 NONAME
- _ZN8QGestureC1ER15QGesturePrivateN2Qt11GestureTypeEP7QObject @ 6373 NONAME
- _ZN8QGestureC2EN2Qt11GestureTypeEP7QObject @ 6374 NONAME
+ _ZN8QGestureC1ER15QGesturePrivateN2Qt11GestureTypeEP7QObject @ 6373 NONAME ABSENT ; MISSING:
+ _ZN8QGestureC2EN2Qt11GestureTypeEP7QObject @ 6374 NONAME ABSENT ; MISSING:
_ZN8QGestureC2EP7QObject @ 6375 NONAME
- _ZN8QGestureC2ER15QGesturePrivateN2Qt11GestureTypeEP7QObject @ 6376 NONAME
+ _ZN8QGestureC2ER15QGesturePrivateN2Qt11GestureTypeEP7QObject @ 6376 NONAME ABSENT ; MISSING:
_ZN8QGestureD0Ev @ 6377 NONAME
_ZN8QGestureD1Ev @ 6378 NONAME
_ZN8QGestureD2Ev @ 6379 NONAME
@@ -11557,4 +11557,29 @@ EXPORTS
qt_pixmap_cleanup_hook @ 11556 NONAME DATA 4
qt_pixmap_cleanup_hook_64 @ 11557 NONAME DATA 4
qt_tab_all_widgets @ 11558 NONAME DATA 1
+ _ZN18QGuiPlatformPlugin11qt_metacallEN11QMetaObject4CallEiPPv @ 11559 NONAME
+ _ZN18QGuiPlatformPlugin11qt_metacastEPKc @ 11560 NONAME
+ _ZN18QGuiPlatformPlugin12platformHintENS_12PlatformHintE @ 11561 NONAME
+ _ZN18QGuiPlatformPlugin14fileSystemIconERK9QFileInfo @ 11562 NONAME
+ _ZN18QGuiPlatformPlugin16staticMetaObjectE @ 11563 NONAME DATA 16
+ _ZN18QGuiPlatformPlugin19getStaticMetaObjectEv @ 11564 NONAME
+ _ZN18QGuiPlatformPlugin19systemIconThemeNameEv @ 11565 NONAME
+ _ZN18QGuiPlatformPlugin20iconThemeSearchPathsEv @ 11566 NONAME
+ _ZN18QGuiPlatformPlugin7paletteEv @ 11567 NONAME
+ _ZN18QGuiPlatformPlugin9styleNameEv @ 11568 NONAME
+ _ZN18QGuiPlatformPluginC1EP7QObject @ 11569 NONAME
+ _ZN18QGuiPlatformPluginC2EP7QObject @ 11570 NONAME
+ _ZN18QGuiPlatformPluginD0Ev @ 11571 NONAME
+ _ZN18QGuiPlatformPluginD1Ev @ 11572 NONAME
+ _ZN18QGuiPlatformPluginD2Ev @ 11573 NONAME
+ _ZN8QGestureC1ER15QGesturePrivateP7QObject @ 11574 NONAME
+ _ZN8QGestureC2ER15QGesturePrivateP7QObject @ 11575 NONAME
+ _ZNK13QGestureEvent7gestureEN2Qt11GestureTypeE @ 11576 NONAME
+ _ZNK18QGuiPlatformPlugin10metaObjectEv @ 11577 NONAME
+ _ZTI18QGuiPlatformPlugin @ 11578 NONAME
+ _ZTI27QGuiPlatformPluginInterface @ 11579 NONAME
+ _ZTV18QGuiPlatformPlugin @ 11580 NONAME
+ _ZThn8_N18QGuiPlatformPluginD0Ev @ 11581 NONAME
+ _ZThn8_N18QGuiPlatformPluginD1Ev @ 11582 NONAME
+ _Z22qt_paint_device_metricPK12QPaintDeviceNS_17PaintDeviceMetricE @ 11583 NONAME
diff --git a/src/s60installs/eabi/QtMultimediau.def b/src/s60installs/eabi/QtMultimediau.def
index 787ad3a..30f921c 100644
--- a/src/s60installs/eabi/QtMultimediau.def
+++ b/src/s60installs/eabi/QtMultimediau.def
@@ -115,8 +115,8 @@ EXPORTS
_ZN19QAbstractAudioInput6notifyEv @ 114 NONAME
_ZN19QVideoSurfaceFormat11setPropertyEPKcRK8QVariant @ 115 NONAME
_ZN19QVideoSurfaceFormat11setViewportERK5QRect @ 116 NONAME
- _ZN19QVideoSurfaceFormat12setFrameRateERK5QPairIiiE @ 117 NONAME
- _ZN19QVideoSurfaceFormat12setFrameRateEii @ 118 NONAME
+ _ZN19QVideoSurfaceFormat12setFrameRateERK5QPairIiiE @ 117 NONAME ABSENT
+ _ZN19QVideoSurfaceFormat12setFrameRateEii @ 118 NONAME ABSENT
_ZN19QVideoSurfaceFormat12setFrameSizeERK5QSizeNS_12ViewportModeE @ 119 NONAME
_ZN19QVideoSurfaceFormat12setFrameSizeEiiNS_12ViewportModeE @ 120 NONAME
_ZN19QVideoSurfaceFormat16setYuvColorSpaceENS_13YuvColorSpaceE @ 121 NONAME
@@ -275,4 +275,6 @@ EXPORTS
_ZThn8_N18QAudioEnginePluginD0Ev @ 274 NONAME
_ZThn8_N18QAudioEnginePluginD1Ev @ 275 NONAME
_Zls6QDebugRK19QVideoSurfaceFormat @ 276 NONAME
+ _ZTV28QAudioEngineFactoryInterface @ 277 NONAME ABSENT
+ _ZN19QVideoSurfaceFormat12setFrameRateEf @ 278 NONAME
diff --git a/src/s60installs/eabi/QtNetworku.def b/src/s60installs/eabi/QtNetworku.def
index f216f85..e561511 100644
--- a/src/s60installs/eabi/QtNetworku.def
+++ b/src/s60installs/eabi/QtNetworku.def
@@ -989,4 +989,6 @@ EXPORTS
_ZlsR11QDataStreamRK21QNetworkCacheMetaData @ 988 NONAME
_ZrsR11QDataStreamR12QHostAddress @ 989 NONAME
_ZrsR11QDataStreamR21QNetworkCacheMetaData @ 990 NONAME
+ _ZN15QNetworkRequest20setOriginatingObjectEP7QObject @ 991 NONAME
+ _ZNK15QNetworkRequest17originatingObjectEv @ 992 NONAME
diff --git a/src/s60installs/eabi/QtScriptu.def b/src/s60installs/eabi/QtScriptu.def
index d0a3e3e..1592664 100644
--- a/src/s60installs/eabi/QtScriptu.def
+++ b/src/s60installs/eabi/QtScriptu.def
@@ -341,4 +341,5 @@ EXPORTS
_ZThn8_N22QScriptExtensionPluginD1Ev @ 340 NONAME
_ZlsR11QDataStreamRK18QScriptContextInfo @ 341 NONAME
_ZrsR11QDataStreamR18QScriptContextInfo @ 342 NONAME
+ _Z5qHashRK13QScriptString @ 343 NONAME
diff --git a/src/s60installs/eabi/QtXmlu.def b/src/s60installs/eabi/QtXmlu.def
index d1ba69d..cc5115c 100644
--- a/src/s60installs/eabi/QtXmlu.def
+++ b/src/s60installs/eabi/QtXmlu.def
@@ -458,4 +458,3 @@ EXPORTS
_ZThn8_N18QXmlDefaultHandler18unparsedEntityDeclERK7QStringS2_S2_S2_ @ 457 NONAME
_ZThn8_NK18QXmlDefaultHandler11errorStringEv @ 458 NONAME
_ZlsR11QTextStreamRK8QDomNode @ 459 NONAME
-
diff --git a/src/s60installs/eabi/phononu.def b/src/s60installs/eabi/phononu.def
index 651a0b8..af1e3cc 100644
--- a/src/s60installs/eabi/phononu.def
+++ b/src/s60installs/eabi/phononu.def
@@ -534,4 +534,14 @@ EXPORTS
_ZThn8_N6Phonon19AbstractAudioOutputD1Ev @ 533 NONAME
_ZThn8_N6Phonon6EffectD0Ev @ 534 NONAME
_ZThn8_N6Phonon6EffectD1Ev @ 535 NONAME
+ _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 536 NONAME
+ _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 537 NONAME
+ _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 538 NONAME
+ _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 539 NONAME
+ _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 540 NONAME
+ _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 541 NONAME
+ _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 542 NONAME
+ _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 543 NONAME
+ _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 544 NONAME
+ _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 545 NONAME