summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-02-26 09:05:39 (GMT)
committeraxis <qt-info@nokia.com>2010-02-26 09:05:39 (GMT)
commit5e9382c018e231c5e2ef49dd8a38eaff535b9837 (patch)
tree89f13d31d5804c38999fdefd0e2aca39d305f91c /src/gui
parent11e54877f87ff97039452f117d40ec17eefbcbff (diff)
parent53e7dda038e9251ca7380d3717709764c580192e (diff)
downloadQt-5e9382c018e231c5e2ef49dd8a38eaff535b9837.zip
Qt-5e9382c018e231c5e2ef49dd8a38eaff535b9837.tar.gz
Qt-5e9382c018e231c5e2ef49dd8a38eaff535b9837.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into master-s60
Conflicts: qmake/generators/symbian/initprojectdeploy_symbian.cpp qmake/generators/symbian/symmake_abld.h
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qcolordialog_mac.mm10
-rw-r--r--src/gui/dialogs/qfontdialog.cpp64
-rw-r--r--src/gui/dialogs/qfontdialog.h3
-rw-r--r--src/gui/dialogs/qfontdialog_mac.mm148
-rw-r--r--src/gui/dialogs/qfontdialog_p.h6
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp19
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp6
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp27
-rw-r--r--src/gui/image/qnativeimage.cpp2
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp40
-rw-r--r--src/gui/itemviews/qabstractproxymodel.cpp1
-rw-r--r--src/gui/kernel/qapplication_s60.cpp8
-rw-r--r--src/gui/kernel/qapplication_win.cpp5
-rw-r--r--src/gui/kernel/qkeymapper_p.h6
-rw-r--r--src/gui/kernel/qkeymapper_s60.cpp298
-rw-r--r--src/gui/kernel/qwidget.cpp43
-rw-r--r--src/gui/kernel/qwidget_mac.mm14
-rw-r--r--src/gui/kernel/qwidget_p.h2
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp7
-rw-r--r--src/gui/widgets/qabstractslider.cpp53
-rw-r--r--src/gui/widgets/qlineedit_p.cpp2
21 files changed, 499 insertions, 265 deletions
diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm
index bdcb872..8af0d2b 100644
--- a/src/gui/dialogs/qcolordialog_mac.mm
+++ b/src/gui/dialogs/qcolordialog_mac.mm
@@ -96,6 +96,7 @@ QT_USE_NAMESPACE
- (void)finishOffWithCode:(NSInteger)result;
- (void)showColorPanel;
- (void)exec;
+- (void)setResultSet:(BOOL)result;
@end
@implementation QCocoaColorPanelDelegate
@@ -158,6 +159,11 @@ QT_USE_NAMESPACE
[super dealloc];
}
+- (void)setResultSet:(BOOL)result
+{
+ mResultSet = result;
+}
+
- (BOOL)windowShouldClose:(id)window
{
Q_UNUSED(window);
@@ -320,7 +326,7 @@ QT_USE_NAMESPACE
} else {
mPriv->colorDialog()->accept();
}
- }
+ }
}
}
@@ -433,7 +439,7 @@ void QColorDialogPrivate::openCocoaColorPanel(const QColor &initial,
priv:this];
[colorPanel setDelegate:static_cast<QCocoaColorPanelDelegate *>(delegate)];
}
-
+ [delegate setResultSet:false];
setCocoaPanelColor(initial);
[static_cast<QCocoaColorPanelDelegate *>(delegate) showColorPanel];
}
diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp
index 56580a9..a4bf15d 100644
--- a/src/gui/dialogs/qfontdialog.cpp
+++ b/src/gui/dialogs/qfontdialog.cpp
@@ -989,34 +989,24 @@ void QFontDialog::open(QObject *receiver, const char *member)
void QFontDialog::setVisible(bool visible)
{
Q_D(QFontDialog);
- if (visible)
- d->selectedFont = QFont();
-
-#if defined(Q_WS_MAC)
- bool isCurrentlyVisible = (isVisible() || d->delegate);
-
- if (!visible == !isCurrentlyVisible)
- return;
-
if (visible) {
- if (!(d->opts & DontUseNativeDialog) && QFontDialogPrivate::sharedFontPanelAvailable) {
- d->delegate = QFontDialogPrivate::openCocoaFontPanel(
- currentFont(), parentWidget(), windowTitle(), options(), d);
- QFontDialogPrivate::sharedFontPanelAvailable = false;
- return;
- }
-
- setWindowFlags(windowModality() == Qt::WindowModal ? Qt::Sheet : DefaultWindowFlags);
- } else {
- if (d->delegate) {
- QFontDialogPrivate::closeCocoaFontPanel(d->delegate);
- d->delegate = 0;
- QFontDialogPrivate::sharedFontPanelAvailable = true;
+ if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden))
return;
+ } else if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden))
+ return;
+#ifdef Q_WS_MAC
+ if (d->canBeNativeDialog()){
+ if (d->setVisible_sys(visible)){
+ d->nativeDialogInUse = true;
+ // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below
+ // updates the state correctly, but skips showing the non-native version:
+ setAttribute(Qt::WA_DontShowOnScreen, true);
+ } else {
+ d->nativeDialogInUse = false;
+ setAttribute(Qt::WA_DontShowOnScreen, false);
}
}
-#endif
-
+#endif // Q_WS_MAC
QDialog::setVisible(visible);
}
@@ -1032,11 +1022,14 @@ void QFontDialog::done(int result)
Q_D(QFontDialog);
QDialog::done(result);
if (result == Accepted) {
- d->selectedFont = currentFont();
+ // We check if this is the same font we had before, if so we emit currentFontChanged
+ QFont selectedFont = currentFont();
+ if(selectedFont != d->selectedFont)
+ emit(currentFontChanged(selectedFont));
+ d->selectedFont = selectedFont;
emit fontSelected(d->selectedFont);
- } else {
+ } else
d->selectedFont = QFont();
- }
if (d->receiverToDisconnectOnClose) {
disconnect(this, SIGNAL(fontSelected(QFont)),
d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose);
@@ -1045,6 +1038,23 @@ void QFontDialog::done(int result)
d->memberToDisconnectOnClose.clear();
}
+#ifdef Q_WS_MAC
+bool QFontDialogPrivate::canBeNativeDialog()
+{
+ Q_Q(QFontDialog);
+ if (nativeDialogInUse)
+ return true;
+ if (q->testAttribute(Qt::WA_DontShowOnScreen))
+ return false;
+ if (opts & QFontDialog::DontUseNativeDialog)
+ return false;
+
+ QLatin1String staticName(QFontDialog::staticMetaObject.className());
+ QLatin1String dynamicName(q->metaObject()->className());
+ return (staticName == dynamicName);
+}
+#endif // Q_WS_MAC
+
/*!
\fn QFont QFontDialog::getFont(bool *ok, const QFont &initial, QWidget* parent, const char* name)
\since 4.5
diff --git a/src/gui/dialogs/qfontdialog.h b/src/gui/dialogs/qfontdialog.h
index e6f209e..6035a3a 100644
--- a/src/gui/dialogs/qfontdialog.h
+++ b/src/gui/dialogs/qfontdialog.h
@@ -131,6 +131,9 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_styleHighlighted(int))
Q_PRIVATE_SLOT(d_func(), void _q_sizeHighlighted(int))
Q_PRIVATE_SLOT(d_func(), void _q_updateSample())
+#if defined(Q_WS_MAC)
+ Q_PRIVATE_SLOT(d_func(), void _q_macRunNativeAppModalPanel())
+#endif
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions)
diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm
index 68f5f00..67d32b8 100644
--- a/src/gui/dialogs/qfontdialog_mac.mm
+++ b/src/gui/dialogs/qfontdialog_mac.mm
@@ -49,6 +49,7 @@
#include <private/qfontengine_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
#include <private/qt_mac_p.h>
+#include <qabstracteventdispatcher.h>
#include <qdebug.h>
#import <AppKit/AppKit.h>
#import <Foundation/Foundation.h>
@@ -372,7 +373,12 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
[NSApp endModalSession:mModalSession];
mModalSession = 0;
}
-
+ // Hack alert!
+ // Since this code path was never intended to be followed when starting from exec
+ // we need to force the dialog to communicate the new font, otherwise the signal
+ // won't get emitted.
+ if(code == NSOKButton)
+ mPriv->sampleEdit->setFont([self qtFont]);
mPriv->done((code == NSOKButton) ? QDialog::Accepted : QDialog::Rejected);
} else {
[NSApp stopModalWithCode:code];
@@ -567,7 +573,6 @@ void *QFontDialogPrivate::openCocoaFontPanel(const QFont &initial,
[ourPanel makeKeyAndOrderFront:ourPanel];
}
}
-
return delegate;
}
@@ -640,6 +645,145 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font)
[static_cast<QCocoaFontPanelDelegate *>(delegate) setQtFont:font];
}
+void *QFontDialogPrivate::_q_constructNativePanel()
+{
+ QMacCocoaAutoReleasePool pool;
+
+ bool sharedFontPanelExisted = [NSFontPanel sharedFontPanelExists];
+ NSFontPanel *sharedFontPanel = [NSFontPanel sharedFontPanel];
+ [sharedFontPanel setHidesOnDeactivate:false];
+
+ // hack to ensure that QCocoaApplication's validModesForFontPanel:
+ // implementation is honored
+ if (!sharedFontPanelExisted) {
+ [sharedFontPanel makeKeyAndOrderFront:sharedFontPanel];
+ [sharedFontPanel close];
+ }
+
+ NSPanel *ourPanel = 0;
+ NSView *stolenContentView = 0;
+ NSButton *okButton = 0;
+ NSButton *cancelButton = 0;
+
+ CGFloat dialogExtraWidth = 0.0;
+ CGFloat dialogExtraHeight = 0.0;
+
+ // compute dialogExtra{Width,Height}
+ dialogExtraWidth = 2.0 * DialogSideMargin;
+ dialogExtraHeight = DialogTopMargin + ButtonTopMargin + ButtonMinHeight
+ + ButtonBottomMargin;
+
+ // compute initial contents rectangle
+ NSRect contentRect = [sharedFontPanel contentRectForFrameRect:[sharedFontPanel frame]];
+ contentRect.size.width += dialogExtraWidth;
+ contentRect.size.height += dialogExtraHeight;
+
+ // create the new panel
+ ourPanel = [[NSPanel alloc] initWithContentRect:contentRect
+ styleMask:StyleMask
+ backing:NSBackingStoreBuffered
+ defer:YES];
+ [ourPanel setReleasedWhenClosed:YES];
+
+ stolenContentView = [sharedFontPanel contentView];
+
+ // steal the font panel's contents view
+ [stolenContentView retain];
+ [sharedFontPanel setContentView:0];
+
+ {
+ // create a new content view and add the stolen one as a subview
+ NSRect frameRect = { { 0.0, 0.0 }, { 0.0, 0.0 } };
+ NSView *ourContentView = [[NSView alloc] initWithFrame:frameRect];
+ [ourContentView addSubview:stolenContentView];
+
+ // create OK and Cancel buttons and add these as subviews
+ okButton = macCreateButton("&OK", ourContentView);
+ cancelButton = macCreateButton("Cancel", ourContentView);
+
+ [ourPanel setContentView:ourContentView];
+ [ourPanel setDefaultButtonCell:[okButton cell]];
+ }
+ // create a delegate and set it
+ QCocoaFontPanelDelegate *delegate =
+ [[QCocoaFontPanelDelegate alloc] initWithFontPanel:sharedFontPanel
+ stolenContentView:stolenContentView
+ okButton:okButton
+ cancelButton:cancelButton
+ priv:this
+ extraWidth:dialogExtraWidth
+ extraHeight:dialogExtraHeight];
+ [ourPanel setDelegate:delegate];
+ [[NSFontManager sharedFontManager] setDelegate:delegate];
+#ifdef QT_MAC_USE_COCOA
+ [[NSFontManager sharedFontManager] setTarget:delegate];
+#endif
+ setFont(delegate, QApplication::font());
+
+ {
+ // hack to get correct initial layout
+ NSRect frameRect = [ourPanel frame];
+ frameRect.size.width += 1.0;
+ [ourPanel setFrame:frameRect display:NO];
+ frameRect.size.width -= 1.0;
+ frameRect.size = [delegate windowWillResize:ourPanel toSize:frameRect.size];
+ [ourPanel setFrame:frameRect display:NO];
+ [ourPanel center];
+ }
+ NSString *title = @"Select font";
+ [ourPanel setTitle:title];
+
+ [delegate setModalSession:[NSApp beginModalSessionForWindow:ourPanel]];
+ return delegate;
+}
+
+void QFontDialogPrivate::mac_nativeDialogModalHelp()
+{
+ // Copied from QFileDialogPrivate
+ // Do a queued meta-call to open the native modal dialog so it opens after the new
+ // event loop has started to execute (in QDialog::exec). Using a timer rather than
+ // a queued meta call is intentional to ensure that the call is only delivered when
+ // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not
+ // running (which is the case if e.g a top-most QEventLoop has been
+ // interrupted, and the second-most event loop has not yet been reactivated (regardless
+ // if [NSApp run] is still on the stack)), showing a native modal dialog will fail.
+ if (nativeDialogInUse) {
+ Q_Q(QFontDialog);
+ QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel()));
+ }
+}
+
+// The problem with the native font dialog is that OS X does not
+// offer a proper dialog, but a panel (i.e. without Ok and Cancel buttons).
+// This means we need to "construct" a native dialog by taking the panel
+// and "adding" the buttons.
+void QFontDialogPrivate::_q_macRunNativeAppModalPanel()
+{
+ QBoolBlocker nativeDialogOnTop(QApplicationPrivate::native_modal_dialog_active);
+ Q_Q(QFontDialog);
+ QCocoaFontPanelDelegate *delegate = (QCocoaFontPanelDelegate *)_q_constructNativePanel();
+ NSWindow *ourPanel = [delegate actualPanel];
+ [ourPanel retain];
+ int rval = [NSApp runModalForWindow:ourPanel];
+ QAbstractEventDispatcher::instance()->interrupt();
+ [ourPanel release];
+ [delegate cleanUpAfterMyself];
+ [delegate release];
+ bool isOk = (rval == NSOKButton);
+ if(isOk)
+ rescode = QDialog::Accepted;
+ else
+ rescode = QDialog::Rejected;
+}
+
+bool QFontDialogPrivate::setVisible_sys(bool visible)
+{
+ Q_Q(QFontDialog);
+ if (!visible == q->isHidden())
+ return false;
+ return visible;
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/gui/dialogs/qfontdialog_p.h b/src/gui/dialogs/qfontdialog_p.h
index ca2b10b..7654a80 100644
--- a/src/gui/dialogs/qfontdialog_p.h
+++ b/src/gui/dialogs/qfontdialog_p.h
@@ -152,6 +152,12 @@ public:
inline QFontDialog *fontDialog() { return q_func(); }
void *delegate;
+ bool nativeDialogInUse;
+ bool canBeNativeDialog();
+ bool setVisible_sys(bool visible);
+ void *_q_constructNativePanel();
+ void _q_macRunNativeAppModalPanel();
+ void mac_nativeDialogModalHelp();
static bool sharedFontPanelAvailable;
#endif
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index ca20101..5735cd6 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -414,12 +414,6 @@
/*!
\enum QGraphicsItem::GraphicsItemChange
- ItemVisibleHasChanged,
- ItemEnabledHasChanged,
- ItemSelectedHasChanged,
- ItemParentHasChanged,
- ItemSceneHasChanged
-
This enum describes the state changes that are notified by
QGraphicsItem::itemChange(). The notifications are sent as the state
changes, and in some cases, adjustments can be made (see the documentation
@@ -647,9 +641,16 @@
are children of a modal panel are not blocked.
The values are:
- \value NonModal The panel is not modal and does not block input to other panels.
- \value PanelModal The panel is modal to a single item hierarchy and blocks input to its parent pane, all grandparent panels, and all siblings of its parent and grandparent panels.
- \value SceneModal The window is modal to the entire scene and blocks input to all panels.
+
+ \value NonModal The panel is not modal and does not block input to
+ other panels. This is the default value for panels.
+
+ \value PanelModal The panel is modal to a single item hierarchy
+ and blocks input to its parent pane, all grandparent panels, and
+ all siblings of its parent and grandparent panels.
+
+ \value SceneModal The window is modal to the entire scene and
+ blocks input to all panels.
\sa QGraphicsItem::setPanelModality(), QGraphicsItem::panelModality(), QGraphicsItem::ItemIsPanel
*/
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 40e1d2c..365afdd 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -813,7 +813,8 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
// do it ourselves.
if (item) {
for (int i = 0; i < views.size(); ++i)
- views.at(i)->inputContext()->reset();
+ if (views.at(i)->inputContext())
+ views.at(i)->inputContext()->reset();
}
}
#endif //QT_NO_IM
@@ -4692,7 +4693,8 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
if (widget)
item->d_ptr->paintedViewBoundingRects.insert(widget, viewBoundingRect);
viewBoundingRect.adjust(-1, -1, 1, 1);
- drawItem = exposedRegion ? exposedRegion->intersects(viewBoundingRect) : !viewBoundingRect.isEmpty();
+ drawItem = exposedRegion ? exposedRegion->intersects(viewBoundingRect)
+ : !viewBoundingRect.normalized().isEmpty();
if (!drawItem) {
if (!itemHasChildren)
return;
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 06b7438..1ced3d7 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -3400,6 +3400,13 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
if (!d->scene->d_func()->painterStateProtection)
painter.setWorldTransform(viewTransform);
} else {
+ // Make sure we don't have unpolished items before we draw
+ if (!d->scene->d_func()->unpolishedItems.isEmpty())
+ d->scene->d_func()->_q_polishItems();
+ // We reset updateAll here (after we've issued polish events)
+ // so that we can discard update requests coming from polishEvent().
+ d->scene->d_func()->updateAll = false;
+
// Find all exposed items
bool allItems = false;
QList<QGraphicsItem *> itemList = d->findItems(d->exposedRegion, &allItems, viewTransform);
@@ -3408,9 +3415,25 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
const int numItems = itemList.size();
QGraphicsItem **itemArray = &itemList[0]; // Relies on QList internals, but is perfectly valid.
QStyleOptionGraphicsItem *styleOptionArray = d->allocStyleOptionsArray(numItems);
+ QTransform transform(Qt::Uninitialized);
for (int i = 0; i < numItems; ++i) {
- itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], viewTransform,
- d->exposedRegion, allItems);
+ QGraphicsItem *item = itemArray[i];
+ QGraphicsItemPrivate *itemd = item->d_ptr.data();
+ itemd->initStyleOption(&styleOptionArray[i], viewTransform, d->exposedRegion, allItems);
+ // Cache the item's area in view coordinates.
+ // Note that we have to do this here in case the base class implementation
+ // (QGraphicsScene::drawItems) is not called. If it is, we'll do this
+ // operation twice, but that's the price one has to pay for using indirect
+ // painting :-/.
+ const QRectF brect = adjustedItemEffectiveBoundingRect(item);
+ if (!itemd->itemIsUntransformable()) {
+ transform = item->sceneTransform();
+ if (viewTransformed)
+ transform *= viewTransform;
+ } else {
+ transform = item->deviceTransform(viewTransform);
+ }
+ itemd->paintedViewBoundingRects.insert(d->viewport, transform.mapRect(brect).toRect());
}
// Draw the items.
drawItems(&painter, numItems, itemArray, styleOptionArray);
diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp
index 2226901..8446387 100644
--- a/src/gui/image/qnativeimage.cpp
+++ b/src/gui/image/qnativeimage.cpp
@@ -182,7 +182,7 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /*
qWarning() << "Error while marking the shared memory segment to be destroyed";
ok = (xshminfo.shmaddr != (char*)-1);
if (ok)
- image = QImage((uchar *)xshmimg->data, width, height, systemFormat());
+ image = QImage((uchar *)xshmimg->data, width, height, format);
}
xshminfo.readOnly = false;
if (ok)
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index adf3ce3..bc6db90 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -2119,6 +2119,11 @@ void QAbstractItemView::focusOutEvent(QFocusEvent *event)
Q_D(QAbstractItemView);
QAbstractScrollArea::focusOutEvent(event);
d->viewport->update();
+
+#ifdef QT_SOFTKEYS_ENABLED
+ if(!hasEditFocus())
+ removeAction(d->doneSoftKey);
+#endif
}
/*!
@@ -2144,7 +2149,12 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
if (!hasEditFocus()) {
setEditFocus(true);
#ifdef QT_SOFTKEYS_ENABLED
- addAction(d->doneSoftKey);
+ // If we can't keypad navigate to any direction, there is no sense to add
+ // "Done" softkey, since it basically does nothing when there is
+ // only one widget in screen
+ if(QWidgetPrivate::canKeypadNavigate(Qt::Horizontal)
+ || QWidgetPrivate::canKeypadNavigate(Qt::Vertical))
+ addAction(d->doneSoftKey);
#endif
return;
}
@@ -2160,6 +2170,26 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
event->ignore();
}
return;
+ case Qt::Key_Down:
+ case Qt::Key_Up:
+ // Let's ignore vertical navigation events, only if there is no other widget
+ // what can take the focus in vertical direction. This means widget can handle navigation events
+ // even the widget don't have edit focus, and there is no other widget in requested direction.
+ if(QApplication::keypadNavigationEnabled() && !hasEditFocus()
+ && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) {
+ event->ignore();
+ return;
+ }
+ break;
+ case Qt::Key_Left:
+ case Qt::Key_Right:
+ // Similar logic as in up and down events
+ if(QApplication::keypadNavigationEnabled() && !hasEditFocus()
+ && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) || QWidgetPrivate::inTabWidget(this))) {
+ event->ignore();
+ return;
+ }
+ break;
default:
if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) {
event->ignore();
@@ -2245,7 +2275,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
case Qt::Key_Down:
case Qt::Key_Up:
#ifdef QT_KEYPAD_NAVIGATION
- if (QApplication::keypadNavigationEnabled()) {
+ if (QApplication::keypadNavigationEnabled() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) {
event->accept(); // don't change focus
break;
}
@@ -2253,8 +2283,10 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
case Qt::Key_Left:
case Qt::Key_Right:
#ifdef QT_KEYPAD_NAVIGATION
- if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) {
- event->accept(); // don't change horizontal focus in directional mode
+ if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional
+ && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal)
+ || (QWidgetPrivate::inTabWidget(this) && d->model->columnCount(d->root) > 1))) {
+ event->accept(); // don't change focus
break;
}
#endif // QT_KEYPAD_NAVIGATION
diff --git a/src/gui/itemviews/qabstractproxymodel.cpp b/src/gui/itemviews/qabstractproxymodel.cpp
index 40345a7..43a1327 100644
--- a/src/gui/itemviews/qabstractproxymodel.cpp
+++ b/src/gui/itemviews/qabstractproxymodel.cpp
@@ -127,6 +127,7 @@ void QAbstractProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
} else {
d->model = QAbstractItemModelPrivate::staticEmptyModel();
}
+ d->roleNames = d->model->roleNames();
}
/*!
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 3e2e6f6..baefdfd 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -597,7 +597,9 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod
TUint s60Keysym = QApplicationPrivate::resolveS60ScanCode(keyEvent.iScanCode,
keyEvent.iCode);
int keyCode;
- if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) {
+ if (s60Keysym == EKeyNull){ //some key events have 0 in iCode, for them iScanCode should be used
+ keyCode = qt_keymapper_private()->mapS60ScanCodesToQt(keyEvent.iScanCode);
+ } else if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) {
// Normal characters keys.
keyCode = s60Keysym;
} else {
@@ -1146,6 +1148,10 @@ void qt_init(QApplicationPrivate * /* priv */, int)
#endif
S60->wsSession().SetAutoFlush(ETrue);
+#ifdef Q_SYMBIAN_WINDOW_SIZE_CACHE
+ TRAP_IGNORE(S60->wsSession().EnableWindowSizeCacheL());
+#endif
+
S60->updateScreenSize();
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 31d245f..131b9bb 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1905,8 +1905,13 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
break;
if (!msg.wParam) {
+#ifdef Q_WS_WINCE
+ // On Windows CE, lParam parameter is a constant, not a char pointer.
+ if (msg.lParam == INI_INTL) {
+#else
QString area = QString::fromWCharArray((wchar_t*)msg.lParam);
if (area == QLatin1String("intl")) {
+#endif
QLocalePrivate::updateSystemPrivate();
if (!widget->testAttribute(Qt::WA_SetLocale))
widget->dptr()->setLocale_helper(QLocale(), true);
diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h
index 09c36c88..3e42d6e 100644
--- a/src/gui/kernel/qkeymapper_p.h
+++ b/src/gui/kernel/qkeymapper_p.h
@@ -207,12 +207,12 @@ public:
KeyboardLayoutItem *keyLayout[256];
#elif defined(Q_WS_QWS)
#elif defined(Q_OS_SYMBIAN)
-private:
- QHash<TUint, int> s60ToQtKeyMap;
- void fillKeyMap();
public:
QString translateKeyEvent(int keySym, Qt::KeyboardModifiers modifiers);
int mapS60KeyToQt(TUint s60key);
+ int mapS60ScanCodesToQt(TUint s60key);
+ int mapQtToS60Key(int qtKey);
+ int mapQtToS60ScanCodes(int qtKey);
#endif
};
diff --git a/src/gui/kernel/qkeymapper_s60.cpp b/src/gui/kernel/qkeymapper_s60.cpp
index 6e21420..fd263ef 100644
--- a/src/gui/kernel/qkeymapper_s60.cpp
+++ b/src/gui/kernel/qkeymapper_s60.cpp
@@ -46,7 +46,6 @@ QT_BEGIN_NAMESPACE
QKeyMapperPrivate::QKeyMapperPrivate()
{
- fillKeyMap();
}
QKeyMapperPrivate::~QKeyMapperPrivate()
@@ -74,174 +73,145 @@ QString QKeyMapperPrivate::translateKeyEvent(int keySym, Qt::KeyboardModifiers /
return QString(QChar(keySym));
}
-void QKeyMapperPrivate::fillKeyMap()
+#include <e32keys.h>
+struct KeyMapping{
+ TKeyCode s60KeyCode;
+ TStdScanCode s60ScanCode;
+ Qt::Key qtKey;
+};
+
+using namespace Qt;
+
+static const KeyMapping keyMapping[] = {
+ {EKeyBackspace, EStdKeyBackspace, Key_Backspace},
+ {EKeyTab, EStdKeyTab, Key_Tab},
+ {EKeyEnter, EStdKeyEnter, Key_Enter},
+ {EKeyEscape, EStdKeyEscape, Key_Escape},
+ {EKeySpace, EStdKeySpace, Key_Space},
+ {EKeyDelete, EStdKeyDelete, Key_Delete},
+ {EKeyPrintScreen, EStdKeyPrintScreen, Key_SysReq},
+ {EKeyPause, EStdKeyPause, Key_Pause},
+ {EKeyHome, EStdKeyHome, Key_Home},
+ {EKeyEnd, EStdKeyEnd, Key_End},
+ {EKeyPageUp, EStdKeyPageUp, Key_PageUp},
+ {EKeyPageDown, EStdKeyPageDown, Key_PageDown},
+ {EKeyInsert, EStdKeyInsert, Key_Insert},
+ {EKeyLeftArrow, EStdKeyLeftArrow, Key_Left},
+ {EKeyRightArrow, EStdKeyRightArrow, Key_Right},
+ {EKeyUpArrow, EStdKeyUpArrow, Key_Up},
+ {EKeyDownArrow, EStdKeyDownArrow, Key_Down},
+ {EKeyLeftShift, EStdKeyLeftShift, Key_Shift},
+ {EKeyRightShift, EStdKeyRightShift, Key_Shift},
+ {EKeyLeftAlt, EStdKeyLeftAlt, Key_Alt},
+ {EKeyRightAlt, EStdKeyRightAlt, Key_AltGr},
+ {EKeyLeftCtrl, EStdKeyLeftCtrl, Key_Control},
+ {EKeyRightCtrl, EStdKeyRightCtrl, Key_Control},
+ {EKeyLeftFunc, EStdKeyLeftFunc, Key_Super_L},
+ {EKeyRightFunc, EStdKeyRightFunc, Key_Super_R},
+ {EKeyCapsLock, EStdKeyCapsLock, Key_CapsLock},
+ {EKeyNumLock, EStdKeyNumLock, Key_NumLock},
+ {EKeyScrollLock, EStdKeyScrollLock, Key_ScrollLock},
+ {EKeyF1, EStdKeyF1, Key_F1},
+ {EKeyF2, EStdKeyF2, Key_F2},
+ {EKeyF3, EStdKeyF3, Key_F3},
+ {EKeyF4, EStdKeyF4, Key_F4},
+ {EKeyF5, EStdKeyF5, Key_F5},
+ {EKeyF6, EStdKeyF6, Key_F6},
+ {EKeyF7, EStdKeyF7, Key_F7},
+ {EKeyF8, EStdKeyF8, Key_F8},
+ {EKeyF9, EStdKeyF9, Key_F9},
+ {EKeyF10, EStdKeyF10, Key_F10},
+ {EKeyF11, EStdKeyF11, Key_F11},
+ {EKeyF12, EStdKeyF12, Key_F12},
+ {EKeyF13, EStdKeyF13, Key_F13},
+ {EKeyF14, EStdKeyF14, Key_F14},
+ {EKeyF15, EStdKeyF15, Key_F15},
+ {EKeyF16, EStdKeyF16, Key_F16},
+ {EKeyF17, EStdKeyF17, Key_F17},
+ {EKeyF18, EStdKeyF18, Key_F18},
+ {EKeyF19, EStdKeyF19, Key_F19},
+ {EKeyF20, EStdKeyF20, Key_F20},
+ {EKeyF21, EStdKeyF21, Key_F21},
+ {EKeyF22, EStdKeyF22, Key_F22},
+ {EKeyF23, EStdKeyF23, Key_F23},
+ {EKeyF24, EStdKeyF24, Key_F24},
+ {EKeyOff, EStdKeyOff, Key_PowerOff},
+// {EKeyMenu, EStdKeyMenu, Key_Menu}, // Menu is EKeyApplication0
+ {EKeyHelp, EStdKeyHelp, Key_Help},
+ {EKeyDial, EStdKeyDial, Key_Call},
+ {EKeyIncVolume, EStdKeyIncVolume, Key_VolumeUp},
+ {EKeyDecVolume, EStdKeyDecVolume, Key_VolumeDown},
+ {EKeyDevice0, EStdKeyDevice0, Key_Context1}, // Found by manual testing.
+ {EKeyDevice1, EStdKeyDevice1, Key_Context2}, // Found by manual testing.
+ {EKeyDevice3, EStdKeyDevice3, Key_Select},
+// {EKeyDevice7, EStdKeyDevice7, Key_Camera}, //not supported by qt yet
+ {EKeyApplication0, EStdKeyApplication0, Key_Menu}, // Found by manual testing.
+ {EKeyApplication1, EStdKeyApplication1, Key_Launch1}, // Found by manual testing.
+ {EKeyApplication2, EStdKeyApplication2, Key_MediaPlay}, // Found by manual testing.
+ {EKeyApplication3, EStdKeyApplication3, Key_MediaStop}, // Found by manual testing.
+ {EKeyApplication4, EStdKeyApplication4, Key_MediaNext}, // Found by manual testing.
+ {EKeyApplication5, EStdKeyApplication5, Key_MediaPrevious}, // Found by manual testing.
+ {EKeyApplication6, EStdKeyApplication6, Key_Launch6},
+ {EKeyApplication7, EStdKeyApplication7, Key_Launch7},
+ {EKeyApplication8, EStdKeyApplication8, Key_Launch8},
+ {EKeyApplication9, EStdKeyApplication9, Key_Launch9},
+ {EKeyApplicationA, EStdKeyApplicationA, Key_LaunchA},
+ {EKeyApplicationB, EStdKeyApplicationB, Key_LaunchB},
+ {EKeyApplicationC, EStdKeyApplicationC, Key_LaunchC},
+ {EKeyApplicationD, EStdKeyApplicationD, Key_LaunchD},
+ {EKeyApplicationE, EStdKeyApplicationE, Key_LaunchE},
+ {EKeyApplicationF, EStdKeyApplicationF, Key_LaunchF},
+// {EKeyApplication19, EStdKeyApplication19, Key_CameraFocus}, //not supported by qt yet
+ {EKeyYes, EStdKeyYes, Key_Yes},
+ {EKeyNo, EStdKeyNo, Key_No},
+ {TKeyCode(0), TStdScanCode(0), Qt::Key(0)}
+};
+
+int QKeyMapperPrivate::mapS60KeyToQt(TUint s60key)
{
- using namespace Qt;
- static const struct {
- TUint s60Key;
- int qtKey;
- } map[] = {
- {EKeyBell, Key_unknown},
- {EKeyBackspace, Key_Backspace},
- {EKeyTab, Key_Tab},
- {EKeyLineFeed, Key_unknown},
- {EKeyVerticalTab, Key_unknown},
- {EKeyFormFeed, Key_unknown},
- {EKeyEnter, Key_Enter},
- {EKeyEscape, Key_Escape},
- {EKeySpace, Key_Space},
- {EKeyDelete, Key_Delete},
- {EKeyPrintScreen, Key_SysReq},
- {EKeyPause, Key_Pause},
- {EKeyHome, Key_Home},
- {EKeyEnd, Key_End},
- {EKeyPageUp, Key_PageUp},
- {EKeyPageDown, Key_PageDown},
- {EKeyInsert, Key_Insert},
- {EKeyLeftArrow, Key_Left},
- {EKeyRightArrow, Key_Right},
- {EKeyUpArrow, Key_Up},
- {EKeyDownArrow, Key_Down},
- {EKeyLeftShift, Key_Shift},
- {EKeyRightShift, Key_Shift},
- {EKeyLeftAlt, Key_Alt},
- {EKeyRightAlt, Key_AltGr},
- {EKeyLeftCtrl, Key_Control},
- {EKeyRightCtrl, Key_Control},
- {EKeyLeftFunc, Key_Super_L},
- {EKeyRightFunc, Key_Super_R},
- {EKeyCapsLock, Key_CapsLock},
- {EKeyNumLock, Key_NumLock},
- {EKeyScrollLock, Key_ScrollLock},
- {EKeyF1, Key_F1},
- {EKeyF2, Key_F2},
- {EKeyF3, Key_F3},
- {EKeyF4, Key_F4},
- {EKeyF5, Key_F5},
- {EKeyF6, Key_F6},
- {EKeyF7, Key_F7},
- {EKeyF8, Key_F8},
- {EKeyF9, Key_F9},
- {EKeyF10, Key_F10},
- {EKeyF11, Key_F11},
- {EKeyF12, Key_F12},
- {EKeyF13, Key_F13},
- {EKeyF14, Key_F14},
- {EKeyF15, Key_F15},
- {EKeyF16, Key_F16},
- {EKeyF17, Key_F17},
- {EKeyF18, Key_F18},
- {EKeyF19, Key_F19},
- {EKeyF20, Key_F20},
- {EKeyF21, Key_F21},
- {EKeyF22, Key_F22},
- {EKeyF23, Key_F23},
- {EKeyF24, Key_F24},
- {EKeyOff, Key_unknown},
- {EKeyIncContrast, Key_unknown},
- {EKeyDecContrast, Key_unknown},
- {EKeyBacklightOn, Key_unknown},
- {EKeyBacklightOff, Key_unknown},
- {EKeyBacklightToggle, Key_unknown},
- {EKeySliderDown, Key_unknown},
- {EKeySliderUp, Key_unknown},
- {EKeyMenu, Key_Menu},
- {EKeyDictaphonePlay, Key_unknown},
- {EKeyDictaphoneStop, Key_unknown},
- {EKeyDictaphoneRecord, Key_unknown},
- {EKeyHelp, Key_unknown},
- {EKeyDial, Key_Call},
- {EKeyScreenDimension0, Key_unknown},
- {EKeyScreenDimension1, Key_unknown},
- {EKeyScreenDimension2, Key_unknown},
- {EKeyScreenDimension3, Key_unknown},
- {EKeyIncVolume, Key_unknown},
- {EKeyDecVolume, Key_unknown},
- {EKeyDevice0, Key_Context1}, // Found by manual testing, left softkey.
- {EKeyDevice1, Key_Context2}, // Found by manual testing.
- {EKeyDevice2, Key_unknown},
- {EKeyDevice3, Key_Select}, // Found by manual testing.
- {EKeyDevice4, Key_unknown},
- {EKeyDevice5, Key_unknown},
- {EKeyDevice6, Key_unknown},
- {EKeyDevice7, Key_unknown},
- {EKeyDevice8, Key_unknown},
- {EKeyDevice9, Key_unknown},
- {EKeyDeviceA, Key_unknown},
- {EKeyDeviceB, Key_unknown},
- {EKeyDeviceC, Key_unknown},
- {EKeyDeviceD, Key_unknown},
- {EKeyDeviceE, Key_unknown},
- {EKeyDeviceF, Key_unknown},
- {EKeyApplication0, Key_Launch0},
- {EKeyApplication1, Key_Launch1},
- {EKeyApplication2, Key_Launch2},
- {EKeyApplication3, Key_Launch3},
- {EKeyApplication4, Key_Launch4},
- {EKeyApplication5, Key_Launch5},
- {EKeyApplication6, Key_Launch6},
- {EKeyApplication7, Key_Launch7},
- {EKeyApplication8, Key_Launch8},
- {EKeyApplication9, Key_Launch9},
- {EKeyApplicationA, Key_LaunchA},
- {EKeyApplicationB, Key_LaunchB},
- {EKeyApplicationC, Key_LaunchC},
- {EKeyApplicationD, Key_LaunchD},
- {EKeyApplicationE, Key_LaunchE},
- {EKeyApplicationF, Key_LaunchF},
- {EKeyYes, Key_Yes},
- {EKeyNo, Key_No},
- {EKeyIncBrightness, Key_unknown},
- {EKeyDecBrightness, Key_unknown},
- {EKeyKeyboardExtend, Key_unknown},
- {EKeyDevice10, Key_unknown},
- {EKeyDevice11, Key_unknown},
- {EKeyDevice12, Key_unknown},
- {EKeyDevice13, Key_unknown},
- {EKeyDevice14, Key_unknown},
- {EKeyDevice15, Key_unknown},
- {EKeyDevice16, Key_unknown},
- {EKeyDevice17, Key_unknown},
- {EKeyDevice18, Key_unknown},
- {EKeyDevice19, Key_unknown},
- {EKeyDevice1A, Key_unknown},
- {EKeyDevice1B, Key_unknown},
- {EKeyDevice1C, Key_unknown},
- {EKeyDevice1D, Key_unknown},
- {EKeyDevice1E, Key_unknown},
- {EKeyDevice1F, Key_unknown},
- {EKeyApplication10, Key_unknown},
- {EKeyApplication11, Key_unknown},
- {EKeyApplication12, Key_unknown},
- {EKeyApplication13, Key_unknown},
- {EKeyApplication14, Key_unknown},
- {EKeyApplication15, Key_unknown},
- {EKeyApplication16, Key_unknown},
- {EKeyApplication17, Key_unknown},
- {EKeyApplication18, Key_unknown},
- {EKeyApplication19, Key_unknown},
- {EKeyApplication1A, Key_unknown},
- {EKeyApplication1B, Key_unknown},
- {EKeyApplication1C, Key_unknown},
- {EKeyApplication1D, Key_unknown},
- {EKeyApplication1E, Key_unknown},
- {EKeyApplication1F, Key_unknown}
- };
- const int mapSize = int(sizeof(map)/sizeof(map[0]));
- s60ToQtKeyMap.reserve(mapSize + 5); // +5? docs: Ideally, slightly more than number of items
- for (int i = 0; i < mapSize; ++i)
- s60ToQtKeyMap.insert(map[i].s60Key, map[i].qtKey);
+ int res = Qt::Key_unknown;
+ for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) {
+ if (keyMapping[i].s60KeyCode == s60key) {
+ res = keyMapping[i].qtKey;
+ break;
+ }
+ }
+ return res;
}
-int QKeyMapperPrivate::mapS60KeyToQt(TUint s60key)
+int QKeyMapperPrivate::mapS60ScanCodesToQt(TUint s60scanCode)
{
- QHash<TUint, int>::const_iterator mapping;
- mapping = s60ToQtKeyMap.find(s60key);
- if (mapping != s60ToQtKeyMap.end()) {
- return *mapping;
- } else {
- return Qt::Key_unknown;
+ int res = Qt::Key_unknown;
+ for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) {
+ if (keyMapping[i].s60ScanCode == s60scanCode) {
+ res = keyMapping[i].qtKey;
+ break;
+ }
}
+ return res;
}
+int QKeyMapperPrivate::mapQtToS60Key(int qtKey)
+{
+ int res = KErrUnknown;
+ for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) {
+ if (keyMapping[i].qtKey == qtKey) {
+ res = keyMapping[i].s60KeyCode;
+ break;
+ }
+ }
+ return res;
+}
+
+int QKeyMapperPrivate::mapQtToS60ScanCodes(int qtKey)
+{
+ int res = KErrUnknown;
+ for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) {
+ if (keyMapping[i].qtKey == qtKey) {
+ res = keyMapping[i].s60ScanCode;
+ break;
+ }
+ }
+ return res;
+}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 1e9b1d9..2f6ec6b 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -118,6 +118,10 @@
#include "private/qgraphicssystem_p.h"
#include "private/qgesturemanager_p.h"
+#ifdef QT_KEYPAD_NAVIGATION
+#include "qtabwidget.h" // Needed in inTabWidget()
+#endif // QT_KEYPAD_NAVIGATION
+
// widget/widget data creation count
//#define QWIDGET_EXTRA_DEBUG
//#define ALIEN_DEBUG
@@ -11641,6 +11645,45 @@ QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction)
}
return targetWidget;
}
+
+/*!
+ \internal
+
+ Tells us if it there is currently a reachable widget by keypad navigation in
+ a certain \a orientation.
+ If no navigation is possible, occuring key events in that \a orientation may
+ be used to interact with the value in the focussed widget, even though it
+ currently has not the editFocus.
+
+ \sa QWidgetPrivate::widgetInNavigationDirection(), QWidget::hasEditFocus()
+*/
+bool QWidgetPrivate::canKeypadNavigate(Qt::Orientation orientation)
+{
+ return orientation == Qt::Horizontal?
+ (QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionEast)
+ || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionWest))
+ :(QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionNorth)
+ || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionSouth));
+}
+/*!
+ \internal
+
+ Checks, if the \a widget is inside a QTabWidget. If is is inside
+ one, left/right key events will be used to switch between tabs in keypad
+ navigation. If there is no QTabWidget, the horizontal key events can be used
+to
+ interact with the value in the focussed widget, even though it currently has
+ not the editFocus.
+
+ \sa QWidget::hasEditFocus()
+*/
+bool QWidgetPrivate::inTabWidget(QWidget *widget)
+{
+ for (QWidget *tabWidget = widget; tabWidget; tabWidget = tabWidget->parentWidget())
+ if (qobject_cast<const QTabWidget*>(tabWidget))
+ return true;
+ return false;
+}
#endif
/*!
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index da9e9eb..dcb87fc 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -4543,8 +4543,20 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r)
}
}
+ // ### Scroll the dirty regions as well, the following is not correct.
+ QRegion displayRegion = r.isNull() ? dirtyOnWidget : (dirtyOnWidget & r);
+ const QVector<QRect> &rects = dirtyOnWidget.rects();
+ const QVector<QRect>::const_iterator end = rects.end();
+ QVector<QRect>::const_iterator it = rects.begin();
+ while (it != end) {
+ const QRect rect = *it;
+ const NSRect dirtyRect = NSMakeRect(rect.x() + dx, rect.y() + dy,
+ rect.width(), rect.height());
+ [view setNeedsDisplayInRect:dirtyRect];
+ ++it;
+ }
+
NSSize deltaSize = NSMakeSize(dx, dy);
- [view translateRectsNeedingDisplayInRect:scrollRect by:deltaSize];
[view scrollRect:scrollRect by:deltaSize];
[view setNeedsDisplayInRect:deltaXRect];
[view setNeedsDisplayInRect:deltaYRect];
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 75b4c12..efd9a0a 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -475,6 +475,8 @@ public:
#ifdef QT_KEYPAD_NAVIGATION
static bool navigateToDirection(Direction direction);
static QWidget *widgetInNavigationDirection(Direction direction);
+ static bool canKeypadNavigate(Qt::Orientation orientation);
+ static bool inTabWidget(QWidget *widget);
#endif
void setWindowIconText_sys(const QString &cap);
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 1f9fc32..bc1bece 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -5749,6 +5749,13 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
return positionRect(w, subRule, subRule2, pe, opt->rect, opt->direction);
}
+#ifndef QT_NO_TOOLBAR
+ case SE_ToolBarHandle:
+ if (hasStyleRule(w, PseudoElement_ToolBarHandle))
+ return ParentStyle::subElementRect(se, opt, w);
+ break;
+#endif //QT_NO_TOOLBAR
+
default:
break;
}
diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp
index 4bd7b5a..2888490 100644
--- a/src/gui/widgets/qabstractslider.cpp
+++ b/src/gui/widgets/qabstractslider.cpp
@@ -47,9 +47,6 @@
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
-#ifdef QT_KEYPAD_NAVIGATION
-#include "qtabwidget.h" // Needed in inTabWidget()
-#endif // QT_KEYPAD_NAVIGATION
#include <limits.h>
QT_BEGIN_NAMESPACE
@@ -702,7 +699,7 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb
stepsToScroll = qBound(-pageStep, int(offset * pageStep), pageStep);
offset_accumulated = 0;
} else {
- // Calculate how many lines to scroll. Depending on what delta is (and
+ // Calculate how many lines to scroll. Depending on what delta is (and
// offset), we might end up with a fraction (e.g. scroll 1.3 lines). We can
// only scroll whole lines, so we keep the reminder until next event.
qreal stepsToScrollF =
@@ -749,45 +746,7 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e)
}
#endif
-#ifdef QT_KEYPAD_NAVIGATION
-/*!
- \internal
-
- Tells us if it there is currently a reachable widget by keypad navigation in
- a certain \a orientation.
- If no navigation is possible, occuring key events in that \a orientation may
- be used to interact with the value in the focussed widget, even though it
- currently has not the editFocus.
- \sa QWidgetPrivate::widgetInNavigationDirection(), QWidget::hasEditFocus()
-*/
-inline static bool canKeypadNavigate(Qt::Orientation orientation)
-{
- return orientation == Qt::Horizontal?
- (QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionEast)
- || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionWest))
- :(QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionNorth)
- || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionSouth));
-}
-/*!
- \internal
-
- Checks, if the \a widget is inside a QTabWidget. If is is inside
- one, left/right key events will be used to switch between tabs in keypad
- navigation. If there is no QTabWidget, the horizontal key events can be used to
- interact with the value in the focussed widget, even though it currently has
- not the editFocus.
-
- \sa QWidget::hasEditFocus()
-*/
-inline static bool inTabWidget(QWidget *widget)
-{
- for (QWidget *tabWidget = widget; tabWidget; tabWidget = tabWidget->parentWidget())
- if (qobject_cast<const QTabWidget*>(tabWidget))
- return true;
- return false;
-}
-#endif // QT_KEYPAD_NAVIGATION
/*!
\reimp
*/
@@ -853,7 +812,8 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
if (QApplication::keypadNavigationEnabled()
&& (!hasEditFocus() && QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder
|| d->orientation == Qt::Vertical
- || !hasEditFocus() && (canKeypadNavigate(Qt::Horizontal) || inTabWidget(this)))) {
+ || !hasEditFocus()
+ && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) || QWidgetPrivate::inTabWidget(this)))) {
ev->ignore();
return;
}
@@ -872,7 +832,8 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
if (QApplication::keypadNavigationEnabled()
&& (!hasEditFocus() && QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder
|| d->orientation == Qt::Vertical
- || !hasEditFocus() && (canKeypadNavigate(Qt::Horizontal) || inTabWidget(this)))) {
+ || !hasEditFocus()
+ && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) || QWidgetPrivate::inTabWidget(this)))) {
ev->ignore();
return;
}
@@ -892,7 +853,7 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
if (QApplication::keypadNavigationEnabled()
&& (QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder
|| d->orientation == Qt::Horizontal
- || !hasEditFocus() && canKeypadNavigate(Qt::Vertical))) {
+ || !hasEditFocus() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical))) {
ev->ignore();
break;
}
@@ -905,7 +866,7 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
if (QApplication::keypadNavigationEnabled()
&& (QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder
|| d->orientation == Qt::Horizontal
- || !hasEditFocus() && canKeypadNavigate(Qt::Vertical))) {
+ || !hasEditFocus() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical))) {
ev->ignore();
break;
}
diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp
index 1aa7a2b..2c76a5c 100644
--- a/src/gui/widgets/qlineedit_p.cpp
+++ b/src/gui/widgets/qlineedit_p.cpp
@@ -129,7 +129,7 @@ void QLineEditPrivate::_q_editFocusChange(bool e)
void QLineEditPrivate::_q_selectionChanged()
{
Q_Q(QLineEdit);
- if (control->preeditAreaText().isEmpty()) {
+ if (!control->text().isEmpty() && control->preeditAreaText().isEmpty()) {
QStyleOptionFrameV2 opt;
q->initStyleOption(&opt);
bool showCursor = control->hasSelectedText() ?