summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-04-13 11:05:11 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-04-13 11:05:11 (GMT)
commit6c231c82ac2d277d9593ae46c1309223b185f6fd (patch)
tree723975cb64aed8228908fdba8458c64fe480bbd6 /src/gui
parentf854d363afb6878f3e5260314545d93b9fad41a9 (diff)
parent42fc3d36260c409918431c1fc058ee2d10f6c147 (diff)
downloadQt-6c231c82ac2d277d9593ae46c1309223b185f6fd.zip
Qt-6c231c82ac2d277d9593ae46c1309223b185f6fd.tar.gz
Qt-6c231c82ac2d277d9593ae46c1309223b185f6fd.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qfiledialog_win.cpp1
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp20
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h5
-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.cpp19
-rw-r--r--src/gui/kernel/qwidget.h1
-rw-r--r--src/gui/kernel/qwidget_p.h1
-rw-r--r--src/gui/painting/qdrawhelper.cpp117
-rw-r--r--src/gui/widgets/qsizegrip.cpp17
-rw-r--r--src/gui/widgets/qtabwidget.cpp49
-rw-r--r--src/gui/widgets/qtabwidget.h1
18 files changed, 149 insertions, 152 deletions
diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp
index afeed8e..258707c 100644
--- a/src/gui/dialogs/qfiledialog_win.cpp
+++ b/src/gui/dialogs/qfiledialog_win.cpp
@@ -218,7 +218,6 @@ static OPENFILENAME* qt_win_make_OFN(QWidget *parent,
memset(ofn, 0, sizeof(OPENFILENAME));
ofn->lStructSize = sizeof(OPENFILENAME);
- Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created));
ofn->hwndOwner = parent ? parent->winId() : 0;
ofn->lpstrFilter = (wchar_t*)tFilters.utf16();
ofn->lpstrFile = tInitSel;
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index d6daf4d..150343e 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -7615,11 +7615,26 @@ void QGraphicsObject::updateMicroFocus()
QGraphicsItem::updateMicroFocus();
}
-void QGraphicsItemPrivate::append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item)
+void QGraphicsItemPrivate::children_append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item)
{
QGraphicsItemPrivate::get(item)->setParentItemHelper(static_cast<QGraphicsObject *>(list->object), /*newParentVariant=*/0, /*thisPointerVariant=*/0);
}
+int QGraphicsItemPrivate::children_count(QDeclarativeListProperty<QGraphicsObject> *list)
+{
+ QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(list->object));
+ return d->children.count();
+}
+
+QGraphicsObject *QGraphicsItemPrivate::children_at(QDeclarativeListProperty<QGraphicsObject> *list, int index)
+{
+ QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(list->object));
+ if (index >= 0 && index < d->children.count())
+ return d->children.at(index)->toGraphicsObject();
+ else
+ return 0;
+}
+
/*!
Returns a list of this item's children.
@@ -7632,7 +7647,8 @@ QDeclarativeListProperty<QGraphicsObject> QGraphicsItemPrivate::childrenList()
Q_Q(QGraphicsItem);
if (isObject) {
QGraphicsObject *that = static_cast<QGraphicsObject *>(q);
- return QDeclarativeListProperty<QGraphicsObject>(that, &children, QGraphicsItemPrivate::append);
+ return QDeclarativeListProperty<QGraphicsObject>(that, &children, children_append,
+ children_count, children_at);
} else {
//QGraphicsItem is not supported for this property
return QDeclarativeListProperty<QGraphicsObject>();
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 73b8f04..922581d 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -480,9 +480,12 @@ public:
void resetFocusProxy();
virtual void subFocusItemChange();
+ static void children_append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item);
+ static int children_count(QDeclarativeListProperty<QGraphicsObject> *list);
+ static QGraphicsObject *children_at(QDeclarativeListProperty<QGraphicsObject> *list, int);
+
inline QTransform transformToParent() const;
inline void ensureSortedChildren();
- static void append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item);
static inline bool insertionOrder(QGraphicsItem *a, QGraphicsItem *b);
void ensureSequentialSiblingIndex();
inline void sendScenePosChange();
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 e615b2d..6a91d95 100644
--- a/src/gui/kernel/qlayoutitem.cpp
+++ b/src/gui/kernel/qlayoutitem.cpp
@@ -516,7 +516,9 @@ bool QWidgetItem::hasHeightForWidth() const
{
if (isEmpty())
return false;
- return wid->hasHeightForWidth();
+ if (wid->layout())
+ return wid->layout()->hasHeightForWidth();
+ return wid->sizePolicy().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 4b49638..7559066 100644
--- a/src/gui/kernel/qstackedlayout.cpp
+++ b/src/gui/kernel/qstackedlayout.cpp
@@ -475,32 +475,6 @@ 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 842b62b..c069149 100644
--- a/src/gui/kernel/qstackedlayout.h
+++ b/src/gui/kernel/qstackedlayout.h
@@ -95,8 +95,6 @@ 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 2150b56..4fba8cf 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -1478,7 +1478,7 @@ QWidget::~QWidget()
QObjectPrivate::clearGuards(this);
if (d->declarativeData) {
- d->declarativeData->destroyed(this);
+ QDeclarativeData::destroyed(d->declarativeData, this);
d->declarativeData = 0; // don't activate again in ~QObject
}
@@ -3820,11 +3820,6 @@ 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
@@ -7970,18 +7965,6 @@ 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 6e5de7d..e12148b 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -524,7 +524,6 @@ 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 05a859c..89ea256 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -493,7 +493,6 @@ 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);
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index a0c9828..b440fce 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -708,10 +708,20 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
y2 = y1 + 1;
y2 %= image_height;
} else {
- x1 = qBound(0, x1, image_width - 1);
- x2 = qMin(x1 + 1, image_width - 1);
- y1 = qBound(0, y1, image_height - 1);
- y2 = qMin(y1 + 1, image_height - 1);
+ if (x1 < 0) {
+ x2 = x1 = 0;
+ } else if (x1 >= image_width - 1) {
+ x2 = x1 = image_width - 1;
+ } else {
+ x2 = x1 + 1;
+ }
+ if (y1 < 0) {
+ y2 = y1 = 0;
+ } else if (y1 >= image_height - 1) {
+ y2 = y1 = image_height - 1;
+ } else {
+ y2 = y1 + 1;
+ }
}
Q_ASSERT(x1 >= 0 && x1 < image_width);
@@ -775,10 +785,20 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
y2 = y1 + 1;
y2 %= image_height;
} else {
- x1 = qBound(0, x1, image_width - 1);
- x2 = qMin(x1 + 1, image_width - 1);
- y1 = qBound(0, y1, image_height - 1);
- y2 = qMin(y1 + 1, image_height - 1);
+ if (x1 < 0) {
+ x2 = x1 = 0;
+ } else if (x1 >= image_width - 1) {
+ x2 = x1 = image_width - 1;
+ } else {
+ x2 = x1 + 1;
+ }
+ if (y1 < 0) {
+ y2 = y1 = 0;
+ } else if (y1 >= image_height - 1) {
+ y2 = y1 = image_height - 1;
+ } else {
+ y2 = y1 + 1;
+ }
}
Q_ASSERT(x1 >= 0 && x1 < image_width);
@@ -5211,10 +5231,20 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const
Q_ASSERT(y1 >= 0 && y1 < image_height);
Q_ASSERT(y2 >= 0 && y2 < image_height);
} else {
- x1 = qBound(image_x1, x1, image_x2 - 1);
- x2 = qMin(x1 + 1, image_x2 - 1);
- y1 = qBound(image_y1, y1, image_y2 - 1);
- y2 = qMin(y1 + 1, image_y2 - 1);
+ if (x1 < image_x1) {
+ x2 = x1 = image_x1;
+ } else if (x1 >= image_x2 - 1) {
+ x2 = x1 = image_x2 - 1;
+ } else {
+ x2 = x1 + 1;
+ }
+ if (y1 < image_y1) {
+ y2 = y1 = image_y1;
+ } else if (y1 >= image_y2 - 1) {
+ y2 = y1 = image_y2 - 1;
+ } else {
+ y2 = y1 + 1;
+ }
}
int y1_offset = y1 * scanline_offset;
@@ -5311,10 +5341,20 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const
Q_ASSERT(y1 >= 0 && y1 < image_height);
Q_ASSERT(y2 >= 0 && y2 < image_height);
} else {
- x1 = qBound(image_x1, x1, image_x2 - 1);
- x2 = qMin(x1 + 1, image_x2 - 1);
- y1 = qBound(image_y1, y1, image_y2 - 1);
- y2 = qMin(y1 + 1, image_y2 - 1);
+ if (x1 < image_x1) {
+ x2 = x1 = image_x1;
+ } else if (x1 >= image_x2 - 1) {
+ x2 = x1 = image_x2 - 1;
+ } else {
+ x2 = x1 + 1;
+ }
+ if (y1 < image_y1) {
+ y2 = y1 = image_y1;
+ } else if (y1 >= image_y2 - 1) {
+ y2 = y1 = image_y2 - 1;
+ } else {
+ y2 = y1 + 1;
+ }
}
int y1_offset = y1 * scanline_offset;
@@ -5404,18 +5444,27 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedBilinear(int count, const QSpan
SRC *b = buffer;
while (b < end) {
int x1 = (x >> 16);
- int x2 = x1 + 1;
+ int x2;
int y1 = (y >> 16);
- int y2 = y1 + 1;
+ int y2;
const int distx = (x & 0x0000ffff) >> 8;
const int disty = (y & 0x0000ffff) >> 8;
- x1 = qBound(src_minx, x1, src_maxx);
- x2 = qBound(src_minx, x2, src_maxx);
- y1 = qBound(src_miny, y1, src_maxy);
- y2 = qBound(src_miny, y2, src_maxy);
-
+ if (x1 < src_minx) {
+ x2 = x1 = src_minx;
+ } else if (x1 >= src_maxx) {
+ x2 = x1 = src_maxx;
+ } else {
+ x2 = x1 + 1;
+ }
+ if (y1 < src_miny) {
+ y2 = y1 = src_miny;
+ } else if (y1 >= src_maxy) {
+ y2 = y1 = src_maxy;
+ } else {
+ y2 = y1 + 1;
+ }
#if 0
if (x1 == x2) {
if (y1 == y2) {
@@ -5506,17 +5555,27 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedBilinear(int count, const QSpan
const qreal py = y * iw - qreal(0.5);
int x1 = int(px) - (px < 0);
- int x2 = x1 + 1;
+ int x2;
int y1 = int(py) - (py < 0);
- int y2 = y1 + 1;
+ int y2;
const int distx = int((px - x1) * 256);
const int disty = int((py - y1) * 256);
- x1 = qBound(src_minx, x1, src_maxx);
- x2 = qBound(src_minx, x2, src_maxx);
- y1 = qBound(src_miny, y1, src_maxy);
- y2 = qBound(src_miny, y2, src_maxy);
+ if (x1 < src_minx) {
+ x2 = x1 = src_minx;
+ } else if (x1 >= src_maxx) {
+ x2 = x1 = src_maxx;
+ } else {
+ x2 = x1 + 1;
+ }
+ if (y1 < src_miny) {
+ y2 = y1 = src_miny;
+ } else if (y1 >= src_maxy) {
+ y2 = y1 = src_maxy;
+ } else {
+ y2 = y1 + 1;
+ }
const SRC *src1 = (SRC*)data->texture.scanLine(y1);
const SRC *src2 = (SRC*)data->texture.scanLine(y2);
diff --git a/src/gui/widgets/qsizegrip.cpp b/src/gui/widgets/qsizegrip.cpp
index 40f3129..c9d613a 100644
--- a/src/gui/widgets/qsizegrip.cpp
+++ b/src/gui/widgets/qsizegrip.cpp
@@ -78,6 +78,15 @@ static QWidget *qt_sizegrip_topLevelWidget(QWidget* w)
return w;
}
+static inline bool hasHeightForWidth(QWidget *widget)
+{
+ if (!widget)
+ return false;
+ if (QLayout *layout = widget->layout())
+ return layout->hasHeightForWidth();
+ return widget->sizePolicy().hasHeightForWidth();
+}
+
class QSizeGripPrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QSizeGrip)
@@ -309,7 +318,7 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e)
#ifdef Q_WS_X11
// Use a native X11 sizegrip for "real" top-level windows if supported.
if (tlw->isWindow() && X11->isSupportedByWM(ATOM(_NET_WM_MOVERESIZE))
- && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !tlw->hasHeightForWidth()) {
+ && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !hasHeightForWidth(tlw)) {
XEvent xev;
xev.xclient.type = ClientMessage;
xev.xclient.message_type = ATOM(_NET_WM_MOVERESIZE);
@@ -331,7 +340,7 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e)
}
#endif // Q_WS_X11
#ifdef Q_WS_WIN
- if (tlw->isWindow() && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !tlw->hasHeightForWidth()) {
+ if (tlw->isWindow() && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !hasHeightForWidth(tlw)) {
uint orientation = 0;
if (d->atBottom())
orientation = d->atLeft() ? SZ_SIZEBOTTOMLEFT : SZ_SIZEBOTTOMRIGHT;
@@ -420,12 +429,12 @@ void QSizeGrip::mouseMoveEvent(QMouseEvent * e)
#ifdef Q_WS_X11
if (tlw->isWindow() && X11->isSupportedByWM(ATOM(_NET_WM_MOVERESIZE))
- && tlw->isTopLevel() && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !tlw->hasHeightForWidth())
+ && tlw->isTopLevel() && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !hasHeightForWidth(tlw))
return;
#endif
#ifdef Q_WS_WIN
if (tlw->isWindow() && GetSystemMenu(tlw->winId(), FALSE) != 0 && internalWinId()
- && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !tlw->hasHeightForWidth()) {
+ && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !hasHeightForWidth(tlw)) {
MSG msg;
while(PeekMessage(&msg, winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE));
return;
diff --git a/src/gui/widgets/qtabwidget.cpp b/src/gui/widgets/qtabwidget.cpp
index fb7ca64..047a905 100644
--- a/src/gui/widgets/qtabwidget.cpp
+++ b/src/gui/widgets/qtabwidget.cpp
@@ -195,7 +195,6 @@ public:
void _q_removeTab(int);
void _q_tabMoved(int from, int to);
void init();
- bool hasHeightForWidth() const;
QTabBar *tabs;
QStackedWidget *stack;
@@ -872,46 +871,6 @@ QSize QTabWidget::minimumSizeHint() const
.expandedTo(QApplication::globalStrut());
}
-int QTabWidget::heightForWidth(int width) const
-{
- Q_D(const QTabWidget);
- QStyleOption opt(0);
- opt.init(this);
- opt.state = QStyle::State_None;
-
- QSize zero(0,0);
- const QSize padding = style()->sizeFromContents(QStyle::CT_TabWidget, &opt, zero, this)
- .expandedTo(QApplication::globalStrut());
-
- QSize lc(0, 0), rc(0, 0);
- if (d->leftCornerWidget)
- lc = d->leftCornerWidget->sizeHint();
- if(d->rightCornerWidget)
- rc = d->rightCornerWidget->sizeHint();
- if (!d->dirty) {
- QTabWidget *that = (QTabWidget*)this;
- that->setUpLayout(true);
- }
- QSize t(d->tabs->sizeHint());
-
- if(usesScrollButtons())
- t = t.boundedTo(QSize(200,200));
- else
- t = t.boundedTo(QApplication::desktop()->size());
-
- const bool tabIsHorizontal = (d->pos == North || d->pos == South);
- const int contentsWidth = width - padding.width();
- int stackWidth = contentsWidth;
- if (!tabIsHorizontal)
- stackWidth -= qMax(t.width(), qMax(lc.width(), rc.width()));
-
- int stackHeight = d->stack->heightForWidth(stackWidth);
- QSize s(stackWidth, stackHeight);
-
- QSize contentSize = basicSize(tabIsHorizontal, lc, rc, s, t);
- return (contentSize + padding).expandedTo(QApplication::globalStrut()).height();
-}
-
/*!
\reimp
*/
@@ -944,14 +903,6 @@ void QTabWidgetPrivate::updateTabBarPosition()
q->setUpLayout();
}
-bool QTabWidgetPrivate::hasHeightForWidth() const
-{
- bool has = size_policy.hasHeightForWidth();
- if (!has && stack)
- has = stack->hasHeightForWidth();
- return has;
-}
-
/*!
\property QTabWidget::tabPosition
\brief the position of the tabs in this tab widget
diff --git a/src/gui/widgets/qtabwidget.h b/src/gui/widgets/qtabwidget.h
index ee50655..68200c8 100644
--- a/src/gui/widgets/qtabwidget.h
+++ b/src/gui/widgets/qtabwidget.h
@@ -129,7 +129,6 @@ public:
QSize sizeHint() const;
QSize minimumSizeHint() const;
- int heightForWidth(int width) const;
void setCornerWidget(QWidget * w, Qt::Corner corner = Qt::TopRightCorner);
QWidget * cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const;