Results 1 to 3 of 3

Thread: File Open dialog with preview?

  1. #1
    Join Date
    Jul 2007
    Posts
    56
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question File Open dialog with preview?

    I'm looking for a file open dialog that allows a custom preview of the contents file selected in the dialog. Kind of like what Photoshop and other applications did. Preview can be either text or graphical.

    Does Qt have anything like that? If not, any pointers on the best way to go about making one?

    Thanks

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: File Open dialog with preview?

    Qt does not have it. You must implement it yourself.

    It is not easy to say how to achieve this.
    Photoshop does everything internal.

    So, I guess this is the best way to do it. This is how I'd do it.

    Regards

  3. #3
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: File Open dialog with preview?

    Should be easy enough :
    1. Create a custom preview widget
    2. Add it to the dialog :
      Qt Code:
      1. fileOpenDialog.layout()->addWidget(new MyPreviewWidget)
      To copy to clipboard, switch view to plain text mode 
      (a bit of testing may be necessary here to fine tune the look...
    3. connect the dialog signals to appropriate slots of your preview widget so as to update its content...
    I myself hacked a similar preview widget (but not for use with this dialog). The code was a bit crappy but if you want I can send it to you so that you have an idea of how to get started...

    To allow displaying different types of content I would recommend using a stacked widget with a label for images, a text edit/text browser for text files, ...
    Current Qt projects : QCodeEdit, RotiDeCode

Similar Threads

  1. open large file in qt?
    By vishal.chauhan in forum Qt Programming
    Replies: 11
    Last Post: 29th May 2007, 08:25
  2. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 16:21
  3. How to open a Pdf file from Qt
    By vishal.chauhan in forum Newbie
    Replies: 2
    Last Post: 28th March 2007, 09:24
  4. preview file dialog
    By mickey in forum Qt Programming
    Replies: 11
    Last Post: 22nd April 2006, 00:03
  5. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 15: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.