Important: Please read the Qt Code of Conduct -

[Solved] setWindowTitle was not declared in this scope

  • Hi,
    I have a problem with the tutorial addressbook. I have spent quite some time trying to figure out what is wrong and I have searched the forum - without succes:

    #include "addressbook.h"

    #include <QtGui>

    AddressBook::AddressBook(QWidget *parent) : QWidget(parent)
    QLabel *nameLabel = new QLabel(tr("Name:"));
    nameLine = new QLineEdit;
    QLabel *addressLabel = new QLabel(tr("Address:"));
    addressLine = new QTextEdit;

    QGridLayout *mainLayout = new QGridLayout;
    mainLayout ->addWidget(nameLabel, 0, 0);
    mainLayout ->addWidget(nameLine, 0, 1);
    mainLayout ->addWidget(addressLabel, 1, 0, Qt::AlignTop);
    mainLayout ->addWidget(addressLine, 1, 1);
    SetWindowTitle(tr("Simple Address Book"));


    #ifndef ADDRESSBOOK_H
    #define ADDRESSBOOK_H

    #include <QtGui>

    //class QLineEdit;
    //class QTextEdit;
    //class QLabel;

    class AddressBook : public QWidget

    AddressBook(QWidget *parent = 0);

    QLineEdit *nameLine;
    QTextEdit *addressLine;

    #endif // ADDRESSBOOK_H

    #include "addressbook.h"
    #include <QtGui>

    int main(int argc, char *argv[])
    QApplication app(argc, argv);

     AddressBook addressBook;;
     return app.exec&#40;&#41;;


    I have checked with your coding and find no errors.
    Can anyone help?

    best regards

  • Welcome to devnet

    You probably have seen the documentation of "setWindowTitle":

    It starts with a lower case letter. In your code listing above you start it with an upper case letter.

  • Hi koahnig,
    Man, that I coul'nt see that! Thanks a lot.
    best regards

  • Please mark your thread as SOLVED.

  • marked as solved

Log in to reply