Home > other >  Ask questions about QDialogButtonBox and QPushButton
Ask questions about QDialogButtonBox and QPushButton

Time:05-26

Consult qt4 GUI book example, gotocell engineering, using QtCreator tools to create interface gotocelldialog. UI, name is buttonBox QDialogButtonBox create button box, in the dialog box in the constructor, use buttonBox - & gt; The button (QDialogButtonBox: : Ok) - & gt; SetEnabled (false); Disable the OK button, compile error message said QPushButton forward declaration is not complete, and "- & gt; SetEnabled (false) "this part use CTRL + space can't automatic completion, if use QPushButton ok and cancel button to create the compiler normally, comrades, please help to answer,

CodePudding user response:

Post your code and the build error message to here

CodePudding user response:

After many trials found using QDialogButtonBox must contain QtGui header file to compile successfully running, but I don't know why?

CodePudding user response:

Dizzy, direct the include the name of the class, such as # include & lt; QDialogButtonBox>

CodePudding user response:

To # include & lt; QtGui/QDialogButtonBox> , that contain is not directly, thank you

CodePudding user response:

Need a # include in Qt6.0 & lt; QtWidgets> Because the setEnabled () method in QAbstractButton and QAbstractButton in & lt; QtWidgets> Not & lt; QtGui> In the
  • Related