[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);
    
    setLayout(mainLayout);
    SetWindowTitle(tr("Simple Address Book"));
    

    }

    #ifndef ADDRESSBOOK_H
    #define ADDRESSBOOK_H

    #include <QtGui>

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

    class AddressBook : public QWidget
    {
    Q_OBJECT

    public:
    AddressBook(QWidget *parent = 0);

    private:
    QLineEdit *nameLine;
    QTextEdit *addressLine;
    };

    #endif // ADDRESSBOOK_H

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

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

     AddressBook addressBook;
     addressBook.show();
    
     return app.exec&#40;&#41;;
    

    }
    @

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

    best regards
    torben


  • Moderators

    Welcome to devnet

    You probably have seen the documentation of "setWindowTitle":http://developer.qt.nokia.com/doc/qt-4.8/qwidget.html#windowTitle-prop

    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
    torben



  • Please mark your thread as SOLVED.


  • Moderators

    marked as solved


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.