This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Writing my own sddm theme

Tags: None
(comma "," separated)
interele
Registered Member
Posts
131
Karma
0
OS

Writing my own sddm theme

Fri Dec 11, 2015 8:38 am
I have been writing a sddm theme and it all works fine except I
can't get the focus to go to the user_entry box to start.

I have

import QTQuick 2.0
import SddmComponents 2.0
Rectangle {
etc
etc
etc
Component.onCompleted: {
user_entry.focus = true
}
}

Can anyone tell me what I've done wrong

Ta

Mal
User avatar
susejunky
Registered Member
Posts
3
Karma
0
OS

Re: Writing my own sddm theme

Sat Jan 02, 2016 11:25 pm
interele wrote:... except I can't get the focus to go to the user_entry box to start.
I have

import QTQuick 2.0
import SddmComponents 2.0
Rectangle {
etc
etc
etc
Component.onCompleted: {
user_entry.focus = true
}
}


I had the same problem with my theme. After some searching i found this: https://bugs.kde.org/show_bug.cgi?id=337079

So i changed the code which sets the user_entry field in my Main.qml like this:

Code: Select all
TextBox {
                  id: user_entry
                  width: 300
                  height: 40
                   anchors.verticalCenter: parent.verticalCenter;
                   text: ""
                   font.pixelSize: 14

                    Timer {
                           interval: 200
                           running: true
                           onTriggered: user_entry.forceActiveFocus()
                     }
           }

And it works fine for me ! :)

Best regards

susejunky
interele
Registered Member
Posts
131
Karma
0
OS

Re: Writing my own sddm theme

Mon Jan 04, 2016 2:27 pm
Magic , I'll give it a go in a day or so

Thanks

Mal
interele
Registered Member
Posts
131
Karma
0
OS

Re: Writing my own sddm theme

Mon Jan 18, 2016 2:47 pm
Hmmm...
Finally got around to trying this and I just get a white screen
:-(

Mal
User avatar
susejunky
Registered Member
Posts
3
Karma
0
OS

Re: Writing my own sddm theme  Topic is solved

Tue Jan 19, 2016 2:32 pm
interele wrote:Hmmm...
Finally got around to trying this and I just get a white screen
:-(

Mal

Sorry, i am no expert with all this and created my theme just by looking at the themes provided with sddm and reading some of the QT5 docu. So my capabilities to support you are rather limited.

Do you get any errors messages, when you test your theme in a console ?
Code: Select all
sddm-greeter --test-mode --theme /usr/share/sddm/themes/PATH-TO-YOUR-THEME/

Probably you are missing some "includes". Here are the ones i have in my "Main.qml:
Code: Select all
import QtQuick 2.2
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.1
import QtQml 2.0

import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.workspace.components 2.0 as PW

import SddmComponents 2.0

import "./components"
I guess that most of them are not really necessary, but they seem to do no harm either.
Finally here the exact peace of code i have in my "Main.qml" to define the user entry field
Code: Select all
            PlasmaComponents.TextField {
                id: user_entry
                width: parent.width
                height: parent.height * 0.3
                anchors.top: parent.top
                anchors.left: parent.left
                placeholderText: i18nd("plasma_lookandfeel_org.kde.lookandfeel","User")
                text: ""
                font.pixelSize: inputBox.height / 4 * 0.6
                font.weight: Font.Bold
                // This is supposed to help placing the focus in this field
                Timer {
                    interval: 200
                    running: true
                    onTriggered: user_entry.forceActiveFocus()
                }
                KeyNavigation.backtab: reboot_button; KeyNavigation.tab: pw_entry
            }

Best regards

susejunky
interele
Registered Member
Posts
131
Karma
0
OS

Re: Writing my own sddm theme

Tue Jan 19, 2016 2:52 pm
And there is joy ;-)

Thanks

M


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot]