[Qt-interest] is it proper form to design 1 mainwindow, then using a "Next" button navigate to another Mainwindow?

S. Aguinaga sa_jr at yahoo.com
Sun Jul 19 17:00:02 CEST 2009


Dear Fellows,

I have two MainWindow apps, I want to add a "Next Module" button to 1st window and make the 2nd mainwindow the active and close  the 1st window.  Is this proper form or proper design methodology?

Can I add to the callback code for the "Next Module" slot that closes the 'parent' window --without closing the application, and then setParent the new QMainWindow?   Do any of you have any links to where I might help me find how to do this or if this should be done in a different way?  It will be greatly appreciated.

Essentially this is what I want to do:

In main.cpp:
...
QApplication app(argc, argv);
...

const QString passingAstring = query.value(1).toString();
FirstMainWindow first_window( passingAstring );

first_window.show();

  return app.exec();

In firstmainwindow.cpp
...

FirstMainWindow::FirstMainWindow( const QString somestring)

  {
// define a pusbutton

// define a connect with a slot "NextModuleSlot"

}

void FirstMainWindow::NextModuleSlot()  // the slot for the pushbutton

{

// when the button is pressed, I want to quit the FirstMainWindow

// Then call the new 2ndMainWindow:

SecondMainWindow second_main_window;

second_main_window.show();

// Does this automatically become the parent?

}


// Salvador Aguinaga
// Northwestern University



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090719/7d057bfe/attachment.html 


More information about the Qt-interest-old mailing list