Results 1 to 4 of 4

Thread: Dialog Update before shown

  1. #1
    Join Date
    Feb 2010
    Posts
    20
    Qt products
    Qt4
    Platforms
    Windows

    Default Dialog Update before shown

    hello all

    i've made a dialog, wich holds some qlabels and a porgress bar. When the user presses the ok button, the progress bar starts, the buttons get disabled and when the progress is finished the dialog is hidden.

    When the dialog reopens, it must be cleared... meaning, active buttons, progress bar back to value of 0. This clearing is done right begore the dialog is re-shown.

    The problem is, tha although the code is like this...
    Qt Code:
    1. m_probar->setValue(0);
    2. m_importButton->setEnabled(true);
    3. m_cancelButton->setEnabled(true);
    4. exec();
    To copy to clipboard, switch view to plain text mode 

    i see the opossite behavior. I see a rapid change on dialog graphics, just wheni re-open it. This means that the dialog is shown before the values are set.

    Any advice?

    thanks in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Dialog Update before shown

    where is your sample code inside your application? Maybe you can call update() before executing. But normally a code like that works for me:
    Qt Code:
    1. void Foo::showDlg()
    2. {
    3. if(!m_dlg)
    4. m_dlg = new SubclassedDlg(this);
    5. m_dlg->setAllValuesToTheirDefault();
    6. m_dlg->exec();
    7. }
    To copy to clipboard, switch view to plain text mode 
    without "flashing".

  3. #3
    Join Date
    Feb 2010
    Posts
    20
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Dialog Update before shown

    i'm doing exactly what you do in your example code...

    No matter where i call exec() the result is the same. Flashing. It seems that the dialog draws it self just like it was when it was hidden... and then refreshes... weird :/

    Qt Code:
    1. void Dlg::initImport(QString &path)
    2. {
    3. m_filepath = path;
    4. setDefaults();
    5. update();
    6. exec();
    7. }
    8.  
    9. void Dlg::setDefaults()
    10. {
    11. m_probar->setValue(0);
    12. m_importButton->setEnabled(true);
    13. m_cancelButton->setEnabled(true);
    14. }
    15.  
    16. void Dlg::accept()
    17. {
    18. m_importButton->setEnabled(false);
    19. m_cancelButton->setEnabled(false);
    20.  
    21. m_probar->setValue(100);
    22. hide();
    23. }
    24.  
    25. void Dlg::reject()
    26. {
    27. clearData();
    28. hide();
    29. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Dialog Update before shown

    Try to call QDialog::accept() and QDialog::reject() instead of only hiding. May be that sloves the problem. If not I am out of ideas at that point.

Similar Threads

  1. How to set which axis are shown?
    By Jeo_ in forum Qwt
    Replies: 1
    Last Post: 28th April 2009, 14:05
  2. empty dialog shown
    By marvin in forum Qt Programming
    Replies: 2
    Last Post: 17th November 2008, 07:43
  3. Update to 4.4.2 - Now I Have A Transparent Dialog
    By mclark in forum Qt Programming
    Replies: 10
    Last Post: 6th October 2008, 20:11
  4. Allow Many QWidgets to be Shown into One QWidget ?
    By Fatla in forum Qt Programming
    Replies: 26
    Last Post: 6th July 2008, 09:29
  5. Progress Bar to be shown!!!
    By Kapil in forum Qt Programming
    Replies: 7
    Last Post: 23rd May 2006, 09:36

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.