From 1ca5742e83b650750d45d03882e8109c61c1f392 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 10 May 2010 10:54:32 +1000 Subject: There is no Qt.widgets Task-number: QTBUG-10469 --- examples/declarative/layouts/layoutItem/layoutItem.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/declarative/layouts/layoutItem/layoutItem.qml b/examples/declarative/layouts/layoutItem/layoutItem.qml index 9b9db22..460c564 100644 --- a/examples/declarative/layouts/layoutItem/layoutItem.qml +++ b/examples/declarative/layouts/layoutItem/layoutItem.qml @@ -1,5 +1,4 @@ import Qt 4.7 -import Qt.widgets 4.7 LayoutItem {//Sized by the layout id: resizable -- cgit v0.12 From b524e356424fe386eae56f65600077ce52ca6f92 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Mon, 10 May 2010 03:43:12 +0200 Subject: Optimize QGW constructor. Mostly by avoiding sending useless QVariant at construction time. itemChange is virtual, the user implementation will never be called. Worst case the QGW one. Reviewed-by:janarve --- src/gui/graphicsview/qgraphicsitem.cpp | 7 ++++--- src/gui/graphicsview/qgraphicswidget.cpp | 3 --- src/gui/graphicsview/qgraphicswidget_p.cpp | 9 ++++++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index ba674dd..b2bdc5c 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1090,6 +1090,10 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q if (newParent == parent) return; + if (isWidget) + static_cast(this)->fixFocusChainBeforeReparenting((newParent && + newParent->isWidget()) ? static_cast(newParent) : 0, + scene); if (scene) { // Deliver the change to the index if (scene->d_func()->indexMethod != QGraphicsScene::NoIndex) @@ -1796,9 +1800,6 @@ static void _q_qgraphicsItemSetFlag(QGraphicsItem *item, QGraphicsItem::Graphics */ void QGraphicsItem::setFlags(GraphicsItemFlags flags) { - if (isWindow()) - flags |= ItemIsPanel; - // Notify change and check for adjustment. if (quint32(d_ptr->flags) == quint32(flags)) return; diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index b264447..478c0c3 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -1105,9 +1105,6 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant & } break; case ItemParentChange: { - QGraphicsItem *parent = qVariantValue(value); - d->fixFocusChainBeforeReparenting((parent && parent->isWidget()) ? static_cast(parent) : 0, scene()); - // Deliver ParentAboutToChange. QEvent event(QEvent::ParentAboutToChange); QApplication::sendEvent(this, &event); diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp index 6e397b6..50b315a 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp @@ -71,14 +71,17 @@ void QGraphicsWidgetPrivate::init(QGraphicsItem *parentItem, Qt::WindowFlags wFl adjustWindowFlags(&wFlags); windowFlags = wFlags; - q->setParentItem(parentItem); + if (parentItem) + setParentItemHelper(parentItem, 0, 0); + q->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred, QSizePolicy::DefaultType)); q->setGraphicsItem(q); resolveLayoutDirection(); q->unsetWindowFrameMargins(); - q->setFlag(QGraphicsItem::ItemUsesExtendedStyleOption); - q->setFlag(QGraphicsItem::ItemSendsGeometryChanges); + flags |= QGraphicsItem::ItemUsesExtendedStyleOption | QGraphicsItem::ItemSendsGeometryChanges; + if (windowFlags & Qt::Window) + flags |= QGraphicsItem::ItemIsPanel; } qreal QGraphicsWidgetPrivate::titleBarHeight(const QStyleOptionTitleBar &options) const -- cgit v0.12 From 6ab242e23832f0ab10ef26a3b7b505cf086ddf43 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 10 May 2010 12:04:18 +1000 Subject: Prevent handling of Up/Down on Mac OS X, for consistency with other platforms. Task-number: QTBUG-10438 --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 9 +++++++-- .../qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 8 ++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 9ae4e1a..604f508 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -62,6 +62,9 @@ QT_BEGIN_NAMESPACE Input constraints include setting a QValidator, an input mask, or a maximum input length. + + On Mac OS X, the Up/Down key bindings for Home/End are explicitly disabled. + If you want such bindings (on any platform), you will need to construct them in QML. */ QDeclarativeTextInput::QDeclarativeTextInput(QDeclarativeItem* parent) : QDeclarativePaintedItem(*(new QDeclarativeTextInputPrivate), parent) @@ -860,10 +863,12 @@ void QDeclarativeTextInputPrivate::focusChanged(bool hasFocus) void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev) { Q_D(QDeclarativeTextInput); - if(((d->control->cursor() == 0 && ev->key() == Qt::Key_Left) + if (((ev->key() == Qt::Key_Up || ev->key() == Qt::Key_Down) && ev->modifiers() == Qt::NoModifier) // Don't allow MacOSX up/down support, and we don't allow a completer. + || (((d->control->cursor() == 0 && ev->key() == Qt::Key_Left) || (d->control->cursor() == d->control->text().length() && ev->key() == Qt::Key_Right)) - && (d->lastSelectionStart == d->lastSelectionEnd)){ + && (d->lastSelectionStart == d->lastSelectionEnd))) + { //ignore when moving off the end //unless there is a selection, because then moving will do something (deselect) ev->ignore(); diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 0065ccf..c00390d 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -576,6 +576,14 @@ void tst_qdeclarativetextinput::navigation() simulateKey(canvas, Qt::Key_Left); QVERIFY(input->hasFocus() == true); + // Up and Down should NOT do Home/End, even on Mac OS X (QTBUG-10438). + input->setCursorPosition(2); + QCOMPARE(input->cursorPosition(),2); + simulateKey(canvas, Qt::Key_Up); + QCOMPARE(input->cursorPosition(),2); + simulateKey(canvas, Qt::Key_Down); + QCOMPARE(input->cursorPosition(),2); + delete canvas; } -- cgit v0.12 From c4d8435f80ef72fa419591a666b4e989ccb2c173 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Mon, 10 May 2010 12:19:16 +1000 Subject: Remove debug messages from mousearea autotest file --- .../declarative/qdeclarativemousearea/data/rejectEvent.qml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/auto/declarative/qdeclarativemousearea/data/rejectEvent.qml b/tests/auto/declarative/qdeclarativemousearea/data/rejectEvent.qml index fecfadf..c01e938 100644 --- a/tests/auto/declarative/qdeclarativemousearea/data/rejectEvent.qml +++ b/tests/auto/declarative/qdeclarativemousearea/data/rejectEvent.qml @@ -14,15 +14,15 @@ Rectangle { MouseArea { id: mouseRegion1 anchors.fill: parent - onPressed: {console.log("press111"); root.mr1_pressed = true} - onReleased: {console.log("release111"); root.mr1_released = true} - onCanceled: {console.log("ungrab1111"); root.mr1_canceled = true} + onPressed: { root.mr1_pressed = true } + onReleased: { root.mr1_released = true } + onCanceled: { root.mr1_canceled = true } } MouseArea { id: mouseRegion2 width: 120; height: 120 - onPressed: {console.log("press222"); root.mr2_pressed = true; mouse.accepted = false} - onReleased: {console.log("release2222"); root.mr2_released = true} - onCanceled: {console.log("ungrab2222"); root.mr2_canceled = true} + onPressed: { root.mr2_pressed = true; mouse.accepted = false } + onReleased: { root.mr2_released = true } + onCanceled: { root.mr2_canceled = true } } } -- cgit v0.12 From b1b8d79cecb40e94ddaf91c0e319209849d27f9e Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Mon, 10 May 2010 12:29:13 +1000 Subject: Fixes doc of mouse area's onEntered Task-number: QTBUG-9227 --- src/declarative/graphicsitems/qdeclarativemousearea.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 74f2338..1947c00 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -197,8 +197,8 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() This handler is called when the mouse enters the mouse area. By default the onEntered handler is only called while a button is - pressed. Setting hoverEnabled to true enables handling of - onExited when no mouse button is pressed. + pressed. Setting hoverEnabled to true enables handling of + onEntered when no mouse button is pressed. \sa hoverEnabled */ @@ -209,7 +209,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() This handler is called when the mouse exists the mouse area. By default the onExited handler is only called while a button is - pressed. Setting hoverEnabled to true enables handling of + pressed. Setting hoverEnabled to true enables handling of onExited when no mouse button is pressed. \sa hoverEnabled -- cgit v0.12