diff options
author | Jens Bache-Wiig <jens.bache-wiig@digia.com> | 2013-12-10 18:15:35 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-12 10:24:10 +0100 |
commit | 25a8c637ec923b81dada1bb7e109ccffd1730f14 (patch) | |
tree | b2ee8de4c74b4eba2510b32b98e81e85ef646ed5 | |
parent | c9106ad03240df39ca3cace1cf46ab69b3ce7b54 (diff) | |
download | qtquickcontrols-25a8c637ec923b81dada1bb7e109ccffd1730f14.tar.gz |
Enable text eliding in base style tabs
This introduces text eliding in Base style tabs when there is not
enough space to draw the entire text label. In addition it removes the
need for clipping completely.
Change-Id: I58be7c88bff275984b97b04c1bd1a942e9d256e0
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
-rw-r--r-- | src/controls/Styles/Base/TabViewStyle.qml | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/controls/Styles/Base/TabViewStyle.qml b/src/controls/Styles/Base/TabViewStyle.qml index 430dd02f..29364bbb 100644 --- a/src/controls/Styles/Base/TabViewStyle.qml +++ b/src/controls/Styles/Base/TabViewStyle.qml @@ -142,11 +142,9 @@ Style { implicitWidth: Math.round(Math.min(maxTabWidth, textitem.implicitWidth + 20)) implicitHeight: Math.round(textitem.implicitHeight + 10) - clip: true Item { anchors.fill: parent anchors.bottomMargin: styleData.selected ? 0 : 2 - clip: true BorderImage { anchors.fill: parent source: styleData.selected ? "images/tab_selected.png" : "images/tab.png" @@ -157,25 +155,27 @@ Style { anchors.topMargin: styleData.selected ? 0 : 1 } } - Rectangle { - anchors.fill: textitem - anchors.margins: -1 - anchors.leftMargin: -3 - anchors.rightMargin: -3 - visible: (styleData.activeFocus && styleData.selected) - height: 6 - radius: 3 - color: "#224f9fef" - border.color: "#47b" - } Text { id: textitem - anchors.centerIn: parent - anchors.alignWhenCentered: true + anchors.fill: parent + anchors.leftMargin: 4 + anchors.rightMargin: 4 + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter text: styleData.title + elide: Text.ElideMiddle renderType: Text.NativeRendering scale: control.tabPosition === Qt.TopEdge ? 1 : -1 color: __syspal.text + Rectangle { + anchors.centerIn: parent + width: textitem.paintedWidth + 6 + height: textitem.paintedHeight + 4 + visible: (styleData.activeFocus && styleData.selected) + radius: 3 + color: "#224f9fef" + border.color: "#47b" + } } } |