我想撰寫我的自定義輸入對話框。我寫了以下幾行來處理單擊確定/取消:
connect(buttonBox, &QDialogButtonBox::accepted,this, &MyCustomDialog::accept);
我在編譯時遇到了這個錯誤:
/usr/include/qt4/QtGui/qdialogbuttonbox.h:147:10: error: 'void QDialogButtonBox::accepted()' is protected
void accepted();
中沒有任何公共信號QDialogButtonBox。
uj5u.com熱心網友回復:
這不是關于QDialogButtonBox。這是關于你的Qt版本。當您Qt5擁有Qt4. 用這個:
connect(buttonBox, SIGNAL(accepted()),this, SLOT(accept()));
acceptedis a Q_SIGNALSwhich is protectedin Qt4,因此您不能使用該語法。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/514827.html
標籤:C qt对话框
上一篇:Pyside6回應鍵盤輸入
下一篇:Qml選單彈出延遲
