Results 1 to 5 of 5

Thread: How to create QDialog with QT Creator and connect it to the source?

  1. #1
    Join Date
    Mar 2009
    Posts
    104
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default How to create QDialog with QT Creator and connect it to the source?

    There are several examples of QDialog and how to create it.
    The missing one is how can i create QDialog using QT Creator ( .ui file) and then connect it to the source.I'm trying to create simple About dialog.
    I know QMessage is the simple way.I just want to understand creating application with multiple dialogs how can i connect the .ui file with the source in order to make them all work.

    Thanks is advance

  2. #2
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to create QDialog with QT Creator and connect it to the source?



    In the 'File menu' :
    New file or project
    Files and classes : Qt
    Qt Designer Form class

    It doesn't get any simpler than that...

    For creating an application with multiple dialogs : there have been maybe 20 threads on how to do this in this forum, and it is even mentioned in the FAQ.

    Regards,
    Marc

  3. #3
    Join Date
    Mar 2009
    Posts
    104
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to create QDialog with QT Creator and connect it to the source?

    obviously i was misunderstood!

    I know how to create an .ui file.
    The problem is how to make it work.
    For example, lets have one button and when user click on it to open about dialog.
    OK, but the dialog to be created with QTDesigner.
    The problem is how to make this connection
    i'm attaching the project file.
    Attached Files Attached Files

  4. #4
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to create QDialog with QT Creator and connect it to the source?

    You are using uninitialized pointer in there, your slot should look like this:
    Qt Code:
    1. void Imoti::on_pushButton_clicked()
    2. {
    3. about *one = new about(this); //use a pointer and then create the object and allocate memory with new
    4. one->show(); //non-modal
    5. }
    To copy to clipboard, switch view to plain text mode 
    or, in case you want modal:
    Qt Code:
    1. void Imoti::on_pushButton_clicked()
    2. {
    3. about one(this); //create a object directly
    4. one.exec(); //modal dialog
    5. }
    To copy to clipboard, switch view to plain text mode 

    LE: added 'this' as a parent for modal dialog too...

  5. #5
    Join Date
    Mar 2009
    Posts
    104
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to create QDialog with QT Creator and connect it to the source?

    thanks a lot!!!

Similar Threads

  1. Qt Creator How to make Creator be aware of the Qt source code project?
    By kartwall in forum Qt Tools
    Replies: 5
    Last Post: 27th September 2010, 09:39
  2. Replies: 18
    Last Post: 18th July 2010, 17:21
  3. Have Creator open source files with project
    By Asperamanca in forum Qt Tools
    Replies: 2
    Last Post: 23rd October 2009, 09:25
  4. Replies: 6
    Last Post: 28th July 2009, 15:31
  5. connect problem QDialog
    By Zergi in forum Newbie
    Replies: 1
    Last Post: 1st January 2008, 14:36

Tags for this Thread

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.