我正在Qt5.7.0 QtCreator 4.1中编写移动应用程序,我在QtQuick qml文件'无效的属性名称“样式”(M16)'中收到错误,并且表单不想显示某些内容。我做错了什么?
我必须先在项目中配置某些内容或使用其他类型的文件吗?
我尝试在某些组件上使用此属性,它只适用于Text对象,我不知道为什么。
这是我的代码:
//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
}
}
}
答案 0 :(得分:3)
来自控件2的Button
doesn't have一个style
属性。来自控件1的Button
是 int tty_fd = open(argv[1], O_RDWR | O_NONBLOCK);
struct termios tio;
bzero(&tio, sizeof(tio));
// Frame bus runs at 38,400 BAUD
const int BAUD_Rate = B38400;
cfsetispeed(&tio, BAUD_Rate);
cfsetospeed(&tio, BAUD_Rate);
// Initialize to raw mode. PARMRK and PARENB will be over-ridden before calling tcsetattr()
cfmakeraw(&tio);
// Ignore modem lines and enable receiver and set bit per byte
tio.c_cflag |= CLOCAL | CREAD | CS8;
// NOTE: The following block overrides PARMRK and PARENB bits cleared by cfmakeraw.
tio.c_cflag |= PARENB; // Enable even parity generation
tio.c_iflag |= INPCK; // Enable parity checking
tio.c_iflag |= PARMRK; // Enable in-band marking
tio.c_iflag &= ~IGNPAR; // Make sure input parity errors are not ignored
if (is_odd)
tio.c_cflag |= PARODD;
tcsetattr(tty_fd, TCSANOW, &tio);
。
至于样式控制2个元素,the one。