Results 1 to 12 of 12

Thread: Problem in the QFileDialog

  1. #1
    Join Date
    Feb 2006
    Posts
    157
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Unhappy Problem in the QFileDialog

    Hai guys,


    Version : Qt 3.3.4
    Problem : Problem in the MODEL property of a QFileDialog



    I have the following windows or objects in screen:-

    1. MyMainWindow
    2. MyWizard ( textBox, BrowseButton , CancelButton.. )
    3. QFileDialog

    The parent-child realation is setted in the same order as above.

    While Applicaitons loads the following will be the senario.....
    1. MyMainWindow comes
    2. while clicking one menu , MyWizad comes with a BROWSE-BUTTON
    3. While clicking on BROWSE-BUTTON , the below method <code> saveInputDataToFile ( const QString& inputName, const Q_ULLONG& inputSize, QWidget* parent ) </code> will be invoked to popup a QFileDilog
    Qt Code:
    1. void MyMainWindow :: saveInputDataToFile( const QString& inputName, const Q_ULLONG& inputSize , QWidget* parent )
    2. {
    3. -------
    4. // parent = MyWizard object
    5. QFileDialog * obj = new QFileDialog ( parent , "", true) ;
    6.  
    7. QString destFilePath = obj->getSaveFileName( QString::null, QString::Null, parent );
    8. -------
    9. }
    To copy to clipboard, switch view to plain text mode 


    My problem is that .....

    1 .While showing the " QFileDialog ", if am clicking on the MyMainWindow ,
    2. then the MyWizard's ( shows in between MyMainWindow and QFileDialog ) window highlighted , cursor will be in the wizard ( in a textBox near to BrowseButton )
    3. and we can access BUTTONS using tab Key. Even we can CLOSE that Wizard using KEYBOARD, At the same time we can see the QFileDialog in the screen with out MyWizard


    I want to restrict this KEYBORD access in MyWizard...please help me


    Thank You.
    Last edited by jacek; 6th December 2006 at 19:47. Reason: changed [html] to [code]

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem in the QFileDialog

    What is "parent" in the above code?

  3. #3
    Join Date
    Feb 2006
    Posts
    157
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: Problem in the QFileDialog

    void MyMainWindow :: saveInputDataToFile( const QString& inputName, const Q_ULLONG& inputSize , QWidget* parent )
    {
    -------
    // Parent = MyWizard ;

    QFileDialog * obj = new QFileDialog ( parent , "", true ) ;

    QString destFilePath = obj->getSaveFileName( QString::null, QString::Null, parent );
    -------
    }

    [HTML]
    This is the parent -child flow....
    +--------------------------+
    | MyMainWindow |
    +----------^--------------+
    |
    +---------------------------+
    | MyWizard |
    +-----------^--------------+
    |
    +--------------------------+
    | QFileDialog |
    +--------------------------+
    [/HTML]

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem in the QFileDialog

    getSaveFileName is a static method, please use it as one.

    Qt Code:
    1. QString dest = QFileDialog::getSaveFileName(parent);
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Feb 2006
    Posts
    157
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: Problem in the QFileDialog

    i have tried this also
    Qt Code:
    1. void MyMainWindow :: saveInputDataToFile( const QString& inputName, const Q_ULLONG& inputSize , QWidget* parent )
    2. {
    3. -------
    4. QString destFilePath = QFileDialog::getSaveFileName( ..., .., ..., ..., parent );
    5.  
    6. -------
    7. }
    To copy to clipboard, switch view to plain text mode 

    But at this time also the keyboard is working in MyWizard ...and i can even close it by using TAB-KEY , without closing the FileDialog


    please help me...
    Last edited by wysota; 6th December 2006 at 11:11. Reason: Changed [html] into [code]

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem in the QFileDialog

    Are you sure "parent" is set to the wizard? Can you confirm that? (for example by using
    Qt Code:
    1. parent->metaObject()->className()
    To copy to clipboard, switch view to plain text mode 

    Edit: The attached code works correctly for me (compile using qmake -project && qmake && make)
    Attached Files Attached Files
    Last edited by wysota; 6th December 2006 at 11:09.

  7. The following user says thank you to wysota for this useful post:

    joseph (6th December 2006)

  8. #7
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem in the QFileDialog

    You once again missed that it is related to Qt3
    We can't solve problems by using the same kind of thinking we used when we created them

  9. #8
    Join Date
    Feb 2006
    Posts
    157
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: Problem in the QFileDialog

    I confirmed that , " QFileDialog's " parent is " QMyWizard " in run time.
    I have debugged the code it shows ....



    Qt Code:
    1. void MyMainWindow :: saveInputDataToFile( const QString& inputName,
    2. const Q_ULLONG& inputSize ,
    3. QWidget* parent )
    4.  
    5. {
    6.  
    7. -------
    8. const char * Name = parent->className();
    9. // in run time the Name is MyWizard.
    10.  
    11. QString destFilePath = QFileDialog::getSaveFileName( ..., .., ..., ..., parent );
    12.  
    13.  
    14.  
    15. -------
    16.  
    17. }
    To copy to clipboard, switch view to plain text mode 


    I think i have to do some thing else ...


    Thank you so much for sparing your time for me
    Last edited by jacek; 6th December 2006 at 19:48. Reason: changed [html] to [code]

  10. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem in the QFileDialog

    Quote Originally Posted by sunil.thaha View Post
    You once again missed that it is related to Qt3
    So? Does it matter? The code is practically the same and works the same, here - try it.
    Attached Files Attached Files

  11. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem in the QFileDialog

    Quote Originally Posted by joseph View Post
    I think i have to do some thing else ...
    Is the wizard a QDialog subclass (note that QWizard is QDialog subclass as well)?

    Try the code I attached in the previous post, it should work for you. If it doesn't you'll know you have a buggy Qt installation. If it does, maybe it'll help you correct your code.

  12. #11
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem in the QFileDialog

    Quote Originally Posted by wysota View Post
    So? Does it matter? The code is practically the same and works the same, here - try it.
    It does not matter to you or to me. But the question is does it matter to him ?
    We can't solve problems by using the same kind of thinking we used when we created them

  13. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem in the QFileDialog

    Quote Originally Posted by sunil.thaha View Post
    It does not matter to you or to me. But the question is does it matter to him ?
    The question was asked in "Qt programming" section, not in the "Newbie" section so I can assume that the person asking the question has some skills to modify the code so that it fits Qt3. The only changes required were modifying the includes and the file dialog line. Anyway, just to make things clear, I didn't use Qt4 code on purpose, I just didn't notice one was using Qt3.

Similar Threads

  1. hierarchical model in a flat view
    By gniking in forum Qt Programming
    Replies: 4
    Last Post: 10th November 2009, 20:17
  2. Qfiledialog Problem - (Beginner)
    By kingslee in forum Qt Tools
    Replies: 3
    Last Post: 11th October 2006, 23:00
  3. QPixmap designer property not showing up
    By high_flyer in forum Qt Programming
    Replies: 1
    Last Post: 15th March 2006, 19:56
  4. Replies: 16
    Last Post: 7th March 2006, 15:57

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.