diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-07-01 17:24:01 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-07-01 17:24:01 (GMT) |
commit | 745ecfd8925716d962c97a4415881377faf6bdd5 (patch) | |
tree | c4f78b3bd143af52372064cd3ba5c0ae440813c5 /src/gui/widgets | |
parent | bda164303570629e44185e8baa52908ced6da301 (diff) | |
parent | 8968c79c575755cdb52d5e615ed19e4529047464 (diff) | |
download | Qt-745ecfd8925716d962c97a4415881377faf6bdd5.zip Qt-745ecfd8925716d962c97a4415881377faf6bdd5.tar.gz Qt-745ecfd8925716d962c97a4415881377faf6bdd5.tar.bz2 |
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
bin/syncqt
src/gui/text/qtextlayout.cpp
tools/assistant/tools/assistant/helpviewer_qwv.cpp
tools/assistant/tools/assistant/helpviewer_qwv.h
tools/configure/configureapp.cpp
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qcombobox.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/qcommandlinkbutton.cpp | 18 | ||||
-rw-r--r-- | src/gui/widgets/qlinecontrol_p.h | 11 | ||||
-rw-r--r-- | src/gui/widgets/qlineedit.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/qslider.cpp | 2 |
5 files changed, 29 insertions, 12 deletions
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index fe00173..88b3467 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -705,6 +705,11 @@ void QComboBoxPrivateContainer::hideEvent(QHideEvent *) { emit resetButton(); combo->update(); + // QGraphicsScenePrivate::removePopup closes the combo box popup, it hides it non-explicitly. + // Hiding/showing the QComboBox after this will unexpectedly show the popup as well. + // Re-hiding the popup container makes sure it is explicitly hidden. + if (QGraphicsProxyWidget *proxy = graphicsProxyWidget()) + proxy->hide(); } void QComboBoxPrivateContainer::mousePressEvent(QMouseEvent *e) diff --git a/src/gui/widgets/qcommandlinkbutton.cpp b/src/gui/widgets/qcommandlinkbutton.cpp index e8fe299..d3b5869 100644 --- a/src/gui/widgets/qcommandlinkbutton.cpp +++ b/src/gui/widgets/qcommandlinkbutton.cpp @@ -118,7 +118,7 @@ public: int topMargin() const { return 10; } int leftMargin() const { return 7; } int rightMargin() const { return 4; } - int bottomMargin() const { return 4; } + int bottomMargin() const { return 10; } QString description; QColor currentColor; @@ -174,8 +174,15 @@ QFont QCommandLinkButtonPrivate::descriptionFont() const QRect QCommandLinkButtonPrivate::titleRect() const { Q_Q(const QCommandLinkButton); - return q->rect().adjusted(textOffset(), topMargin(), - -rightMargin(), 0); + QRect r = q->rect().adjusted(textOffset(), topMargin(), -rightMargin(), 0); + if (description.isEmpty()) + { + QFontMetrics fm(titleFont()); + r.setTop(r.top() + qMax(0, (q->icon().actualSize(q->iconSize()).height() + - fm.height()) / 2)); + } + + return r; } QRect QCommandLinkButtonPrivate::descriptionRect() const @@ -254,7 +261,7 @@ QSize QCommandLinkButton::minimumSizeHint() const Q_D(const QCommandLinkButton); QSize size = sizeHint(); int minimumHeight = qMax(d->descriptionOffset() + d->bottomMargin(), - iconSize().height() + d->topMargin()); + icon().actualSize(iconSize()).height() + d->topMargin()); size.setHeight(minimumHeight); return size; } @@ -328,7 +335,8 @@ int QCommandLinkButton::heightForWidth(int width) const int heightWithoutDescription = d->descriptionOffset() + d->bottomMargin(); // find the width available for the description area return qMax(heightWithoutDescription + d->descriptionHeight(width), - iconSize().height() + d->topMargin() + d->bottomMargin()); + icon().actualSize(iconSize()).height() + d->topMargin() + + d->bottomMargin()); } /*! \reimp */ diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index 5da1831..7068f62 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -78,7 +78,7 @@ class Q_GUI_EXPORT QLineControl : public QObject public: QLineControl(const QString &txt = QString()) - : m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LeftToRight), + : m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LayoutDirectionAuto), m_hideCursor(false), m_separator(0), m_readOnly(0), m_dragEnabled(0), m_echoMode(0), m_textDirty(0), m_selDirty(0), m_validInput(1), m_blinkStatus(0), m_blinkPeriod(0), m_blinkTimer(0), m_deleteAllTimer(0), @@ -272,7 +272,14 @@ public: QChar passwordCharacter() const { return m_passwordCharacter; } void setPasswordCharacter(const QChar &character) { m_passwordCharacter = character; updateDisplayText(); } - Qt::LayoutDirection layoutDirection() const { return m_layoutDirection; } + Qt::LayoutDirection layoutDirection() const { + if (m_layoutDirection == Qt::LayoutDirectionAuto) { + if (m_text.isEmpty()) + return QApplication::keyboardInputDirection(); + return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight; + } + return m_layoutDirection; + } void setLayoutDirection(Qt::LayoutDirection direction) { if (direction != m_layoutDirection) { diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index c1c4abf..1bffde1 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1860,7 +1860,7 @@ void QLineEdit::paintEvent(QPaintEvent *) p.setClipRect(r); QFontMetrics fm = fontMetrics(); - Qt::Alignment va = QStyle::visualAlignment(layoutDirection(), QFlag(d->alignment)); + Qt::Alignment va = QStyle::visualAlignment(d->control->layoutDirection(), QFlag(d->alignment)); switch (va & Qt::AlignVertical_Mask) { case Qt::AlignBottom: d->vscroll = r.y() + r.height() - fm.height() - d->verticalMargin; @@ -2161,9 +2161,6 @@ void QLineEdit::changeEvent(QEvent *ev) } update(); break; - case QEvent::LayoutDirectionChange: - d->control->setLayoutDirection(layoutDirection()); - break; default: break; } diff --git a/src/gui/widgets/qslider.cpp b/src/gui/widgets/qslider.cpp index a5e62cf..5755202 100644 --- a/src/gui/widgets/qslider.cpp +++ b/src/gui/widgets/qslider.cpp @@ -621,7 +621,7 @@ QSlider::TickPosition QSlider::tickPosition() const \brief the interval between tickmarks This is a value interval, not a pixel interval. If it is 0, the - slider will choose between lineStep() and pageStep(). + slider will choose between singleStep() and pageStep(). The default value is 0. |