summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-13 10:18:25 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-13 10:18:25 (GMT)
commit33d20d417ea9387b449de96097c3d2b5913a0533 (patch)
treee70a742071e9c7e92f53dd375a444097b117199b /src/gui/kernel
parent3e94b3a77affeef80544e48949e018ced4e0d96e (diff)
parent3c3d5521a94254bf3ce5591e8a326005fcb4d3b1 (diff)
downloadQt-33d20d417ea9387b449de96097c3d2b5913a0533.zip
Qt-33d20d417ea9387b449de96097c3d2b5913a0533.tar.gz
Qt-33d20d417ea9387b449de96097c3d2b5913a0533.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: (48 commits) build fix for S60 Improve handling of QAction in soft key manager Remove useless assert qdrawhelper: fix optim in 2245641ba QSlider and StyleSheet: fix one pixel error while drawing the SliderAddPage accelerate QWindowsPipeWriter for bigger chunks of data Fix antialiasing with transformed text in OpenGL2 paint engine Fix flattening of largely scaled, thin, dashed beziers. Increased the precision used to flatten beziers Fix QT_NO_MOVIE Fix compile error with QT_NO_ACTION in QtGui Fix QT_NO_COMPLETER Fix QT_NO_FSCOMPLETER Fix QT_NO_FILESYSTEMMODEL Build fix Safeguard ourselves against corrupt registry values for cleartype gamma fix cetest build properly qdrawhelper: optimize the fetch transformed bilinear functions Compile fix for WinCE Make sure the selectionChanged signal is not called too much ...
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qaction.cpp1
-rw-r--r--src/gui/kernel/qaction_p.h17
-rw-r--r--src/gui/kernel/qlayoutitem.cpp4
-rw-r--r--src/gui/kernel/qsoftkeymanager.cpp12
-rw-r--r--src/gui/kernel/qsoftkeymanager_p.h3
-rw-r--r--src/gui/kernel/qsoftkeymanager_s60.cpp5
-rw-r--r--src/gui/kernel/qstackedlayout.cpp26
-rw-r--r--src/gui/kernel/qstackedlayout.h2
-rw-r--r--src/gui/kernel/qwidget.cpp17
-rw-r--r--src/gui/kernel/qwidget.h1
-rw-r--r--src/gui/kernel/qwidget_p.h1
11 files changed, 70 insertions, 19 deletions
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp
index 8ddd051..a6d2594 100644
--- a/src/gui/kernel/qaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -81,6 +81,7 @@ static QString qt_strippedText(QString s)
QActionPrivate::QActionPrivate() : group(0), enabled(1), forceDisabled(0),
visible(1), forceInvisible(0), checkable(0), checked(0), separator(0), fontSet(false),
+ forceEnabledInSoftkeys(false), menuActionSoftkeys(false),
menuRole(QAction::TextHeuristicRole), softKeyRole(QAction::NoSoftKey),
priority(QAction::NormalPriority), iconVisibleInMenu(-1)
{
diff --git a/src/gui/kernel/qaction_p.h b/src/gui/kernel/qaction_p.h
index b57e5d2..899b01b 100644
--- a/src/gui/kernel/qaction_p.h
+++ b/src/gui/kernel/qaction_p.h
@@ -75,6 +75,11 @@ public:
QActionPrivate();
~QActionPrivate();
+ static QActionPrivate *get(QAction *q)
+ {
+ return q->d_func();
+ }
+
bool showStatusText(QWidget *w, const QString &str);
QPointer<QActionGroup> group;
@@ -103,10 +108,16 @@ public:
uint checked : 1;
uint separator : 1;
uint fontSet : 1;
- QAction::MenuRole menuRole;
- QAction::SoftKeyRole softKeyRole;
- QAction::Priority priority;
+
+ //for soft keys management
+ uint forceEnabledInSoftkeys : 1;
+ uint menuActionSoftkeys : 1;
+
+ QAction::MenuRole menuRole : 3;
+ QAction::SoftKeyRole softKeyRole : 2;
+ QAction::Priority priority : 14;
int iconVisibleInMenu : 3; // Only has values -1, 0, and 1
+
QList<QWidget *> widgets;
#ifndef QT_NO_GRAPHICSVIEW
QList<QGraphicsWidget *> graphicsWidgets;
diff --git a/src/gui/kernel/qlayoutitem.cpp b/src/gui/kernel/qlayoutitem.cpp
index 6a91d95..e615b2d 100644
--- a/src/gui/kernel/qlayoutitem.cpp
+++ b/src/gui/kernel/qlayoutitem.cpp
@@ -516,9 +516,7 @@ bool QWidgetItem::hasHeightForWidth() const
{
if (isEmpty())
return false;
- if (wid->layout())
- return wid->layout()->hasHeightForWidth();
- return wid->sizePolicy().hasHeightForWidth();
+ return wid->hasHeightForWidth();
}
/*!
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp
index 23f1481..04e4685 100644
--- a/src/gui/kernel/qsoftkeymanager.cpp
+++ b/src/gui/kernel/qsoftkeymanager.cpp
@@ -43,7 +43,7 @@
#include "qevent.h"
#include "qbitmap.h"
#include "private/qsoftkeymanager_p.h"
-#include "private/qobject_p.h"
+#include "private/qaction_p.h"
#include "private/qsoftkeymanager_common_p.h"
#ifdef Q_WS_S60
@@ -104,7 +104,7 @@ QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *act
QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey;
switch (standardKey) {
case MenuSoftKey: // FALL-THROUGH
- action->setProperty(MENU_ACTION_PROPERTY, QVariant(true)); // TODO: can be refactored away to use _q_action_menubar
+ QActionPrivate::get(action)->menuActionSoftkeys = true;
case OkSoftKey:
case SelectSoftKey:
case DoneSoftKey:
@@ -255,16 +255,12 @@ bool QSoftKeyManager::handleUpdateSoftKeys()
void QSoftKeyManager::setForceEnabledInSoftkeys(QAction *action)
{
- action->setProperty(FORCE_ENABLED_PROPERTY, QVariant(true));
+ QActionPrivate::get(action)->forceEnabledInSoftkeys = true;
}
bool QSoftKeyManager::isForceEnabledInSofkeys(QAction *action)
{
- bool ret = false;
- QVariant property = action->property(FORCE_ENABLED_PROPERTY);
- if (property.isValid() && property.toBool())
- ret = true;
- return ret;
+ return QActionPrivate::get(action)->forceEnabledInSoftkeys;
}
bool QSoftKeyManager::event(QEvent *e)
diff --git a/src/gui/kernel/qsoftkeymanager_p.h b/src/gui/kernel/qsoftkeymanager_p.h
index a5b258b..6eedfa8 100644
--- a/src/gui/kernel/qsoftkeymanager_p.h
+++ b/src/gui/kernel/qsoftkeymanager_p.h
@@ -63,9 +63,6 @@ QT_BEGIN_NAMESPACE
class QSoftKeyManagerPrivate;
-const char MENU_ACTION_PROPERTY[] = "_q_menuAction";
-const char FORCE_ENABLED_PROPERTY[] = "_q_forceEnabledInSoftkeys";
-
class Q_AUTOTEST_EXPORT QSoftKeyManager : public QObject
{
Q_OBJECT
diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp
index c0761f0..e4990b1 100644
--- a/src/gui/kernel/qsoftkeymanager_s60.cpp
+++ b/src/gui/kernel/qsoftkeymanager_s60.cpp
@@ -46,6 +46,7 @@
#include "qmenubar.h"
#include "private/qt_s60_p.h"
#include "private/qmenu_p.h"
+#include "private/qaction_p.h"
#include "private/qsoftkeymanager_p.h"
#include "private/qsoftkeymanager_s60_p.h"
#include "private/qobject_p.h"
@@ -382,8 +383,8 @@ bool QSoftKeyManagerPrivateS60::handleCommand(int command)
{
QAction *action = realSoftKeyActions.value(command);
if (action) {
- QVariant property = action->property(MENU_ACTION_PROPERTY);
- if (property.isValid() && property.toBool()) {
+ bool property = QActionPrivate::get(action)->menuActionSoftkeys;
+ if (property) {
QT_TRAP_THROWING(tryDisplayMenuBarL());
} else if (action->menu()) {
// TODO: This is hack, in order to use exising QMenuBar implementation for Symbian
diff --git a/src/gui/kernel/qstackedlayout.cpp b/src/gui/kernel/qstackedlayout.cpp
index 7559066..4b49638 100644
--- a/src/gui/kernel/qstackedlayout.cpp
+++ b/src/gui/kernel/qstackedlayout.cpp
@@ -475,6 +475,32 @@ void QStackedLayout::setGeometry(const QRect &rect)
}
}
+bool QStackedLayout::hasHeightForWidth() const
+{
+ const int n = count();
+
+ for (int i = 0; i < n; ++i) {
+ if (QLayoutItem *item = itemAt(i)) {
+ if (item->hasHeightForWidth())
+ return true;
+ }
+ }
+ return false;
+}
+
+int QStackedLayout::heightForWidth(int width) const
+{
+ const int n = count();
+
+ int hfw = 0;
+ for (int i = 0; i < n; ++i) {
+ if (QLayoutItem *item = itemAt(i)) {
+ hfw = qMax(hfw, item->heightForWidth(width));
+ }
+ }
+ return hfw;
+}
+
/*!
\enum QStackedLayout::StackingMode
\since 4.4
diff --git a/src/gui/kernel/qstackedlayout.h b/src/gui/kernel/qstackedlayout.h
index c069149..842b62b 100644
--- a/src/gui/kernel/qstackedlayout.h
+++ b/src/gui/kernel/qstackedlayout.h
@@ -95,6 +95,8 @@ public:
QLayoutItem *itemAt(int) const;
QLayoutItem *takeAt(int);
void setGeometry(const QRect &rect);
+ bool hasHeightForWidth() const;
+ int heightForWidth(int width) const;
Q_SIGNALS:
void widgetRemoved(int index);
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 4fba8cf..b19f7aa 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -3820,6 +3820,11 @@ void QWidget::setMaximumSize(int maxw, int maxh)
d->updateGeometry_helper(d->extra->minw == d->extra->maxw && d->extra->minh == d->extra->maxh);
}
+bool QWidgetPrivate::hasHeightForWidth() const
+{
+ return layout ? layout->hasHeightForWidth() : size_policy.hasHeightForWidth();
+}
+
/*!
\overload
@@ -7965,6 +7970,18 @@ QSize QWidget::minimumSizeHint() const
return QSize(-1, -1);
}
+/*!
+ \internal
+ This is a bit hackish, but ideally this would have been a virtual
+ function so that subclasses could reimplement their own function.
+ Instead we add a virtual function to QWidgetPrivate.
+*/
+bool QWidget::hasHeightForWidth() const
+{
+ Q_D(const QWidget);
+ return d->hasHeightForWidth();
+}
+
/*!
\fn QWidget *QWidget::parentWidget() const
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index e12148b..6e5de7d 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -524,6 +524,7 @@ public:
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
+ bool hasHeightForWidth() const;
QSizePolicy sizePolicy() const;
void setSizePolicy(QSizePolicy);
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 89ea256..05a859c 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -493,6 +493,7 @@ public:
bool setMinimumSize_helper(int &minw, int &minh);
bool setMaximumSize_helper(int &maxw, int &maxh);
+ virtual bool hasHeightForWidth() const;
void setConstraints_sys();
QWidget *childAt_helper(const QPoint &, bool) const;
void updateGeometry_helper(bool forceUpdate);