天天看點

Qt報錯:reference to non-static member function must be called; did you mean to call it with no argumen

Qt開發,一行代碼報錯:

reference to non-static member function must be called; did you mean to call it with no arguments?

代碼:

if (tbxD.toPlainText().trimmed().length == 0) { ... }
if (tbxM.toPlainText().trimmed().length == 0) { ... } 
if (tbxS.toPlainText().trimmed().length == 0) { ... }      

這幾行代碼看上去沒什麼特别的,就是取了EditText輸入框控件的文字而已,為什麼會提示什麼 non-static呢?

if (tbxD.toPlainText().trimmed().length() == 0) { ... }
if (tbxM.toPlainText().trimmed().length() == 0) { ... } 
if (tbxS.toPlainText().trimmed().length() == 0) { ... }