Results 1 to 4 of 4

Thread: can't show my QDialog

  1. #1
    Join Date
    Apr 2007
    Posts
    117
    Thanks
    84
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default can't show my QDialog

    Hello!

    I created a custom dialog and here's how I use it.
    Qt Code:
    1. IADFUQParameterDialog dialog = new IADFUQParameterDialog(this);
    To copy to clipboard, switch view to plain text mode 
    but on compile has the error
    mainwindow.cpp:2222: error: initializing temporary from result of 'IADFUQParameterDialog::IADFUQParameterDialog(QWid get*)'

    so I try to use this instead
    Qt Code:
    1. IADFUQParameterDialog dialog(this); dialog.show();
    To copy to clipboard, switch view to plain text mode 
    and there's no error. But the dialog shows only when I call a message box
    Last edited by sincnarf; 22nd October 2007 at 00:16.
    Image Analysis Development Framework Using Qt (IADFUQ)

  2. #2
    Join Date
    Apr 2007
    Posts
    117
    Thanks
    84
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: can't show my QDialog

    sorry, tried to use dialog.exec() and it showed... Now How do get the values from my Dialog to be used by the widget that called dialog.exec()?
    Image Analysis Development Framework Using Qt (IADFUQ)

  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: can't show my QDialog

    You need to provide getter methods in the dialog class to do that. Or you can make the ui for the dialog public, but this is really not advised.

  4. The following user says thank you to wysota for this useful post:

    sincnarf (22nd October 2007)

  5. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: can't show my QDialog

    but on compile has the error
    mainwindow.cpp:2222: error: initializing temporary from result of 'IADFUQParameterDialog::IADFUQParameterDialog(QWid get*)'
    When allocating on the heap (using new) you have to use pointer:
    Qt Code:
    1. IADFUQParameterDialog *dialog = new IADFUQParameterDialog(this);
    To copy to clipboard, switch view to plain text mode 
    And if you need to access this pointer in other places as well, you will want to make it a member variable.
    sorry, tried to use dialog.exec() and it showed...
    Well, the difference between show() and exec() is the modality mode.
    But both should work.
    Have a look at the faqs for "I have created a widget/dialog and it is not visible when I call show(). Why?"
    Last edited by high_flyer; 22nd October 2007 at 09:38.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. QDialog / QListView problem
    By harakiri in forum Qt Programming
    Replies: 1
    Last Post: 10th July 2007, 18:31
  2. Resizing a QDialog to the content size
    By Nyphel in forum Qt Programming
    Replies: 8
    Last Post: 15th March 2007, 08:16
  3. QDialog: show() and exec() together in constructor?
    By Teuniz in forum Qt Programming
    Replies: 8
    Last Post: 28th February 2007, 11:43
  4. Qdialog as a child widget
    By dave in forum Newbie
    Replies: 12
    Last Post: 14th November 2006, 09:43
  5. QtSingleApplication
    By mule in forum Qt Programming
    Replies: 8
    Last Post: 28th February 2006, 19:21

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.