Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Using (empty) TextFieldStyle alters size of the TextField

$
0
0
Hi, if searched quit ab bit for this but haven’t found anything about it, so here is my problem I’m working on a Login-Screen and encountered a strange behavior when using TextFieldStyle. As soon as I use TextFieldStyle the size of the TextField is changed. Especially annoying is the fact that the height is increased by seemingly 5 pixels and so the TextField looks just to big for the text it contains. I’m not sure if this is intended or not. And before I start setting sizes manually I’ll just ask if I’m doing something wrong here? What I was hoping to accomplish is, that the TextField “height” changes with the used font size automatically. Here is a working example of this Problem: The height of the TextFields is shown as placeholderText so you don’t need to count pixels :) import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 import QtQuick.Layouts 1.1   ApplicationWindow {   id: loginRequest   visible: true   title: "Login"   width: 250   height: 150     Item {     anchors { left: parent.left; right: parent.right; top: parent.top }     anchors.margins: 15     ColumnLayout {       id: column       spacing: 15             RowLayout {                 Text {           text: "Account name:"         }             TextField {           id: accountNameTextField           placeholderText:  accountNameTextField.height         }       } //RowLayout           RowLayout {         Text {           text: "Password:"         }                 TextField {           id: passwordTextField           placeholderText:  passwordTextField.height           //echoMode: TextInput.Password           style: TextFieldStyle{} //<== here the problem line         }       } //RowLayout     }//ColumnLayout   }//Item } // ApplicationWindow Thank you all Cheers Kieren

Viewing all articles
Browse latest Browse all 4972

Latest Images

Trending Articles



Latest Images