Results 1 to 7 of 7

Thread: problem in Qt4 dialog

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: problem in Qt4 dialog

    ok, the problem is in Disp:: openDatumForm in this line
    Qt Code:
    1. ...
    2. if(datumform.exec() == QDialog::Accepted)
    3. ...
    To copy to clipboard, switch view to plain text mode 
    when you close this dialog by Alt+F4 then the result of exec will be QDialog::Rejected and you pass this block
    Qt Code:
    1. {
    2. DatumVal = Datumno_Val;
    3. XVal = Xdatum_Val;
    4. YVal = Ydatum_Val;
    5. ZVal = Zdatum_Val;
    6. datuminitial();
    7. }
    To copy to clipboard, switch view to plain text mode 
    there is two ways:
    add a "OK" button in that dialog and connect signal QPushButton::clicked with QDialog::accept and leave this code unchanged
    Qt Code:
    1. void Disp::openDatumForm()
    2. {
    3. DatumForm datumform(this);
    4. datumform.move(35, 90);
    5. if(datumform.exec() == QDialog::Accepted) {
    6. DatumVal = Datumno_Val;
    7. XVal = Xdatum_Val;
    8. YVal = Ydatum_Val;
    9. ZVal = Zdatum_Val;
    10. datuminitial();
    11. }
    12. }
    To copy to clipboard, switch view to plain text mode 
    the second ways is: to use code like this
    Qt Code:
    1. void Disp::openDatumForm()
    2. {
    3. DatumForm datumform(this);
    4. datumform.move(35, 90);
    5. datumform.exec();
    6. DatumVal = Datumno_Val;
    7. XVal = Xdatum_Val;
    8. YVal = Ydatum_Val;
    9. ZVal = Zdatum_Val;
    10. datuminitial();
    11. }
    To copy to clipboard, switch view to plain text mode 
    in this case there is no need to add extra button in the dialog, but you also lose checking of the dialog acception or rejection.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  2. #2
    Join Date
    Jul 2009
    Location
    Bangalore
    Posts
    68
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: problem in Qt4 dialog

    I tried with both the ways but i am not able to display the values in the Disp form same problem. During the start of the applications the lineEdits sholud display 0.000 and that is not happening here is start up code snippet..

    Qt Code:
    1. Disp::Disp (QDialog *parent)
    2. :QDialog(parent)
    3. {
    4.  
    5. setupUi(this);
    6.  
    7. qDebug( "Init Function ( During StartUp)" );
    8.  
    9. xlineEdit->setText("0.000");
    10.  
    11. ylineEdit->setText("0.000");
    12.  
    13. zlineEdit->setText("0.000");
    14.  
    15. decimals_mm = 3;
    16. decimals_inch = 4;
    17. datuminitial();
    18. }
    To copy to clipboard, switch view to plain text mode 

    Please see my code attached and help us.
    Last edited by wysota; 27th August 2009 at 10:01. Reason: missing [code] tags
    Thanks & Regards
    Sandeep G.R.

  3. #3
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: problem in Qt4 dialog

    I don't understand what you need...
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  4. #4
    Join Date
    Jul 2009
    Location
    Bangalore
    Posts
    68
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: problem in Qt4 dialog

    When i run my application all the lineEdits in Disp Form should display 0.000 this is done by
    Qt Code:
    1. xlineEdit->setText("0.000");
    2. ylineEdit->setText("0.000");
    3. zlineEdit->setText("0.000");
    To copy to clipboard, switch view to plain text mode 

    but when i run the application it is displaying bank in all the lineEdits.
    Last edited by wysota; 27th August 2009 at 10:01. Reason: missing [code] tags
    Thanks & Regards
    Sandeep G.R.

Similar Threads

  1. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  2. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 08:47
  3. Communication between MainWindow and a dialog
    By Backslash in forum Newbie
    Replies: 9
    Last Post: 3rd August 2007, 04:27
  4. Replies: 3
    Last Post: 23rd July 2006, 18:02
  5. Show/hide part of dialog with resizing.
    By Spockmeat in forum Qt Tools
    Replies: 6
    Last Post: 7th June 2006, 08:22

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.