D14345: Give the PlasmaComponents3 TextField the ability to have a Clear button

Safa Alfulaij noreply at phabricator.kde.org
Thu Jul 26 22:00:17 BST 2018


safaalfulaij added a comment.


  Great! Now I know why the port to PC3 didn't start :D
  Now to the patch. First, by this we will allow the user to get text under the icon, which will be impossible to read.
  Second is what I'm here for :)
  The clear button placement and icon should not follow the locale, but the actual text imh. You can write Arabic in an English system, and vice versa.
  
  I've made this simple file to explain my point:
  
    import QtQuick 2.7
    import QtQuick.Controls 2.3
    import QtQuick.Layouts 1.3
    
    import org.kde.plasma.core 2.0 as PlasmaCore
    
    Item {
        width: 300
        height: 200
    
        LayoutMirroring.enabled: true // This value (true or false) shouldn’t affect anything regarding the Clear button!
        LayoutMirroring.childrenInherit: true
    
        Frame {
            anchors.centerIn: parent
            width: 200
            RowLayout {
                LayoutMirroring.enabled: false
                anchors.fill: parent
                layoutDirection: textInput.isRightToLeft(0, textInput.length) ? Qt.RightToLeft : Qt.LeftToRight
                TextField {
                    id: textInput
                    Layout.fillWidth: true
                }
                AbstractButton {
                    contentItem: PlasmaCore.IconItem {
                        source: textInput.isRightToLeft(0, textInput.length) ? "edit-clear-locationbar-ltr" : "edit-clear-locationbar-rtl"
                    }
                }
            }
        }
    }
  
  Whatever the locale is, or the mirroring is, things inside the `Frame` shouldn't change (well, this won't work fully as the context menu might not get rendered correctly, but I didn't want to write 4 `if` statments in the `rightMargin` and `leftMargin` properties, as you can't set it to be absolute. With mirroring, right is treated as left, and vice versa)
  
  Results:
  F6148886: Screenshot_٢٠١٨٠٧٢٦_٢٣٥٤١٤.png <https://phabricator.kde.org/F6148886>
  
  F6148887: Screenshot_٢٠١٨٠٧٢٦_٢٣٥٤٢٢.png <https://phabricator.kde.org/F6148887>

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D14345

To: ngraham, #plasma, mart, davidedmundson
Cc: safaalfulaij, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180726/d6bc9456/attachment.html>


More information about the Kde-frameworks-devel mailing list