Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] setWindowTitle was not declared in this scope
Forum Updated to NodeBB v4.3 + New Features

[Solved] setWindowTitle was not declared in this scope

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 5.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    deuxtf
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      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.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • D Offline
        D Offline
        deuxtf
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Anticross
          wrote on last edited by
          #4

          Please mark your thread as SOLVED.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            marked as solved

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved