Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个带有提交按钮的应用程序,但我想检查文本字段是否已填写,如果没有不提交。
不太确定代码应该如何运行。
我的代码目前看起来像
if(flightNumber == NULL) { flightNumbertext.text.color = 'red'; }
我正在为用 QML 编写的 Qt Quick 应用程序设计它。
QT 的编辑小部件使用QString。
QString 有许多可以使用的方法。
使用QString 的isEmpty或isNull方法。
我希望这有帮助。
玩了一会儿,我想这对你有用
if (flightNumber.text.trim().length == 0) { flightNumbertext.text.color = 'red'; }
函数 trim() 类似于 QString::trimmed()。它从string.
string