Results 1 to 5 of 5

Thread: Passing of Parameters in two classes

  1. #1
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Smile Passing of Parameters in two classes

    Dear Forums,


    Hi Guys i have a doubt regarding QT related.....I just want to know how to pass parameters from one page to another.........Lemme explain in clear I have screens as A and B in A i have a field by name Mobilenumber and the next screen i have a field by name as Name,Address etc......Now what i need is when i enter the mobilenumber as 1234567890 and give click on the submit button,it should display the related information of that mobile number in the next page........I know we can use cookies,Sessions etc but will be a vast process can any one give me better solution with an example program.........Any solution would be appreciable..........Thanks in Advance........


    Regards,

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Passing of Parameters in two classes

    If you are using QWizard and QWizardPage based widgets you can use registerField() and field() to wirte and read values between pages
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Passing of Parameters in two classes

    Dear Santosh,

    Thanks for the reply.....I used QMainwindow if im not wrong it would be greatful if you mail and show me in the form of an Example..Coz it might help others too a lot who are in need of.......I just need to pass the parameters thats all thats the problem im facing now.....Thanks in Advance........Any Solution would be appreciable....


    Regards,

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Passing of Parameters in two classes

    Here is what I take from your question:
    • You have two classes representing two forms.
    • You have a private member variable representing the phone number edit box in form A.
    • Form B needs the text from the private member variable in Form A.
    • All the talk of sessions and cookies has nothing to do with a desktop application: these are web application concepts.


    Do you know any C++? Here are two pure C++ approaches:
    • You can expose the private value using a public getter function in Form A so that Form B can get the value.
    • You can expose a public setter function in Form B so that Form A can push the value into Form B


    Here is a Qt flavoured approach: Have Form A emit a signal when the value is changed and connect that to a slot in Form B.

    What you do depends on what your application requirements are and how the user interaction is supposed to flow.

  5. #5
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Passing of Parameters in two classes

    Check this example:- DataFromOnePageToOther.zip

    Maybe this will help.
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  6. The following user says thank you to sonulohani for this useful post:

    astodolski (25th October 2012)

Similar Threads

  1. Replies: 8
    Last Post: 28th January 2015, 09:45
  2. Replies: 1
    Last Post: 22nd April 2010, 14:34
  3. Replies: 2
    Last Post: 22nd April 2010, 11:44
  4. passing parameters to Active-x in hash does not work
    By yazwas in forum Qt Programming
    Replies: 0
    Last Post: 26th February 2010, 11:53
  5. Replies: 2
    Last Post: 27th March 2007, 12:09

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.