[Qt-creator] How to make the QWidgets Window to wait for signal (buttonClick).

Arun arunblore1 at gmail.com
Thu Feb 25 22:13:48 CET 2010


Hello List,
I have created a small GUI using two ui files.
The first UI file has a button and after buttonClickHandler executed it loads the 2nd GUI as defined in an .ui file.
But, the 2nd Widget does not stay and disaapears immediately. 

void MainWindow::buttonClickHandler()
{
  QMessageBox msgBox;
  msgBox.setWindowTitle("MyWorld");
  msgBox.setText("Interface for new widgets");
  msgBox.setInformativeText("Instead of MessageBox, another widget to be shown here");

   AddressBook addrBook;
   addrBook.show();
   
}

The above program is fine.
and the 2nd Widget as :

--------------------------------
    #include "addressbook.h"
    #include <QMessageBox>
    #include "ui_AddressBook.h"

    AddressBook::AddressBook(QWidget *parent)
        : QWidget(parent), ui(new Ui::AddressBookClass)
    {
        ui->setupUi(this);
                                                  (at  this point if I add      "this.show()". It shows both widget at start of the main.
    }

    void AddressBook::infoButtonHandler()
    {
      QMessageBox msgBox;
      msgBox.setWindowTitle("MyInfo");
      msgBox.setText("Details here");
      msgBox.setInformativeText("Place Holder for My Info");

       msgBox.exec();
    }
    AddressBook::~AddressBook()
    {
        delete ui;
    }

=============================


Please reply how the 2nd window shall wait  till the button is clicked.


Thanks in advance,
arun

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20100225/b4bb39e3/attachment.html 


More information about the Qt-creator-old mailing list