Results 1 to 8 of 8

Thread: I want to modify/edit the QFileDialog dialog...

  1. #1
    Join Date
    Jun 2008
    Posts
    4
    Qt products
    Qt3

    Default I want to modify/edit the QFileDialog dialog...

    Hi folks!

    I'm new in Qt and I need to build a dialog which contains the SaveFileAs-alike feature, but, furthermore, in the same dialog, some ~10 informations widgets(most of them are strings and one of them is date).
    in another word, I want to have the standard QFileDialog class dialog so I'll be able to further modify or edit it through the designer application.

    Do you know what I mean?

    I'm afraid that building such a dialog from scratch means huge amount of work-time, which I don't have.

    I was trying to look in the internet and in the book called "C++ GUI Programming With Qt3", but couldn't find anything like that.

    Regards.

    BTW I've posted it in another forums system, so if I get an answer here or there, I'll quote it in the other forum.

  2. #2
    Join Date
    Jan 2006
    Location
    Third rock from the sun
    Posts
    106
    Thanks
    17
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: I want to modify/edit the QFileDialog dialog...

    You can subclass the QFileDialog. Then pull out the layout( ) and place your widget(s) appropriatly:
    Qt Code:
    1. QGridLayout *mainLayout = (QGridLayout *)layout( );
    2. mpPropertiesGrp = [COLOR=#0000ff]new[/COLOR] QGroupBox( tr( [COLOR=#a31515]"Properties"[/COLOR] ) );
    3. mpPropertiesLayout = [COLOR=#0000ff]new[/COLOR] QGridLayout( );
    4. mpPropertyLbl = [COLOR=#0000ff]new[/COLOR] QLabel( [COLOR=#a31515]" "[/COLOR] );
    5. mpPropertyLbl->setAlignment( Qt::AlignTop | Qt::AlignLeft );
    6. mpPropertiesLayout->addWidget( mpPropertyLbl, 0, 0, 3, 2 );
    7. mpPropertiesGrp->setLayout( mpPropertiesLayout );
    8. mainLayout->addWidget( mpPropertiesGrp, 0, 3, 4, 3 );
    To copy to clipboard, switch view to plain text mode 

    This snippit puts a Properties panel on the right hand side of the QFileDialog. This is using Qt4. The code would have to be modified a bit for Qt3. Hope this helps.
    Every little child knows
    if you cant see dreams
    your eyes are blind

    Moxy Fruvous

  3. #3
    Join Date
    Jun 2008
    Posts
    4
    Qt products
    Qt3

    Default Re: I want to modify/edit the QFileDialog dialog...

    Huge thanks!!

    Although your code doesn't work(The setLayout() method said ti be a private one), maybe due to the differences between Qt3 and Qt4, it's very useful for as an example to start with and now I know where to focus and look in the documents without reading it from A to Z.

    I'm trying to create my dialog now.

    Thanks again!

  4. #4
    Join Date
    Jan 2006
    Location
    Third rock from the sun
    Posts
    106
    Thanks
    17
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: I want to modify/edit the QFileDialog dialog...

    Whoops, I missed you were in Qt3.

    The code example should still work. Basically you need to get the QFileDialog's layout
    QGridLayout *layout = (QGridLayout *)fileDialog->layout( );

    and then you can put in any widget into it. The setLayout( ) was for the QGroupBox.
    Every little child knows
    if you cant see dreams
    your eyes are blind

    Moxy Fruvous

  5. #5
    Join Date
    Jun 2008
    Posts
    4
    Qt products
    Qt3

    Default Re: I want to modify/edit the QFileDialog dialog...

    Thanks a lot!!

    God bless you

    I can see QT is not really inferior to MFC, if at all, it just doesn't have immediate on-line documentation.

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

    Default Re: I want to modify/edit the QFileDialog dialog...

    Quote Originally Posted by InterFan View Post
    it just doesn't have immediate on-line documentation.
    Do you use Qt Assistant?

  7. #7
    Join Date
    Jan 2006
    Location
    Third rock from the sun
    Posts
    106
    Thanks
    17
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: I want to modify/edit the QFileDialog dialog...

    Quote Originally Posted by InterFan View Post
    Thanks a lot!!

    God bless you

    I can see QT is not really inferior to MFC, if at all, it just doesn't have immediate on-line documentation.
    Actually, I think the online/included API documentation and examples are wonderful compared to other toolkits I have used. http://doc.trolltech.com/ has all the API and examples for using Qt. All this documentation is included with the Qt bundles as well. Not to mention QtCentre for specific questions. I have NEVER had a more responsive forum, including MFC. Best of luck in your Qt endeavours!
    Every little child knows
    if you cant see dreams
    your eyes are blind

    Moxy Fruvous

  8. #8
    Join Date
    Jun 2008
    Posts
    4
    Qt products
    Qt3

    Default Re: I want to modify/edit the QFileDialog dialog...

    Maybe it's my mistake, but while the Qt(including assistant which I do use) is great as a reference, it was much more difficult for me to 'get start quickly with zero knowledge" than with MFC which was immediate.

Similar Threads

  1. why QFileDialog does not display the default winxp dialog?
    By mismael85 in forum Qt Programming
    Replies: 5
    Last Post: 21st March 2008, 13:39
  2. Resizing the dialog boxes
    By anju123 in forum Qt Programming
    Replies: 4
    Last Post: 14th September 2007, 10:41
  3. QGraphicsView: Dialog Position Doubt
    By arjunasd in forum Qt Programming
    Replies: 1
    Last Post: 6th August 2007, 17:48
  4. Replies: 4
    Last Post: 13th June 2007, 15:37
  5. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 14:52

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.