Results 1 to 6 of 6

Thread: optionDialog

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default optionDialog

    Hi,
    I have a optAction in Mainform that calls an optionDialog (designed from qtDesigner).
    In optionDialog when I pusk on save button start the SLOT saveOptions()
    I like to do this inside optiondialog.ui.h file:
    Qt Code:
    1. #include <qfile.h>
    2. #include <mainform.h>
    3. class MainForm;
    4.  
    5. void optionDialog::saveOptions()
    6. {
    7. MainForm* m;
    8. m->toolBox->show(); //access to mainform
    9. }
    To copy to clipboard, switch view to plain text mode 
    But this don't compile. Is there a way?
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: optionDialog

    what error compiler give?
    a life without programming is like an empty bottle

  3. #3
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: optionDialog

    sorry it isn't error. But I must to retrieve this:
    Qt Code:
    1. MainForm* m= (MainForm*) this->topLevelWidget();
    To copy to clipboard, switch view to plain text mode 
    but this->topLevelWidget() isn't what I want.....
    Regards

  4. #4
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: optionDialog

    I think you need give pointer on MainForm object to your optionDialog and then use this pointer.
    a life without programming is like an empty bottle

  5. #5
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: optionDialog

    I prefer from optionDialog access to mainForm. In any way my problem is how to do....
    thanks
    Regards

  6. #6
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: optionDialog

    Subclass your optionDialog. And create it from mainForm class.

    Qt Code:
    1. MainForm::MainForm()
    2. {
    3. optionDialogNew *optDIalog = new optionDialogNew(this);
    4. }
    5.  
    6. ****
    7. void optionDialogNew::optionDialogNew(MainForm*pParent) : optionDialog
    8. {
    9. // some private class member
    10. m_pParent = pParent;
    11. }
    12.  
    13.  
    14. void optionDialogNew::saveOptions()
    15. {
    16. m_pParent->toolBox->show(); //access to mainform
    17. }
    To copy to clipboard, switch view to plain text mode 
    a life without programming is like an empty bottle

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.