summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2009-08-31 00:29:56 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2009-08-31 00:29:56 (GMT)
commitf5c0745622a914003aa75aaaa1e828854c1c85ba (patch)
tree6f9c27a22d5987a8bddd512222ab29dfeda5caf3 /src/gui/widgets
parent9cc59a858d116f75c19a782602ab8679405d9764 (diff)
parent9dade8d2e57655019ed4dc2fcdc4e226401138a2 (diff)
downloadQt-f5c0745622a914003aa75aaaa1e828854c1c85ba.zip
Qt-f5c0745622a914003aa75aaaa1e828854c1c85ba.tar.gz
Qt-f5c0745622a914003aa75aaaa1e828854c1c85ba.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/qabstractscrollarea.cpp2
-rw-r--r--src/gui/widgets/qcocoatoolbardelegate_mac.mm6
-rw-r--r--src/gui/widgets/qlinecontrol_p.h2
-rw-r--r--src/gui/widgets/qlineedit.cpp6
-rw-r--r--src/gui/widgets/qlineedit.h1
-rw-r--r--src/gui/widgets/qlineedit_p.cpp8
-rw-r--r--src/gui/widgets/qlineedit_p.h2
-rw-r--r--src/gui/widgets/qmenu.cpp2
-rw-r--r--src/gui/widgets/qmenu_mac.mm13
-rw-r--r--src/gui/widgets/qplaintextedit.cpp4
-rw-r--r--src/gui/widgets/qtabbar.cpp16
-rw-r--r--src/gui/widgets/qtoolbar.cpp2
-rw-r--r--src/gui/widgets/qtoolbarlayout.cpp4
-rw-r--r--src/gui/widgets/qtoolbarlayout_p.h4
14 files changed, 37 insertions, 35 deletions
diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp
index 1b4d41b..d1adfee 100644
--- a/src/gui/widgets/qabstractscrollarea.cpp
+++ b/src/gui/widgets/qabstractscrollarea.cpp
@@ -1356,7 +1356,7 @@ void QAbstractScrollAreaPrivate::_q_gestureTriggered()
return;
QScrollBar *hBar = q->horizontalScrollBar();
QScrollBar *vBar = q->verticalScrollBar();
- QSize delta = g->lastOffset();
+ QSizeF delta = g->lastOffset();
if (!delta.isNull()) {
if (QApplication::isRightToLeft())
delta.rwidth() *= -1;
diff --git a/src/gui/widgets/qcocoatoolbardelegate_mac.mm b/src/gui/widgets/qcocoatoolbardelegate_mac.mm
index 3b58a4e..2ef0ead 100644
--- a/src/gui/widgets/qcocoatoolbardelegate_mac.mm
+++ b/src/gui/widgets/qcocoatoolbardelegate_mac.mm
@@ -100,7 +100,8 @@ QT_FORWARD_DECLARE_CLASS(QCFString);
{
Q_UNUSED(flag);
Q_UNUSED(nstoolbar);
- QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value(qt_mac_NSStringToQString(itemIdentifier));
+ QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value(
+ QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)(itemIdentifier));
NSToolbarItem *item = nil;
if (tb) {
item = [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier];
@@ -112,7 +113,8 @@ QT_FORWARD_DECLARE_CLASS(QCFString);
- (void)toolbarWillAddItem:(NSNotification *)notification
{
NSToolbarItem *item = [[notification userInfo] valueForKey:@"item"];
- QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value(qt_mac_NSStringToQString([item itemIdentifier]));
+ QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value(
+ QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)([item itemIdentifier]));
if (!tb)
return; // I can't really do anything about this.
[item retain];
diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h
index adea742..0db6279 100644
--- a/src/gui/widgets/qlinecontrol_p.h
+++ b/src/gui/widgets/qlinecontrol_p.h
@@ -349,7 +349,7 @@ Q_SIGNALS:
protected:
virtual void timerEvent(QTimerEvent *event);
-private slots:
+private Q_SLOTS:
void _q_clipboardChanged();
void _q_deleteSelected();
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 299ecfc..059aaf1 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1395,7 +1395,7 @@ bool QLineEdit::event(QEvent * e)
if (e->type() == QEvent::EnterEditFocus) {
end(false);
d->setCursorVisible(true);
- d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()/2);
+ d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime());
} else if (e->type() == QEvent::LeaveEditFocus) {
d->setCursorVisible(false);
d->control->setCursorBlinkPeriod(0);
@@ -1690,7 +1690,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e)
#ifdef QT_KEYPAD_NAVIGATION
if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && e->reason() == Qt::PopupFocusReason)){
#endif
- d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()/2);
+ d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime());
QStyleOptionFrameV2 opt;
initStyleOption(&opt);
if((!hasSelectedText() && d->control->preeditAreaText().isEmpty())
@@ -2002,7 +2002,7 @@ QMenu *QLineEdit::createStandardContextMenu()
action = popup->addAction(QLineEdit::tr("Delete"));
action->setEnabled(!d->control->isReadOnly() && !d->control->text().isEmpty() && d->control->hasSelectedText());
- connect(action, SIGNAL(triggered()), SLOT(_q_deleteSelected()));
+ connect(action, SIGNAL(triggered()), d->control, SLOT(_q_deleteSelected()));
popup->addSeparator();
diff --git a/src/gui/widgets/qlineedit.h b/src/gui/widgets/qlineedit.h
index 03d4376..cd37ad0 100644
--- a/src/gui/widgets/qlineedit.h
+++ b/src/gui/widgets/qlineedit.h
@@ -267,7 +267,6 @@ private:
Q_DISABLE_COPY(QLineEdit)
Q_DECLARE_PRIVATE(QLineEdit)
Q_PRIVATE_SLOT(d_func(), void _q_handleWindowActivate())
- Q_PRIVATE_SLOT(d_func(), void _q_deleteSelected())
Q_PRIVATE_SLOT(d_func(), void _q_textEdited(const QString &))
Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged(int, int))
#ifndef QT_NO_COMPLETER
diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp
index cec34da..4218630 100644
--- a/src/gui/widgets/qlineedit_p.cpp
+++ b/src/gui/widgets/qlineedit_p.cpp
@@ -93,10 +93,6 @@ void QLineEditPrivate::_q_completionHighlighted(QString newText)
#endif // QT_NO_COMPLETER
-void QLineEditPrivate::_q_clipboardChanged()
-{
-}
-
void QLineEditPrivate::_q_handleWindowActivate()
{
Q_Q(QLineEdit);
@@ -104,10 +100,6 @@ void QLineEditPrivate::_q_handleWindowActivate()
control->deselect();
}
-void QLineEditPrivate::_q_deleteSelected()
-{
-}
-
void QLineEditPrivate::_q_textEdited(const QString &text)
{
Q_Q(QLineEdit);
diff --git a/src/gui/widgets/qlineedit_p.h b/src/gui/widgets/qlineedit_p.h
index 3521dcb..260bc19 100644
--- a/src/gui/widgets/qlineedit_p.h
+++ b/src/gui/widgets/qlineedit_p.h
@@ -122,9 +122,7 @@ public:
QRect adjustedContentsRect() const;
- void _q_clipboardChanged();
void _q_handleWindowActivate();
- void _q_deleteSelected();
void _q_textEdited(const QString &);
void _q_cursorPositionChanged(int, int);
#ifdef QT_KEYPAD_NAVIGATION
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index f0f425f..4734d22 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -368,7 +368,9 @@ QRect QMenuPrivate::actionRect(QAction *act) const
return actionRects.at(index);
}
+#if defined(Q_WS_MAC)
static const qreal MenuFadeTimeInSec = 0.150;
+#endif
void QMenuPrivate::hideUpToMenuBar()
{
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index 47a8042..8e28abe 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -607,6 +607,13 @@ static inline void syncNSMenuItemVisiblity(NSMenuItem *menuItem, bool actionVisi
[menuItem setHidden:!actionVisibility];
}
+static inline void syncNSMenuItemEnabled(NSMenuItem *menuItem, bool enabled)
+{
+ [menuItem setEnabled:NO];
+ [menuItem setEnabled:YES];
+ [menuItem setEnabled:enabled];
+}
+
static inline void syncMenuBarItemsVisiblity(const QMenuBarPrivate::QMacMenuBarPrivate *mac_menubar)
{
const QList<QMacMenuAction *> &menubarActions = mac_menubar->actionItems;
@@ -659,12 +666,12 @@ void qt_mac_set_modal_state_helper_recursive(OSMenuRef menu, OSMenuRef merge, bo
// The item should follow what the QAction has.
if ([item tag]) {
QAction *action = reinterpret_cast<QAction *>([item tag]);
- [item setEnabled:action->isEnabled()];
+ syncNSMenuItemEnabled(item, action->isEnabled());
} else {
- [item setEnabled:YES];
+ syncNSMenuItemEnabled(item, YES);
}
} else {
- [item setEnabled:NO];
+ syncNSMenuItemEnabled(item, NO);
}
}
}
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index e025876..6ac521b 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -379,7 +379,7 @@ void QPlainTextDocumentLayout::layoutBlock(const QTextBlock &block)
tl->beginLayout();
qreal availableWidth = d->width;
if (availableWidth <= 0) {
- availableWidth = INT_MAX; // similar to text edit with pageSize.width == 0
+ availableWidth = qreal(INT_MAX); // similar to text edit with pageSize.width == 0
}
availableWidth -= 2*margin + extraMargin;
while (1) {
@@ -2934,7 +2934,7 @@ void QPlainTextEditPrivate::_q_gestureTriggered()
QScrollBar *vBar = q->verticalScrollBar();
if (g->state() == Qt::GestureStarted)
originalOffsetY = vBar->value();
- QSize totalOffset = g->totalOffset();
+ QSizeF totalOffset = g->totalOffset();
if (!totalOffset.isNull()) {
if (QApplication::isRightToLeft())
totalOffset.rwidth() *= -1;
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp
index 5166390..531c429 100644
--- a/src/gui/widgets/qtabbar.cpp
+++ b/src/gui/widgets/qtabbar.cpp
@@ -1293,6 +1293,7 @@ QSize QTabBarPrivate::minimumTabSizeHint(int index)
*/
QSize QTabBar::tabSizeHint(int index) const
{
+ //Note: this must match with the computations in QCommonStylePrivate::tabLayout
Q_D(const QTabBar);
if (const QTabBarPrivate::Tab *tab = d->at(index)) {
QStyleOptionTabV3 opt;
@@ -1309,18 +1310,18 @@ QSize QTabBar::tabSizeHint(int index) const
int widgetWidth = 0;
int widgetHeight = 0;
int padding = 0;
- if (opt.leftButtonSize.isValid()) {
- padding += 6 + 2;
+ if (!opt.leftButtonSize.isEmpty()) {
+ padding += 4;
widgetWidth += opt.leftButtonSize.width();
widgetHeight += opt.leftButtonSize.height();
}
- if (opt.rightButtonSize.isValid()) {
- padding += 6 + 2;
+ if (!opt.rightButtonSize.isEmpty()) {
+ padding += 4;
widgetWidth += opt.rightButtonSize.width();
widgetHeight += opt.rightButtonSize.height();
}
- if (opt.iconSize.isValid())
- padding += 2;
+ if (!opt.icon.isNull())
+ padding += 4;
QSize csz;
if (verticalTabs(d->shape)) {
@@ -1836,7 +1837,8 @@ void QTabBarPrivate::moveTabFinished(int index)
}
#endif //QT_NO_ANIMATION
if (allAnimationsFinished && cleanup) {
- movingTab->setVisible(false); // We might not get a mouse release
+ if(movingTab)
+ movingTab->setVisible(false); // We might not get a mouse release
for (int i = 0; i < tabList.count(); ++i) {
tabList[i].dragOffset = 0;
}
diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp
index bf44ea1..89e6d7a 100644
--- a/src/gui/widgets/qtoolbar.cpp
+++ b/src/gui/widgets/qtoolbar.cpp
@@ -391,7 +391,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event)
void QToolBarPrivate::unplug(const QRect &_r)
{
Q_Q(QToolBar);
-
+ layout->setExpanded(false, false);
QRect r = _r;
r.moveTopLeft(q->mapToGlobal(QPoint(0, 0)));
setWindowState(true, true, r);
diff --git a/src/gui/widgets/qtoolbarlayout.cpp b/src/gui/widgets/qtoolbarlayout.cpp
index d3c5b4b..1f2ca60 100644
--- a/src/gui/widgets/qtoolbarlayout.cpp
+++ b/src/gui/widgets/qtoolbarlayout.cpp
@@ -642,7 +642,7 @@ QSize QToolBarLayout::expandedSize(const QSize &size) const
return result;
}
-void QToolBarLayout::setExpanded(bool exp)
+void QToolBarLayout::setExpanded(bool exp, bool animated)
{
if (exp == expanded)
return;
@@ -665,7 +665,7 @@ void QToolBarLayout::setExpanded(bool exp)
layoutActions(rect.size());
}
}
- layout->layoutState.toolBarAreaLayout.apply(true);
+ layout->layoutState.toolBarAreaLayout.apply(animated);
}
}
diff --git a/src/gui/widgets/qtoolbarlayout_p.h b/src/gui/widgets/qtoolbarlayout_p.h
index fe81d2f..bb40e215 100644
--- a/src/gui/widgets/qtoolbarlayout_p.h
+++ b/src/gui/widgets/qtoolbarlayout_p.h
@@ -111,8 +111,8 @@ public:
void updateMarginAndSpacing();
bool hasExpandFlag() const;
-public slots:
- void setExpanded(bool b);
+public Q_SLOTS:
+ void setExpanded(bool b, bool animated = true);
private:
QList<QToolBarItem*> items;