diff options
author | A-Team <ateam@pad.test.qt.nokia.com> | 2010-11-25 23:00:22 (GMT) |
---|---|---|
committer | A-Team <ateam@pad.test.qt.nokia.com> | 2010-11-25 23:00:22 (GMT) |
commit | 42cb23ebf64b0b108f9581a4516e42c3a0f1b069 (patch) | |
tree | eb57bfc054e977f07c094b10515a1c378fc2fbf1 /src/declarative | |
parent | dcce5c796e5cd5cb090f1c395e483269bab01566 (diff) | |
parent | c2f6fe50c06e4285085db17ea3a9d9254cf21f48 (diff) | |
download | Qt-42cb23ebf64b0b108f9581a4516e42c3a0f1b069.zip Qt-42cb23ebf64b0b108f9581a4516e42c3a0f1b069.tar.gz Qt-42cb23ebf64b0b108f9581a4516e42c3a0f1b069.tar.bz2 |
Merge branch '4.7-upstream' into 4.7-doc
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeevents.cpp | 30 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativerectangle.cpp | 8 |
2 files changed, 37 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeevents.cpp b/src/declarative/graphicsitems/qdeclarativeevents.cpp index 61fd562..4b5e777 100644 --- a/src/declarative/graphicsitems/qdeclarativeevents.cpp +++ b/src/declarative/graphicsitems/qdeclarativeevents.cpp @@ -108,6 +108,34 @@ Item { so that ancestor items do not also respond to the same event. */ +/*! + \qmlproperty int KeyEvent::modifiers + + This property holds the keyboard modifier flags that existed immediately + before the event occurred. + + It contains a bitwise combination of: + \list + \o Qt.NoModifier - No modifier key is pressed. + \o Qt.ShiftModifier - A Shift key on the keyboard is pressed. + \o Qt.ControlModifier - A Ctrl key on the keyboard is pressed. + \o Qt.AltModifier - An Alt key on the keyboard is pressed. + \o Qt.MetaModifier - A Meta key on the keyboard is pressed. + \o Qt.KeypadModifier - A keypad button is pressed. + \endlist + + For example, to react to a Shift key + Enter key combination: + \qml + Item { + focus: true + Keys.onPressed: { + if ((event.key == Qt.Key_Enter) && (event.modifiers & Qt.ShiftModifier)) + doSomething(); + } + } + \endqml +*/ + /*! \qmlclass MouseEvent QDeclarativeMouseEvent @@ -199,7 +227,7 @@ Item { \qml MouseArea { onClicked: { - if (mouse.button == Qt.LeftButton && mouse.modifiers & Qt.ShiftModifier) + if ((mouse.button == Qt.LeftButton) && (mouse.modifiers & Qt.ShiftModifier)) doSomething(); } } diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 7686dde..dedb3f7 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -420,6 +420,10 @@ void QDeclarativeRectangle::generateRoundedRect() p.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, d->rectImage.width()-(pw+1), d->rectImage.height()-(pw+1)), d->radius, d->radius); else p.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, d->rectImage.width()-pw, d->rectImage.height()-pw), d->radius, d->radius); + + // end painting before inserting pixmap + // to pixmap cache to avoid a deep copy + p.end(); QPixmapCache::insert(key, d->rectImage); } } @@ -454,6 +458,10 @@ void QDeclarativeRectangle::generateBorderedRect() p.drawRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, d->rectImage.width()-(pw+1), d->rectImage.height()-(pw+1))); else p.drawRect(QRectF(qreal(pw)/2, qreal(pw)/2, d->rectImage.width()-pw, d->rectImage.height()-pw)); + + // end painting before inserting pixmap + // to pixmap cache to avoid a deep copy + p.end(); QPixmapCache::insert(key, d->rectImage); } } |