Hi, It's my first time trying Qt and followed the tutorials on widgets first, then the address book tutorial. My problem is with arranging widgets in a QGridLayout, I use proper row/column numbers but when I run the program, all of them are palced at top left.

/Here's the code\
adressbook.hpp:
Qt Code:
  1. #include <QWidget>
  2. #include <QLineEdit>
  3. #include <QTextEdit>
  4.  
  5. class address_book: public QWidget {
  6. Q_OBJECT
  7. QLineEdit name;
  8. QTextEdit address;
  9.  
  10. public:
  11. address_book(QWidget *parent=0);
  12. };
To copy to clipboard, switch view to plain text mode 

addressbook.cpp:
Qt Code:
  1. #include "addressbook.hpp"
  2. #include <QLabel>
  3. #include <QGridLayout>
  4.  
  5. address_book::address_book(QWidget *parent): QWidget(parent), name(), address() {
  6. QLabel lname(tr("Name:"));
  7. QLabel laddress(tr("Address:"));
  8.  
  9. QGridLayout layout(this);
  10. layout.setSpacing(10);
  11.  
  12. layout.addWidget(&lname, 0, 0);
  13. layout.addWidget(&name, 0, 1);
  14.  
  15. layout.addWidget(&laddress, 1, 0);
  16. layout.addWidget(&address, 1, 1);
  17.  
  18. setWindowTitle(tr("Address Book"));
  19. }
To copy to clipboard, switch view to plain text mode 
Here's the screenshot:
app.jpg

What might be causing this behaviour?