Changeset View
Changeset View
Standalone View
Standalone View
src/declarativeimports/plasmacomponents/qml/Label.qml
Show All 12 Lines | |||||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Library General Public | 14 | * You should have received a copy of the GNU Library General Public | ||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.1 | 20 | import QtQuick 2.1 | ||
21 | import QtQuick.Window 2.2 | ||||
21 | import QtQuick.Controls 1.0 | 22 | import QtQuick.Controls 1.0 | ||
22 | import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate | 23 | import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate | ||
23 | import org.kde.plasma.core 2.0 as PlasmaCore | 24 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
24 | 25 | | |||
25 | /** | 26 | /** | ||
26 | * This is a label which uses the plasma theme. | 27 | * This is a label which uses the plasma theme. | ||
27 | * | 28 | * | ||
28 | * The characteristics of the text will be automatically set according to the | 29 | * The characteristics of the text will be automatically set according to the | ||
29 | * plasma theme. If you need a more customized text item use the Text component | 30 | * plasma theme. If you need a more customized text item use the Text component | ||
30 | * from QtQuick. | 31 | * from QtQuick. | ||
31 | * | 32 | * | ||
32 | * You can use all elements of the QML Text component, in particular the "text" | 33 | * You can use all elements of the QML Text component, in particular the "text" | ||
33 | * property to define the label text. | 34 | * property to define the label text. | ||
34 | * | 35 | * | ||
35 | * @inherit QtQuick.Text | 36 | * @inherit QtQuick.Text | ||
36 | */ | 37 | */ | ||
37 | Text { | 38 | Text { | ||
38 | id: root | 39 | id: root | ||
39 | 40 | | |||
40 | height: Math.round(Math.max(paintedHeight, theme.mSize(theme.defaultFont).height*1.6)) | 41 | height: Math.round(Math.max(paintedHeight, theme.mSize(theme.defaultFont).height*1.6)) | ||
41 | verticalAlignment: lineCount > 1 ? Text.AlignTop : Text.AlignVCenter | 42 | verticalAlignment: lineCount > 1 ? Text.AlignTop : Text.AlignVCenter | ||
42 | 43 | | |||
43 | activeFocusOnTab: false | 44 | activeFocusOnTab: false | ||
44 | renderType: QtQuickControlsPrivate.Settings.isMobile ? Text.QtRendering : Text.NativeRendering | 45 | | ||
46 | // Work around Qt bug where NativeRendering breaks for non-integer scale factors | ||||
47 | // https://bugreports.qt.io/browse/QTBUG-67007 | ||||
48 | renderType: QtQuickControlsPrivate.Settings.isMobile || Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering | ||||
45 | 49 | | |||
46 | font.capitalization: theme.defaultFont.capitalization | 50 | font.capitalization: theme.defaultFont.capitalization | ||
47 | font.family: theme.defaultFont.family | 51 | font.family: theme.defaultFont.family | ||
48 | font.italic: theme.defaultFont.italic | 52 | font.italic: theme.defaultFont.italic | ||
49 | font.letterSpacing: theme.defaultFont.letterSpacing | 53 | font.letterSpacing: theme.defaultFont.letterSpacing | ||
50 | font.pointSize: theme.defaultFont.pointSize | 54 | font.pointSize: theme.defaultFont.pointSize | ||
51 | font.strikeout: theme.defaultFont.strikeout | 55 | font.strikeout: theme.defaultFont.strikeout | ||
52 | font.underline: theme.defaultFont.underline | 56 | font.underline: theme.defaultFont.underline | ||
Show All 9 Lines |