That error message does not match the code lines you posted (it implies you used strings of 5 and 8 characters).

The error arises because you have put the attempt to initialize "settings" inside the constructor (where it is already default constructed) rather than in the constructor initialization list (where you have the opportunity to dictate how to construct it).

Qt Code:
  1. class MainWindow: public QMainWindow {
  2. Q_OBJECT
  3. public:
  4. MainWindow(QWidget *p = 0): QMainWindow(p),
  5. settings("Contemposoft", "SimpleTextEdit")
  6. {
  7. // up there ^^^^ , not in here
  8. }
  9. ...
  10. private:
  11. QSettings settings;
  12. };
To copy to clipboard, switch view to plain text mode