Plasma controls based on QtQuickControls2
Summary:
This is a basic styling of a QtQuickControls2 series based on Plasma theme.
it has the main controls available in Qt 5.7
it installs them as a separate import (org.kde.plasma.controls 3.0) for
use restricted to plasmoids, is probably needed to be still installed as
a style as well
Test Plan:
tried with minimal QML files, a more comprehensive gallery may be needed.
pending considerations:
* some of the classes, like Drawer, the dialogs and ApplicationWindow *don't* make sense in plasmoids
* it will probably still need to be installed also as a qqc2 style, as this should be used in Plasma mobile
* probably only some of the controls should be installed as a separate import, the whole set as a style strictly for Plasma Mobile use. the same qml files would be used, so no maintainance overhead
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: davidedmundson, broulik, plasma-devel, #frameworks
Tags: #plasma, #frameworks
Differential Revision: https://phabricator.kde.org/D4508
2017-03-14 10:21:26 +01:00
|
|
|
/*
|
2020-08-13 21:08:54 +02:00
|
|
|
SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
*/
|
Plasma controls based on QtQuickControls2
Summary:
This is a basic styling of a QtQuickControls2 series based on Plasma theme.
it has the main controls available in Qt 5.7
it installs them as a separate import (org.kde.plasma.controls 3.0) for
use restricted to plasmoids, is probably needed to be still installed as
a style as well
Test Plan:
tried with minimal QML files, a more comprehensive gallery may be needed.
pending considerations:
* some of the classes, like Drawer, the dialogs and ApplicationWindow *don't* make sense in plasmoids
* it will probably still need to be installed also as a qqc2 style, as this should be used in Plasma mobile
* probably only some of the controls should be installed as a separate import, the whole set as a style strictly for Plasma Mobile use. the same qml files would be used, so no maintainance overhead
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: davidedmundson, broulik, plasma-devel, #frameworks
Tags: #plasma, #frameworks
Differential Revision: https://phabricator.kde.org/D4508
2017-03-14 10:21:26 +01:00
|
|
|
|
|
|
|
import QtQuick 2.6
|
Fix text scaling with non-integer scale factors when PLASMA_USE_QT_SCALING=1 is set
Summary:
When `PLASMA_USE_QT_SCALING=1` is set, Plasma uses native Qt scaling. This works fine for integer scale factors, and fixes a lot of bugs (see [[https://bugs.kde.org/show_bug.cgi?id=356446|Bug 356446]]) but it introduces a new one: with non-integer scale factors, text becomes blurry and pixellated because of a bug in `Text.NativeRendering`: https://bugreports.qt.io/browse/QTBUG-67007
QQC2-desktop-style forces the use of `Text.QtRendering` rendering for non-integer scale factors, successfully working around the problem. But PlasmaComponents QML objects don't implement the same workaround, so we see the issue in Plasma. This patch fixes that, and gets us one step closer to being able to use Qt scaling in Plasmashell.
There is no effect when `PLASMA_USE_QT_SCALING=1` is not being used.
FIXED-IN 5.13
BUG: 391691
BUG: 384031
CCBUG: 386216
CCBUG: 391695
CCBUG: 391694
CCBUG: 385547
CCBUG: 391692
CCBUG: 356446
Test Plan:
Before: `PLASMA_USE_QT_SCALING=1` set, 1.2 scale factor: Plasma text looks awful:
{F5749797}
After: `PLASMA_USE_QT_SCALING=1` set, 1.2 scale factor: Plasma text looks amazing!
{F5749798}
Note that we still get sub-pixel anti-aliasing and good kerning. There appear to be no layout regressions.
Without both `PLASMA_USE_QT_SCALING=1` and a non-integer scale factor set, there is no visual change compared to the status quo.
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: mart, broulik, #frameworks
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D11244
2018-03-13 14:46:14 +01:00
|
|
|
import QtQuick.Window 2.2
|
2018-01-24 13:25:40 +01:00
|
|
|
import QtQuick.Controls @QQC2_VERSION@
|
|
|
|
import QtQuick.Templates @QQC2_VERSION@ as T
|
Plasma controls based on QtQuickControls2
Summary:
This is a basic styling of a QtQuickControls2 series based on Plasma theme.
it has the main controls available in Qt 5.7
it installs them as a separate import (org.kde.plasma.controls 3.0) for
use restricted to plasmoids, is probably needed to be still installed as
a style as well
Test Plan:
tried with minimal QML files, a more comprehensive gallery may be needed.
pending considerations:
* some of the classes, like Drawer, the dialogs and ApplicationWindow *don't* make sense in plasmoids
* it will probably still need to be installed also as a qqc2 style, as this should be used in Plasma mobile
* probably only some of the controls should be installed as a separate import, the whole set as a style strictly for Plasma Mobile use. the same qml files would be used, so no maintainance overhead
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: davidedmundson, broulik, plasma-devel, #frameworks
Tags: #plasma, #frameworks
Differential Revision: https://phabricator.kde.org/D4508
2017-03-14 10:21:26 +01:00
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
2020-10-02 18:06:59 +02:00
|
|
|
import org.kde.kconfig 1.0
|
Plasma controls based on QtQuickControls2
Summary:
This is a basic styling of a QtQuickControls2 series based on Plasma theme.
it has the main controls available in Qt 5.7
it installs them as a separate import (org.kde.plasma.controls 3.0) for
use restricted to plasmoids, is probably needed to be still installed as
a style as well
Test Plan:
tried with minimal QML files, a more comprehensive gallery may be needed.
pending considerations:
* some of the classes, like Drawer, the dialogs and ApplicationWindow *don't* make sense in plasmoids
* it will probably still need to be installed also as a qqc2 style, as this should be used in Plasma mobile
* probably only some of the controls should be installed as a separate import, the whole set as a style strictly for Plasma Mobile use. the same qml files would be used, so no maintainance overhead
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: davidedmundson, broulik, plasma-devel, #frameworks
Tags: #plasma, #frameworks
Differential Revision: https://phabricator.kde.org/D4508
2017-03-14 10:21:26 +01:00
|
|
|
import "private" as Private
|
2018-11-12 17:25:00 +01:00
|
|
|
import org.kde.kirigami 2.5 as Kirigami
|
2019-04-10 11:27:37 +02:00
|
|
|
import "mobiletextselection" as MobileTextSelection
|
Plasma controls based on QtQuickControls2
Summary:
This is a basic styling of a QtQuickControls2 series based on Plasma theme.
it has the main controls available in Qt 5.7
it installs them as a separate import (org.kde.plasma.controls 3.0) for
use restricted to plasmoids, is probably needed to be still installed as
a style as well
Test Plan:
tried with minimal QML files, a more comprehensive gallery may be needed.
pending considerations:
* some of the classes, like Drawer, the dialogs and ApplicationWindow *don't* make sense in plasmoids
* it will probably still need to be installed also as a qqc2 style, as this should be used in Plasma mobile
* probably only some of the controls should be installed as a separate import, the whole set as a style strictly for Plasma Mobile use. the same qml files would be used, so no maintainance overhead
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: davidedmundson, broulik, plasma-devel, #frameworks
Tags: #plasma, #frameworks
Differential Revision: https://phabricator.kde.org/D4508
2017-03-14 10:21:26 +01:00
|
|
|
|
|
|
|
T.TextField {
|
|
|
|
id: control
|
|
|
|
|
2020-07-11 22:07:12 +02:00
|
|
|
/**
|
|
|
|
* Whether the button to clear the text from TextField is visible.
|
|
|
|
* @since 5.73
|
|
|
|
*/
|
|
|
|
property bool clearButtonShown: false
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether to show a button that allows the user to reveal the password in
|
|
|
|
* plain text. This only makes sense if the echoMode is set to Password.
|
|
|
|
* @since 5.73
|
|
|
|
*/
|
|
|
|
property bool revealPasswordButtonShown: false
|
|
|
|
|
|
|
|
// this takes into account kiosk restriction
|
|
|
|
readonly property bool __effectiveRevealPasswordButtonShown: revealPasswordButtonShown
|
|
|
|
&& KAuthorized.authorize("lineedit_reveal_password")
|
2020-11-03 02:02:39 +01:00
|
|
|
&& (echoMode == TextInput.Normal || control.text.length > 0)
|
2020-07-11 22:07:12 +02:00
|
|
|
|
2021-03-11 21:24:49 +01:00
|
|
|
// Can't guarantee that background will always be present or have the margins property
|
|
|
|
readonly property bool __hasBackgroundAndMargins: background && background.hasOwnProperty("margins")
|
|
|
|
|
2021-07-14 10:55:55 +02:00
|
|
|
/* It might be preferable to do background width OR content width if we
|
2021-03-11 21:24:49 +01:00
|
|
|
* want content to stay within the background rather than expanding the
|
|
|
|
* control, but this is maintaining compatibility with the pre-existing
|
|
|
|
* behavior. Use the following 2 lines if you want text to stay within the
|
|
|
|
* background:
|
|
|
|
implicitBackgroundWidth + leftInset + rightInset
|
|
|
|
|| Math.ceil(Math.max(contentWidth, placeholder.implicitWidth)) + leftPadding + rightPadding
|
|
|
|
*/
|
|
|
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
|
|
|
Math.ceil(Math.max(contentWidth, placeholder.implicitWidth)) + leftPadding + rightPadding)
|
|
|
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
|
|
|
contentHeight + topPadding + bottomPadding,
|
|
|
|
placeholder.implicitHeight + topPadding + bottomPadding)
|
|
|
|
|
2021-03-14 01:59:40 +01:00
|
|
|
leftPadding: (__hasBackgroundAndMargins ? background.margins.left : 0) + (control.mirrored ? inlineButtonRow.width : 0)
|
2021-03-11 21:24:49 +01:00
|
|
|
topPadding: __hasBackgroundAndMargins ? background.margins.top : 0
|
2021-03-14 01:59:40 +01:00
|
|
|
rightPadding: (__hasBackgroundAndMargins ? background.margins.right : 0) + (control.mirrored ? 0 : inlineButtonRow.width)
|
2021-03-11 21:24:49 +01:00
|
|
|
bottomPadding: __hasBackgroundAndMargins ? background.margins.bottom : 0
|
|
|
|
|
|
|
|
PlasmaCore.ColorScope.inherit: !background || !background.visible
|
|
|
|
PlasmaCore.ColorScope.colorGroup: PlasmaCore.Theme.ViewColorGroup
|
|
|
|
|
|
|
|
color: PlasmaCore.Theme.textColor
|
|
|
|
placeholderTextColor: PlasmaCore.Theme.disabledTextColor
|
|
|
|
selectionColor: PlasmaCore.Theme.highlightColor
|
|
|
|
selectedTextColor: PlasmaCore.Theme.highlightedTextColor
|
Plasma controls based on QtQuickControls2
Summary:
This is a basic styling of a QtQuickControls2 series based on Plasma theme.
it has the main controls available in Qt 5.7
it installs them as a separate import (org.kde.plasma.controls 3.0) for
use restricted to plasmoids, is probably needed to be still installed as
a style as well
Test Plan:
tried with minimal QML files, a more comprehensive gallery may be needed.
pending considerations:
* some of the classes, like Drawer, the dialogs and ApplicationWindow *don't* make sense in plasmoids
* it will probably still need to be installed also as a qqc2 style, as this should be used in Plasma mobile
* probably only some of the controls should be installed as a separate import, the whole set as a style strictly for Plasma Mobile use. the same qml files would be used, so no maintainance overhead
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: davidedmundson, broulik, plasma-devel, #frameworks
Tags: #plasma, #frameworks
Differential Revision: https://phabricator.kde.org/D4508
2017-03-14 10:21:26 +01:00
|
|
|
verticalAlignment: TextInput.AlignVCenter
|
2021-03-11 21:24:49 +01:00
|
|
|
// Manually setting this fixes alignment in RTL layouts
|
|
|
|
horizontalAlignment: TextInput.AlignLeft
|
Plasma controls based on QtQuickControls2
Summary:
This is a basic styling of a QtQuickControls2 series based on Plasma theme.
it has the main controls available in Qt 5.7
it installs them as a separate import (org.kde.plasma.controls 3.0) for
use restricted to plasmoids, is probably needed to be still installed as
a style as well
Test Plan:
tried with minimal QML files, a more comprehensive gallery may be needed.
pending considerations:
* some of the classes, like Drawer, the dialogs and ApplicationWindow *don't* make sense in plasmoids
* it will probably still need to be installed also as a qqc2 style, as this should be used in Plasma mobile
* probably only some of the controls should be installed as a separate import, the whole set as a style strictly for Plasma Mobile use. the same qml files would be used, so no maintainance overhead
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: davidedmundson, broulik, plasma-devel, #frameworks
Tags: #plasma, #frameworks
Differential Revision: https://phabricator.kde.org/D4508
2017-03-14 10:21:26 +01:00
|
|
|
opacity: control.enabled ? 1 : 0.6
|
2018-11-12 17:25:00 +01:00
|
|
|
hoverEnabled: !Kirigami.Settings.tabletMode
|
Fix text scaling with non-integer scale factors when PLASMA_USE_QT_SCALING=1 is set
Summary:
When `PLASMA_USE_QT_SCALING=1` is set, Plasma uses native Qt scaling. This works fine for integer scale factors, and fixes a lot of bugs (see [[https://bugs.kde.org/show_bug.cgi?id=356446|Bug 356446]]) but it introduces a new one: with non-integer scale factors, text becomes blurry and pixellated because of a bug in `Text.NativeRendering`: https://bugreports.qt.io/browse/QTBUG-67007
QQC2-desktop-style forces the use of `Text.QtRendering` rendering for non-integer scale factors, successfully working around the problem. But PlasmaComponents QML objects don't implement the same workaround, so we see the issue in Plasma. This patch fixes that, and gets us one step closer to being able to use Qt scaling in Plasmashell.
There is no effect when `PLASMA_USE_QT_SCALING=1` is not being used.
FIXED-IN 5.13
BUG: 391691
BUG: 384031
CCBUG: 386216
CCBUG: 391695
CCBUG: 391694
CCBUG: 385547
CCBUG: 391692
CCBUG: 356446
Test Plan:
Before: `PLASMA_USE_QT_SCALING=1` set, 1.2 scale factor: Plasma text looks awful:
{F5749797}
After: `PLASMA_USE_QT_SCALING=1` set, 1.2 scale factor: Plasma text looks amazing!
{F5749798}
Note that we still get sub-pixel anti-aliasing and good kerning. There appear to be no layout regressions.
Without both `PLASMA_USE_QT_SCALING=1` and a non-integer scale factor set, there is no visual change compared to the status quo.
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: mart, broulik, #frameworks
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D11244
2018-03-13 14:46:14 +01:00
|
|
|
|
|
|
|
// Work around Qt bug where NativeRendering breaks for non-integer scale factors
|
2020-07-15 00:35:28 +02:00
|
|
|
// https://bugreports.qt.io/browse/QTBUG-70481
|
Fix text scaling with non-integer scale factors when PLASMA_USE_QT_SCALING=1 is set
Summary:
When `PLASMA_USE_QT_SCALING=1` is set, Plasma uses native Qt scaling. This works fine for integer scale factors, and fixes a lot of bugs (see [[https://bugs.kde.org/show_bug.cgi?id=356446|Bug 356446]]) but it introduces a new one: with non-integer scale factors, text becomes blurry and pixellated because of a bug in `Text.NativeRendering`: https://bugreports.qt.io/browse/QTBUG-67007
QQC2-desktop-style forces the use of `Text.QtRendering` rendering for non-integer scale factors, successfully working around the problem. But PlasmaComponents QML objects don't implement the same workaround, so we see the issue in Plasma. This patch fixes that, and gets us one step closer to being able to use Qt scaling in Plasmashell.
There is no effect when `PLASMA_USE_QT_SCALING=1` is not being used.
FIXED-IN 5.13
BUG: 391691
BUG: 384031
CCBUG: 386216
CCBUG: 391695
CCBUG: 391694
CCBUG: 385547
CCBUG: 391692
CCBUG: 356446
Test Plan:
Before: `PLASMA_USE_QT_SCALING=1` set, 1.2 scale factor: Plasma text looks awful:
{F5749797}
After: `PLASMA_USE_QT_SCALING=1` set, 1.2 scale factor: Plasma text looks amazing!
{F5749798}
Note that we still get sub-pixel anti-aliasing and good kerning. There appear to be no layout regressions.
Without both `PLASMA_USE_QT_SCALING=1` and a non-integer scale factor set, there is no visual change compared to the status quo.
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: mart, broulik, #frameworks
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D11244
2018-03-13 14:46:14 +01:00
|
|
|
renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering
|
Plasma controls based on QtQuickControls2
Summary:
This is a basic styling of a QtQuickControls2 series based on Plasma theme.
it has the main controls available in Qt 5.7
it installs them as a separate import (org.kde.plasma.controls 3.0) for
use restricted to plasmoids, is probably needed to be still installed as
a style as well
Test Plan:
tried with minimal QML files, a more comprehensive gallery may be needed.
pending considerations:
* some of the classes, like Drawer, the dialogs and ApplicationWindow *don't* make sense in plasmoids
* it will probably still need to be installed also as a qqc2 style, as this should be used in Plasma mobile
* probably only some of the controls should be installed as a separate import, the whole set as a style strictly for Plasma Mobile use. the same qml files would be used, so no maintainance overhead
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: davidedmundson, broulik, plasma-devel, #frameworks
Tags: #plasma, #frameworks
Differential Revision: https://phabricator.kde.org/D4508
2017-03-14 10:21:26 +01:00
|
|
|
|
2018-11-12 17:25:00 +01:00
|
|
|
selectByMouse: !Kirigami.Settings.tabletMode
|
|
|
|
|
2019-04-01 21:07:46 +02:00
|
|
|
cursorDelegate: Kirigami.Settings.tabletMode ? mobileCursor : null
|
2018-11-12 17:25:00 +01:00
|
|
|
Component {
|
|
|
|
id: mobileCursor
|
2019-04-10 11:27:37 +02:00
|
|
|
MobileTextSelection.MobileCursor {
|
2018-11-29 13:57:35 +01:00
|
|
|
target: control
|
2018-11-12 17:25:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
onFocusChanged: {
|
|
|
|
if (focus) {
|
2019-04-10 11:27:37 +02:00
|
|
|
MobileTextSelection.MobileTextActionsToolBar.controlRoot = control;
|
2018-11-12 17:25:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-24 11:54:53 +02:00
|
|
|
onTextChanged: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = false;
|
|
|
|
onPressed: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = true;
|
|
|
|
|
2018-11-12 17:25:00 +01:00
|
|
|
onPressAndHold: {
|
|
|
|
if (!Kirigami.Settings.tabletMode) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
forceActiveFocus();
|
|
|
|
cursorPosition = positionAt(event.x, event.y);
|
|
|
|
selectWord();
|
|
|
|
}
|
2019-04-16 11:21:34 +02:00
|
|
|
MobileTextSelection.MobileCursor {
|
2018-11-29 13:57:35 +01:00
|
|
|
target: control
|
2018-11-12 17:25:00 +01:00
|
|
|
selectionStartHandle: true
|
2018-11-29 13:57:35 +01:00
|
|
|
property var rect: target.positionToRectangle(target.selectionStart)
|
2018-11-12 17:25:00 +01:00
|
|
|
//FIXME: this magic values seem to be always valid, for every font,every dpi, every scaling
|
|
|
|
x: rect.x + 5
|
|
|
|
y: rect.y + 6
|
|
|
|
}
|
|
|
|
|
Plasma controls based on QtQuickControls2
Summary:
This is a basic styling of a QtQuickControls2 series based on Plasma theme.
it has the main controls available in Qt 5.7
it installs them as a separate import (org.kde.plasma.controls 3.0) for
use restricted to plasmoids, is probably needed to be still installed as
a style as well
Test Plan:
tried with minimal QML files, a more comprehensive gallery may be needed.
pending considerations:
* some of the classes, like Drawer, the dialogs and ApplicationWindow *don't* make sense in plasmoids
* it will probably still need to be installed also as a qqc2 style, as this should be used in Plasma mobile
* probably only some of the controls should be installed as a separate import, the whole set as a style strictly for Plasma Mobile use. the same qml files would be used, so no maintainance overhead
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: davidedmundson, broulik, plasma-devel, #frameworks
Tags: #plasma, #frameworks
Differential Revision: https://phabricator.kde.org/D4508
2017-03-14 10:21:26 +01:00
|
|
|
Label {
|
|
|
|
id: placeholder
|
2021-03-14 02:06:13 +01:00
|
|
|
enabled: false
|
Plasma controls based on QtQuickControls2
Summary:
This is a basic styling of a QtQuickControls2 series based on Plasma theme.
it has the main controls available in Qt 5.7
it installs them as a separate import (org.kde.plasma.controls 3.0) for
use restricted to plasmoids, is probably needed to be still installed as
a style as well
Test Plan:
tried with minimal QML files, a more comprehensive gallery may be needed.
pending considerations:
* some of the classes, like Drawer, the dialogs and ApplicationWindow *don't* make sense in plasmoids
* it will probably still need to be installed also as a qqc2 style, as this should be used in Plasma mobile
* probably only some of the controls should be installed as a separate import, the whole set as a style strictly for Plasma Mobile use. the same qml files would be used, so no maintainance overhead
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: davidedmundson, broulik, plasma-devel, #frameworks
Tags: #plasma, #frameworks
Differential Revision: https://phabricator.kde.org/D4508
2017-03-14 10:21:26 +01:00
|
|
|
x: control.leftPadding
|
|
|
|
y: control.topPadding
|
2021-03-11 21:24:49 +01:00
|
|
|
width: control.availableWidth
|
|
|
|
height: control.availableHeight
|
Plasma controls based on QtQuickControls2
Summary:
This is a basic styling of a QtQuickControls2 series based on Plasma theme.
it has the main controls available in Qt 5.7
it installs them as a separate import (org.kde.plasma.controls 3.0) for
use restricted to plasmoids, is probably needed to be still installed as
a style as well
Test Plan:
tried with minimal QML files, a more comprehensive gallery may be needed.
pending considerations:
* some of the classes, like Drawer, the dialogs and ApplicationWindow *don't* make sense in plasmoids
* it will probably still need to be installed also as a qqc2 style, as this should be used in Plasma mobile
* probably only some of the controls should be installed as a separate import, the whole set as a style strictly for Plasma Mobile use. the same qml files would be used, so no maintainance overhead
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: davidedmundson, broulik, plasma-devel, #frameworks
Tags: #plasma, #frameworks
Differential Revision: https://phabricator.kde.org/D4508
2017-03-14 10:21:26 +01:00
|
|
|
|
|
|
|
text: control.placeholderText
|
|
|
|
font: control.font
|
2021-03-11 21:24:49 +01:00
|
|
|
color: control.placeholderTextColor
|
Plasma controls based on QtQuickControls2
Summary:
This is a basic styling of a QtQuickControls2 series based on Plasma theme.
it has the main controls available in Qt 5.7
it installs them as a separate import (org.kde.plasma.controls 3.0) for
use restricted to plasmoids, is probably needed to be still installed as
a style as well
Test Plan:
tried with minimal QML files, a more comprehensive gallery may be needed.
pending considerations:
* some of the classes, like Drawer, the dialogs and ApplicationWindow *don't* make sense in plasmoids
* it will probably still need to be installed also as a qqc2 style, as this should be used in Plasma mobile
* probably only some of the controls should be installed as a separate import, the whole set as a style strictly for Plasma Mobile use. the same qml files would be used, so no maintainance overhead
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: davidedmundson, broulik, plasma-devel, #frameworks
Tags: #plasma, #frameworks
Differential Revision: https://phabricator.kde.org/D4508
2017-03-14 10:21:26 +01:00
|
|
|
horizontalAlignment: control.horizontalAlignment
|
|
|
|
verticalAlignment: control.verticalAlignment
|
|
|
|
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
|
|
|
|
elide: Text.ElideRight
|
2021-03-11 21:24:49 +01:00
|
|
|
renderType: control.renderType
|
Plasma controls based on QtQuickControls2
Summary:
This is a basic styling of a QtQuickControls2 series based on Plasma theme.
it has the main controls available in Qt 5.7
it installs them as a separate import (org.kde.plasma.controls 3.0) for
use restricted to plasmoids, is probably needed to be still installed as
a style as well
Test Plan:
tried with minimal QML files, a more comprehensive gallery may be needed.
pending considerations:
* some of the classes, like Drawer, the dialogs and ApplicationWindow *don't* make sense in plasmoids
* it will probably still need to be installed also as a qqc2 style, as this should be used in Plasma mobile
* probably only some of the controls should be installed as a separate import, the whole set as a style strictly for Plasma Mobile use. the same qml files would be used, so no maintainance overhead
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: davidedmundson, broulik, plasma-devel, #frameworks
Tags: #plasma, #frameworks
Differential Revision: https://phabricator.kde.org/D4508
2017-03-14 10:21:26 +01:00
|
|
|
}
|
|
|
|
|
2020-07-11 22:07:12 +02:00
|
|
|
Row {
|
2020-11-16 22:02:11 +01:00
|
|
|
id: inlineButtonRow
|
2020-07-11 22:07:12 +02:00
|
|
|
anchors.right: control.right
|
2021-03-11 21:24:49 +01:00
|
|
|
anchors.rightMargin: control.__hasBackgroundAndMargins ? background.margins.right : 0
|
2020-07-11 22:07:12 +02:00
|
|
|
anchors.verticalCenter: control.verticalCenter
|
|
|
|
|
|
|
|
PlasmaCore.IconItem {
|
|
|
|
id: showPasswordButton
|
|
|
|
source: __effectiveRevealPasswordButtonShown ? (control.echoMode === TextInput.Normal ? "visibility": "hint") : ""
|
2021-03-05 20:22:42 +01:00
|
|
|
height: Math.max(control.height * 0.8, PlasmaCore.Units.iconSizes.small)
|
2020-07-11 22:07:12 +02:00
|
|
|
width: height
|
|
|
|
opacity: (__effectiveRevealPasswordButtonShown && control.enabled) ? 1 : 0
|
|
|
|
visible: opacity > 0
|
|
|
|
Behavior on opacity {
|
|
|
|
NumberAnimation {
|
2021-03-05 20:22:42 +01:00
|
|
|
duration: PlasmaCore.Units.longDuration
|
2020-07-11 22:07:12 +02:00
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
enabled: __effectiveRevealPasswordButtonShown
|
|
|
|
onClicked: {
|
|
|
|
control.echoMode = (control.echoMode == TextInput.Normal ? TextInput.Password : TextInput.Normal)
|
|
|
|
control.forceActiveFocus()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PlasmaCore.IconItem {
|
|
|
|
id: clearButton
|
|
|
|
//ltr confusingly refers to the direction of the arrow in the icon, not the text direction which it should be used in
|
|
|
|
source: clearButtonShown ? (LayoutMirroring.enabled ? "edit-clear-locationbar-ltr" : "edit-clear-locationbar-rtl") : ""
|
2021-03-05 20:22:42 +01:00
|
|
|
height: Math.max(control.height * 0.8, PlasmaCore.Units.iconSizes.small)
|
2020-07-11 22:07:12 +02:00
|
|
|
width: height
|
|
|
|
opacity: (control.length > 0 && clearButtonShown && control.enabled) ? 1 : 0
|
|
|
|
visible: opacity > 0
|
|
|
|
Behavior on opacity {
|
|
|
|
NumberAnimation {
|
2021-03-05 20:22:42 +01:00
|
|
|
duration: PlasmaCore.Units.longDuration
|
2020-07-11 22:07:12 +02:00
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
2021-03-11 21:24:49 +01:00
|
|
|
control.clear()
|
2020-07-11 22:07:12 +02:00
|
|
|
control.forceActiveFocus()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-11 21:24:49 +01:00
|
|
|
background: PlasmaCore.FrameSvgItem {
|
|
|
|
implicitWidth: PlasmaCore.Units.gridUnit * 8 + margins.left + margins.right
|
|
|
|
implicitHeight: PlasmaCore.Units.gridUnit + margins.top + margins.bottom
|
|
|
|
imagePath: "widgets/lineedit"
|
|
|
|
prefix: "base"
|
|
|
|
|
Plasma controls based on QtQuickControls2
Summary:
This is a basic styling of a QtQuickControls2 series based on Plasma theme.
it has the main controls available in Qt 5.7
it installs them as a separate import (org.kde.plasma.controls 3.0) for
use restricted to plasmoids, is probably needed to be still installed as
a style as well
Test Plan:
tried with minimal QML files, a more comprehensive gallery may be needed.
pending considerations:
* some of the classes, like Drawer, the dialogs and ApplicationWindow *don't* make sense in plasmoids
* it will probably still need to be installed also as a qqc2 style, as this should be used in Plasma mobile
* probably only some of the controls should be installed as a separate import, the whole set as a style strictly for Plasma Mobile use. the same qml files would be used, so no maintainance overhead
Reviewers: #plasma, davidedmundson
Reviewed By: #plasma, davidedmundson
Subscribers: davidedmundson, broulik, plasma-devel, #frameworks
Tags: #plasma, #frameworks
Differential Revision: https://phabricator.kde.org/D4508
2017-03-14 10:21:26 +01:00
|
|
|
Private.TextFieldFocus {
|
|
|
|
state: control.activeFocus ? "focus" : (control.hovered ? "hover" : "hidden")
|
|
|
|
anchors.fill: parent
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|