Results 1 to 8 of 8

Thread: pass variables between 2 forms

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: pass variables between 2 forms

    Quote Originally Posted by patrik08
    You can use http://doc.trolltech.com/4.1/qsettings.html is easy ....
    is same as php session ..... .
    You don't use QSettings to pass data between forms. QSettings is for accessing application's configuration and other data that need permanent store.

    To pass data between forms you can use signals & slots mechanism or just create a normal methods that pass data:
    Qt Code:
    1. void Form1::passDataToSecondForm()
    2. {
    3. // _form2 points to an object that represents the second form.
    4. _form2->setSomething( _ui.someLineEdit->text() );
    5. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    May 2006
    Posts
    788
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    49
    Thanked 48 Times in 46 Posts

    Default Re: pass variables between 2 forms

    Quote Originally Posted by jacek
    You don't use QSettings to pass data between forms. QSettings is for accessing application's configuration and other data that need permanent store.
    Normal i make form 1 ,2 ,3 ecc on a QTabWidget /QToolBox to access all on the same class.... und emit / slots from subclass to invoke parent the read action... and setting i put to a xml file... to make portable .... i not find the place / archives from qt to store data from QSettings .... on mac i not found .xxx hidden file from qsetting ... to delete or remove ....

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: pass variables between 2 forms

    Quote Originally Posted by patrik08
    and setting i put to a xml file... to make portable ....
    If you want to make your settings portable between different OSes, you can use .ini files (QSettings::IniFormat) or even register you own format with QSettings::registerFormat(), but this has nothing to do with passing data between objects inside your application.

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

    patrik08 (17th June 2006)

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.