私が取り組んでいる新しいqt 5.7アプリケーションにいくつかのスタイルを適用しようとしていますが、以下は全く動作しません。 qrc:/SignInView.qml:67存在しないプロパティ "style"に割り当てることができません 同じ理由でデザインモードで編集できません。QMLのTextFieldにスタイルを適用するにはどうすればよいですか?それは "スタイル"属性が利用できないようです
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.4
Page {
id: page1
ColumnLayout {
id: columnLayout1
height: 100
anchors.right: parent.right
anchors.left: parent.left
anchors.top: parent.top
Label {
text: qsTr("Label")
font.pointSize: 16
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
}
Image {
id: image1
width: 200
height: 200
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
fillMode: Image.PreserveAspectCrop
anchors.horizontalCenter: parent
source: "qrc:/qtquickplugin/images/template_image.png"
Button {
id: button1
text: qsTr("Button")
anchors.bottomMargin: 10
anchors.rightMargin: 10
anchors.bottom: parent.bottom
anchors.right: parent.right
}
}
Rectangle {
id: field1
width: 200
height: 40
color: "#ffffff"
Layout.fillWidth: true
Label {
id: label1
text: qsTr("Full Name")
anchors.topMargin: 0
anchors.left: parent.left
anchors.leftMargin: 5
anchors.top: parent.top
}
TextField {
style: TextFieldStyle {
textColor: "black"
background: Rectangle {
radius: 2
implicitWidth: 100
implicitHeight: 24
border.color: "#333"
border.width: 1
}
}
}
}
}
}
私はこの例に従うことをしようとされています
http://doc.qt.io/qt-5/qml-qtquick-controls-styles-textfieldstyle.html
それはスタイルが存在しないエラーを与えるのQt Creatorを内のstyle属性で失敗します。 私のライブラリがロードされていないか、あるいは私がセットアップしている環境かもしれないと思います。 私はボタンや他の場所にスタイルを持っていません。私はそれが働くだろうが、それがないのインポートを持っていたと思った。
SOに関する関連問題はこちらです:QML - How to change TextField font size しかし、ここではうまくいくようです。 Qtのクイックにおいて