Results 1 to 9 of 9

Thread: can't get a simple dialog working

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    52
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 1 Time in 1 Post

    Cool Re: can't get a simple dialog working

    If I read your code in the main function correctly, then you're including the wrong header. You include the header that was generated by the uic compiler for your dialog resource.
    However as correctly done, you created a dialog class that inherits from the uic generated class. Your class correctly inherits QDialog, and with that comes the show() method. However now it seems that you're not using your own class in the main method. Try doing this instead:

    Qt Code:
    1. #include "handmade.h" // <-- Use your own dialog class
    2. #include <QApplication>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication app(argc, argv);
    7. // Create an instance of your own dialog
    8. handmade *dialog = new handmade;
    9.  
    10. dialog->show();
    11. return app.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 

    Then your dialog should work as expected.

    Ups, I think it was answered just before...
    Last edited by Mike; 13th January 2006 at 09:35.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    52
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: can't get a simple dialog working

    Another thing I noticed. In the constructor of your own "handmade" dialog class you invoke show(). I don't think you are suppose to do that. Normally you want to setup the dialog, set some additional stuff, maybe invoke an init method, and only then, in the calling method,
    Qt Code:
    1. handmade->show()
    To copy to clipboard, switch view to plain text mode 
    or for a modal dialog
    Qt Code:
    1. handmade->exec()
    To copy to clipboard, switch view to plain text mode 
    should be invoked. Does this make sense to you?

Similar Threads

  1. Issue with Modelless dialog on Mac
    By Satyanarayana Chebrolu in forum Qt Programming
    Replies: 0
    Last Post: 24th February 2009, 11:10
  2. Dialog is not closing
    By manmohan in forum Newbie
    Replies: 5
    Last Post: 1st December 2008, 18:04
  3. Replies: 9
    Last Post: 13th August 2008, 19:07
  4. Resizing the dialog boxes
    By anju123 in forum Qt Programming
    Replies: 4
    Last Post: 14th September 2007, 11:41
  5. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 15:52

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
  •  
Qt is a trademark of The Qt Company.