Commit Graph

29 Commits

Author SHA1 Message Date
Christophe Giboudeaux
1587ead53e Fix typos found by codespell
GIT_SILENT
2021-07-14 11:01:00 +02:00
Noah Davis
669f25347f [PC3 TextField] set on placeholder text
Fixes cursor not being an I beam when placehoder text is hovered.
2021-03-13 20:06:13 -05:00
Noah Davis
1b71490296 [PC3 TextField] mirrored -> control.mirrored
Fixes "ReferenceError: mirrored is not defined"
2021-03-13 19:59:40 -05:00
Noah Davis
52b9c9e94a [PC3] Refactor TextField
Compensate for inset in implicit size.

Set padding to 0 if background is not present or does not have the margins property.

Use more of TextField's properties for setting the appearance.

Fix input alignment in RTL layouts.

Use colorGroup to set colors instead of deprecated properties.

Make placeholder text renderType match TextField's.

Use `clear()` instead of `text = ""`.

Use disableTextColor for placeholderTextColor.

Reduce background to 2 elements and set implicit size like most controls.

Set `anchors.rightMargin` of inlineButtonRow to `background.margins.right`.
2021-03-13 13:59:02 +00:00
Nate Graham
5447cef2d8 Port to singleton Units
The context property version is slower to access and won't be supported
in Qt6. Let's port away from it and use the singleton version instead.

Here was my full process for making this change:

1. Made the change with `find . -name '*.qml' | xargs perl -pi -e 's/units\./PlasmaCore\.Units\./g'`
2. Verified no more occurrences with `grep -r " units."`
3. Made sure this didn't change any comments in a silly way by inspecting the output of `git diff | grep "+   " | grep "//"`
4. Manually inspected the full git diff to make sure there were no other unintentional or silly changes (there were none)
5. verified that all changed files have the PlasmaCore import with the correct name with `for FILE in `git status | grep modified | cut -d ":" -f 3`; do grep -q "as PlasmaCore" $FILE || echo "$FILE needs the PlasmaCore import"; done` (one needed the import)
2021-03-07 13:34:47 +00:00
Nate Graham
15b75de387 [plasmacomponents3/TextField|TextArea] Fix placeholder text
In TextField, it was not disabled, so the mousearea that changes the
cursor shape wasn't working properly. Fixed now.

In TextArea, it was not disabled, not the right color, and was
inappropriately selectable. Fixed now.

The UI tests were testing for these conditions but were broken, and are
now fixed by these changes.

BUG: 433864
FIXED-IN: 5.80
2021-03-02 12:44:07 -07:00
Nate Graham
c5fa23f858 [textfield] Fix clear button overlapping text
This change mirrors what the Kirigami ActionTextField does to solve the
same problem.

BUG: 429187
FIXED-IN: 5.77
2020-11-24 17:01:31 +00:00
Aleix Pol
bc25ad21f0 Fix porting issue
textField does not exist here, it's called control. Also QQC2.TextField
doesn't have length, we need to check the text.
2020-11-03 02:27:39 +01:00
Aleix Pol
0e5338fcc9 TextField 3: Add missing import
Looking at kscreenlocker logs I noticed this was missing.
2020-10-07 15:05:41 +00:00
Andreas Cord-Landwehr
d10afb5d2a plasma-framework: Convert copyright statements to SPDX expressions 2020-08-13 19:08:54 +00:00
Nate Graham
1a2e4023b0 Correct QT Bug URL for font rendering hack
This makes it clear which version of Qt (5.14) Frameworks has to be
able to depend on before we can remove the font rendering hack.
2020-07-14 16:35:28 -06:00
Nate Graham
e607c1ae47 Unify height of PC3 buttons, TextFields, and Comboboxes
Now all of them have a base height of units.gridUnit. Combined with
the standard 6px margins it works out to make all of these controls
a uniform 30px tall with the default Noto Sans 10 font. If the font
is changed or the size is increased, even to absurd levels, all of
them scale evenly.
2020-07-13 14:59:59 +00:00
Nate Graham
26fdcbea63 [PlasmaComponents3] Add missing features to TextField
The PC3 version was missing the clear button and show password button,
which the PC2 version has. This should allow us to port more things to
use the PC3 version.
2020-07-11 14:11:32 -06:00
Marco Martin
ba0b637de9 fix layout size hints for button labels
Summary:
icon sizes and label placements tested correct in  several scenarios

