Results 1 to 3 of 3

Thread: Multiple Windows -> Advice needed

  1. #1
    Join Date
    Jan 2007
    Posts
    1

    Default Multiple Windows -> Advice needed

    hy

    i need an advice....
    i would like to develop an application with multiple windows, and I don't know where to start from.
    I took a look at the "toplevel" example, but I understood that it doesn't really create a new window ( IT IS A HIGH PROBABILITY THAT I AM WRONG... ).
    anyway... what I would like to do, is to have a server/ client application, in witch the client must have 2 windows

    one must contain informations, and the other is the Login Window.
    the login window must be showed first, while the main window must be hidden.
    after getting the positive response from the server, the login window must close, and the main window with informations must show up.

    thank you for your time, and help..

  2. #2
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiple Windows -> Advice needed

    When the client loads the application, then you will first need to show the login window and then when the client is authenticated, you can close the login window and show the main window.

    1. Have a class called LoginDlg which will need to reimplement QDialog. This dialog will have couple of input boxes (For username, password etc) and couple of buttons (ok, cancel).

    2. connect the pressed singal of ok button to a slot in this class.

    3. When ok is pressed, this slot can then send the information to the server for authentication.

    4. Once you get a positive response, create the main window and close the login dialog.

    If you look into the file options.ui.h, it has the slot called apply(), which is called when the "apply" button is clicked. In that slot, a new widget is created, which pops up when the "apply" button is pressed. Your case is also something similar

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Multiple Windows -> Advice needed

    Something like this should be ok:
    Qt Code:
    1. int main(int argc, char **argv){
    2. QApplication(argc, argv);
    3. LoginDialog dlg;
    4. if(!dlg.exec() || !dlg.loginOk()){
    5. qDebug("Login failed");
    6. return 1;
    7. }
    8. MainWindow mw;
    9. //...
    10. return app.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Qtopia H/w Advice needed
    By void* in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 19th January 2007, 12:25
  2. QGLWidget and multiple windows
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 21st November 2006, 14:38
  3. how to corss compile for windows in Linux
    By safknw in forum Qt Programming
    Replies: 24
    Last Post: 13th May 2006, 06:23
  4. Practical QTreeView: Advice needed
    By Jojo in forum Qt Programming
    Replies: 13
    Last Post: 20th February 2006, 21:28
  5. qt windows help needed
    By dave in forum Newbie
    Replies: 19
    Last Post: 1st February 2006, 09:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.