I'm writing a mobile application in Qt5.7.0 QtCreator 4.1 and i'm getting the error in QtQuick qml file 'Invalid property name "style"(M16)' and form does not want to display something. What i'm doing wrong?
Must i configure something in the project before or use another type of file?
I tried to use this property on some components and it works only with Text object and i don't know why.
Here's my code:
//register_form.qml
import QtQuick 2.0
import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.1
Item {
width: 270
height: 480
anchors.fill: parent
ColumnLayout {
id: loginLayout
anchors.rightMargin: 15
anchors.bottomMargin: 92
anchors.leftMargin: 23
anchors.topMargin: 91
anchors.fill: parent
TextField {
TextFieldStyle {
id: phoneStyle
placeholderTextColor: "grey"
}
id: phoneField
placeholderText: "+7 XXX XXX XX XX"
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
}
Button {
style: //error occurs here
ButtonStyle {
}
id: loginButton
text: "Next"
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
highlighted: true
}
}
}
The Button
from Controls 2 doesn't have a style
property. The Button
that has it was the one from Controls 1.
As for styling Controls 2 elements, take a look here.