Unsolved Parameters in creating window
-
Hello. How i can transmit parameters in creating window
class dialog:public QDialog { Q_OBJECT private: QLabel *label; QLabel *label1; QLabel *label2; QPushButton *ok_1; QPushButton *close_1; QLineEdit *LineEdit_1; QFrame *line_1; public: dialog(QWidget *parent=0, char answer); //like here new char parameter private slots: void ok_clicked(char asnwer); void ok_enabled(QString); }
-
@Eugene404 said in Parameters in creating window:
dialog(QWidget *parent=0, char answer); //like here new char parameter
default parameters can only be at the end of the parameter list. So switch position of your 2 parameters.
-
like this?
class dialog:public QDialog { Q_OBJECT private: QLabel *label; QLabel *label1; QLabel *label2; QPushButton *ok_1; QPushButton *close_1; QLineEdit *LineEdit_1; QFrame *line_1; public: dialog(char answer,QWidget *parent=0); private slots: void ok_clicked(char asnwer); void ok_enabled(QString); };
dialog::dialog(char answer,QWidget):public QDialog //constructor
like this i have two errors
- prototype for 'dialog::dialog(char, QWidget)' does not match any in class 'dialog'
dialog::dialog(char answer,QWidget):public QDialog
^
2)candidates are: dialog::dialog(dialog&&)
class dialog:public QDialog
^
- prototype for 'dialog::dialog(char, QWidget)' does not match any in class 'dialog'
-
@Eugene404
spot the difference ;)dialog(char answer,QWidget *parent=0)
dialog::dialog(char answer,QWidget)
-
dialog(char answer,QWidget *parent=0) dialog::dialog(char answer,QWidget *parent=0)
like this ?
-
@Eugene404
almost :)
in the definition default parameters are not allowed. But yes, the missing pointer was what i meant.