Results 1 to 5 of 5

Thread: How to pass values in 1 form to another

  1. #1
    Join Date
    May 2008
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows

    Default How to pass values in 1 form to another

    Hi all..

    I am developing an application which require passing of values from one form (dialog) to another form (Dialog)..
    i had tried many ways but could not attain in getting so...

    Actually what i need is....
    I have taken an qwt plot widget in the if i right click on plot i get a context menu...
    when i choose Change Scale option i get another small dialog asking for entering a value in the line edit..
    now what i need is when i enter a particular value in the small dialog it should come back to the main dialog and change the x-axis scale ...
    i Have tried enough methods... but failed..
    well i am not even getting a particular value to the main dialog...

    so any one please help me how to do this...

    Thanks in advance....
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to pass values in 1 form to another

    http://www.qtcentre.org/forum/f-qt-p...orm-13889.html

    you need to do it the other way around.

  3. #3
    Join Date
    May 2008
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to pass values in 1 form to another

    Hi marcel,

    I implemented in this way....
    but in return i did'nt get any positive result....
    still having the same problem...

    can u help me out with this problem...

    thanks in advance...


    Qt Code:
    1. int str43;
    2. if (lineEdit1->text()==NULL)
    3. {
    4. QMessageBox::critical(this,"","Please Input Value in the text Box Provided..");
    5. }
    6. else
    7. {
    8. QMessageBox::information(this,"","Value Changed Successfully...");
    9. str63= lineEdit1->text().toInt();
    10. ((ctxtmenu*)parent())->str43 = str63;
    11. this->close();
    12.  
    13. }
    14. ctxtmenu dialog1(this);
    15. lineEdit1->text()= dialog1.lineEdit23->text().toInt();
    To copy to clipboard, switch view to plain text mode 


    Here str43 is the public int variable which is present in the "ctextmenu.h" file...
    and at the same time str63 is also an int variable which is present in the local loop which i mentioned above...
    Last edited by jpn; 4th June 2008 at 14:12. Reason: fixed code tags (it's [/code] not [\code] :)

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to pass values in 1 form to another

    Qt Code:
    1. void ctxtmenu::ChangeScale()
    2. {
    3. ScaleChange dialog(this);
    4. dialog.show();
    5. dialog.exec();
    6. //apply new scale here (str43).
    7. }
    To copy to clipboard, switch view to plain text mode 
    although you'd be better off with one of the other methods I mentioned in the other thread.
    You could also create a signal in the dialog which gets emmitted when you press ok, and connect it to a slot in the main form (pass the new scale value as a signal parameter).

  5. #5
    Join Date
    May 2008
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to pass values in 1 form to another

    Hi, Marcel ,

    Thanks for responding me...
    well i didnt get u can u provide one example so that i can get a clear picture..

    please....

    Thanks in advance...

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.