* control.icon.width/height is used as maximum size of the icon
* if the button is smaller icons always scale down
* icons stay ccentered regardless of button size when there is no text

Test Plan:
fixes icon sizes without workarounds like D27260
{F8108705}

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D27460
2020-02-19 12:12:41 +01:00
Marco Martin
667dce502a make sure the size hints are integer and even
Summary:
for retrocompatibility with pc2 units.gridUnit * 1.6 is used
a lot as size hint (we have to guarantee buttons and
textfields have the same height by default for perfect
horizontal alignment.
tough we have make sure that size is integer and even otherwise
we'll have a lot of internal misalignments

Reviewers: broulik

Reviewed By: broulik

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D27399
2020-02-14 13:55:21 +01:00
Marco Martin
9aeaf7cbb5 make the mobile text toolbar appear only on press 2019-04-24 11:54:53 +02:00
Marco Martin
8431223542 use the mobiletextcursor from proper namespace 2019-04-16 11:21:34 +02:00
Marco Martin
58dd4c5c0f separe mobile text selection to avoid recursive imports
Summary:
the mobile text selection toolbar uses toolbuttons, which in turn use the
private import. This will make the components loading stuck in dependency
resolution

Test Plan: all loads correctly now

Reviewers: #plasma, hein

Reviewed By: #plasma, hein

Subscribers: hein, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D20428
2019-04-10 13:53:44 +02:00
Eike Hein
846741f851 Revert "use the right namespace"
This reverts commit 067ec2eafc.
2019-04-10 06:54:30 +09:00
Eike Hein
a280cccfde Revert "mov the mobile text actions in own import"
This reverts commit c72ee78bbb.

Broke PlasmaComponents3. Missing files? Error example:

MenuRepresentation.qml:172:5: Type PlasmaComponents3.TextField unavailable
file:///home/eike/devel/install/lib64/qml/org/kde/plasma/components.3/TextField.qml:27:1: "mobiletextselection": no such directory

CCMAIL:notmart@gmail.com
2019-04-10 06:52:45 +09:00
Marco Martin
067ec2eafc use the right namespace 2019-04-09 15:40:36 +02:00
Marco Martin
c72ee78bbb mov the mobile text actions in own import
this avoids a qml type resolution recurtion which can
in some cases stuck the component to loading forever
this was particularly visible in plasma mobile
2019-04-08 13:32:46 +02:00
Aleix Pol
decabe7b67 Fix qml warning 2019-04-01 21:07:46 +02:00
Marco Martin
52ba5871b1 same behavior as qwidgets comboboxes
popup opens on press, moving the cursor over items and releasing
actually triggers it.
Same logic as in the desktop style
2018-11-29 13:57:35 +01:00
Marco Martin
513923f7b5 Mobile text selection controls
Summary:
in QQC2 the text selection controls depend upon the style, which has to
implement it by itself
this adds touch based draggable cursor and text selection handles,
alongside a tiny toolbar for cut/copy/paste

the desktop style will need the exact same thing
T10023

Test Plan:
works correctly when in tablet mode, none of this is visible
when in desktop mode where the text fields behave normally

Reviewers: #plasma, bshah

Reviewed By: #plasma, bshah

Subscribers: ngraham, abetts, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16841
2018-11-12 17:45:10 +01:00
Nathaniel Graham
a21bc11fe1 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-16 16:26:38 -06:00
Nathaniel Graham
a8c347f255 Reduce visibility of PC3 TextField placeholder text
Summary: The PlasmaComponents TextField makes placeholder text light enough so that it doesn't compete with other UI elements, but the PC3 version does not. This patch fixes that.

Test Plan:
Before:
{F5734041}

After:
{F5734042}

Reviewers: mart, hein, #plasma

Reviewed By: mart, #plasma

Subscribers: #frameworks

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D10922
2018-02-28 11:10:04 -07:00
Marco Martin
f906178713 parametrize qqc2 version
Summary:
for styles in order to work at all they need to import
the latest available qqc2 version installed in the system
or any app using new qqc2 feature will fail to load.
do like in qqc2-desktop-style and set the import version
at build time

Test Plan: all generated files have 2.3 here as version and apps using qqc2 still oload

Reviewers: #plasma, bshah

Reviewed By: #plasma, bshah

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D10074
2018-01-24 13:32:35 +01:00
Marco Martin
76af5399dd 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:33 +01:00