diff options
-rw-r--r-- | demos/declarative/photoviewer/PhotoViewerCore/Button.qml | 4 | ||||
-rw-r--r-- | demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml | 40 | ||||
-rw-r--r-- | src/gui/painting/qdrawutil.cpp | 6 |
3 files changed, 17 insertions, 33 deletions
diff --git a/demos/declarative/photoviewer/PhotoViewerCore/Button.qml b/demos/declarative/photoviewer/PhotoViewerCore/Button.qml index c681064..5be096a 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/Button.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/Button.qml @@ -4,7 +4,7 @@ Item { id: container property alias label: labelText.text - property color tint: "#FFFFFFFF" + property string tint: "" signal clicked width: labelText.width + 70 ; height: labelText.height + 18 @@ -19,7 +19,7 @@ Item { Rectangle { anchors.fill: container; color: container.tint; visible: container.tint != "" - opacity: 0.1; smooth: true + opacity: 0.25; smooth: true } Text { id: labelText; font.pixelSize: 15; anchors.centerIn: parent; smooth: true } diff --git a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml index ccfda02..15ffe56 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml @@ -4,11 +4,10 @@ Item { id: container property string label - property color tint: "#FFFFFFFF" signal clicked signal labelChanged(string label) - width: labelText.width + 70 ; height: labelText.height + 18 + width: textInput.width + 70 ; height: textInput.height + 18 BorderImage { anchors { fill: container; leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 } @@ -18,36 +17,25 @@ Item { Image { anchors.fill: parent; source: "images/cardboard.png"; smooth: true } - Rectangle { - anchors.fill: container; color: container.tint; visible: container.tint != "" - opacity: 0.1; smooth: true - } - - Text { id: labelText; text: label; font.pixelSize: 15; anchors.centerIn: parent; smooth: true } - TextInput { - id: textInput; text: label; font.pixelSize: 15; anchors.centerIn: parent; smooth: true; visible: false - Keys.onReturnPressed: container.labelChanged(textInput.text) + id: textInput; text: label; font.pixelSize: 15; anchors.centerIn: parent; smooth: true + Keys.onReturnPressed: { + container.labelChanged(textInput.text) + container.focus = true + } Keys.onEscapePressed: { - textInput.text = labelText.text - container.state = '' + textInput.text = container.label + container.focus = true } } - MouseArea { - anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 } - onClicked: container.state = "editMode" - } - - states: State { - name: "editMode" - PropertyChanges { target: container; width: textInput.width + 70; height: textInput.height + 17 } - PropertyChanges { target: textInput; visible: true; focus: true } - PropertyChanges { target: labelText; visible: false } + Rectangle { + anchors.fill: container; border.color: "steelblue"; border.width: 4 + color: "transparent"; visible: textInput.focus; smooth: true } - onLabelChanged: { - labelText.text = label - container.state = '' + MouseArea { + anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 } + onClicked: textInput.forceFocus() } } diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index ef9b18c..3ce95ef 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -1138,12 +1138,10 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin yTarget.resize(rows + 1); bool oldAA = painter->testRenderHint(QPainter::Antialiasing); - bool oldSmooth = painter->testRenderHint(QPainter::SmoothPixmapTransform); if (painter->paintEngine()->type() != QPaintEngine::OpenGL && painter->paintEngine()->type() != QPaintEngine::OpenGL2 - && (oldSmooth || oldAA) && painter->combinedTransform().type() != QTransform::TxNone) { + && oldAA && painter->combinedTransform().type() != QTransform::TxNone) { painter->setRenderHint(QPainter::Antialiasing, false); - painter->setRenderHint(QPainter::SmoothPixmapTransform, false); } xTarget[0] = targetRect.left(); @@ -1354,8 +1352,6 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin if (oldAA) painter->setRenderHint(QPainter::Antialiasing, true); - if (oldSmooth) - painter->setRenderHint(QPainter::SmoothPixmapTransform, true); } QT_END_NAMESPACE |