Is there a way of declaring a default for a QStringList in a case like this?
QStringList and QString variables are always defaulted to an empty QStringList (same as assigning it to QStringList(), as Lesiok explains), and QString defaults to an empty string. So these two are exactly the same in their effect:
// and
MyinputDlg(QString title = "My Input Dialogue", QStringList lblTexts = QStringList(), QString def = "");
// and
MyinputDlg(QString title = "My Input Dialogue", QStringList lblTexts, QString def);
To copy to clipboard, switch view to plain text mode
The only time you need the first form is if the variable(s) with the default value(s) are not at the end of the list of variables:
MyinputDlg(QString title = "My Input Dialogue", QStringList lblTexts = QStringList(), QString def = "Something non-default");
To copy to clipboard, switch view to plain text mode
Bookmarks