Results 1 to 9 of 9

Thread: Open/Save dialog with images preview

  1. #1
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question Open/Save dialog with images preview

    Hi all there...

    I need a dialog to open/save images in my application, i want it to be as close to native windows open/save dialogs as possible but with preview of currently selected image area on the right side.

    Windows dialogs can't be reused because they are modal on the level of application & method that calls then returns after dialog is closed.
    It's teoretically possible to start dialog in separate thread and reparent it to own widget, but i think it's bad idea - lots of work and unsure effects...

    So... i've decided to design custom dialog, and I found some difficulties with comboBox that selects current drive/directory.
    First: it contains desktop, my documents, my network places, drives via my computer, recent files ect... I want to use QDirModel with drives only(at least for now), but I'd like to make this combobox as similar as possible to native original in final version, and have no idea how to do it.
    Second: Original comboBox is hierarchical, so i think i must write own comboBox that uses treeView instead of built-in list, unless anybody knows better approach to do this...

    I think it's quite common components that should be written as good as possible to be reusable so ANY suggestions & ideas are welcome...

  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: Open/Save dialog with images preview

    Quote Originally Posted by mchara View Post
    Windows dialogs can't be reused because they are modal on the level of application & method that calls then returns after dialog is closed.
    And what is wrong with that? Qt uses the native Windows dialog with success...

  3. #3
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Open/Save dialog with images preview

    It would be ok, if i would need only to use it, but i need a custom dialog with preview of images and i tougth that native windows dialog could be used as a part of custom dialog...

    Mentioned reasons makes it useless as a components of own dialog, winapi allows to use it as is, but haven't any methods to create a dialog and do anything with it...

  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: Open/Save dialog with images preview

    Doesn't Windows provide a native dialog with previews? I recall seing it very often in different apps, but I'm not sure if it is a system dialog or manually extended one.

  5. #5
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Open/Save dialog with images preview

    I've searched about this, but i didn't found anything useful, so there's no native dialog with preview, or i've searched it wrong...
    anyhow dialog you could see quite often, is as i think, a component that is a part of borland's environments(C++Builder, Delphi)...

    Besides: if it would be native dialog, trolls would surely make it available from QFileDialog is some way...

  6. #6
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Open/Save dialog with images preview

    Hi there,

    I found QFileItemProvider can return myComputer, Desktop, Trash, Network ect. icons.
    I also found SHGetSpecialFolderLocation method in winapi that returns real locations of virtual folders mentioned above.

    I nearly finished custom comboBox that shows overridden QTreeView instead of internal items list (QTreeView can show items in hierarchy), TreeView currently uses QDirModel and shows drives only, so with those new information i think the best direction would be a custom ModelView that reproduces the structure of windows virtual folders on 2 topmost levels and attaches real QDirModel as children of proper items.

    Does anyone knows better aproach or do u think it's good idea?

  7. #7
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Open/Save dialog with images preview

    Hi again, i found that native dialog allows to show itself with additional custom dialog embedded(it's rather difficult & low level so i think i won't waste my time for it). Bigger problem for me is the fact that native dialog is not storing state(size, current view etc.) so thumbnails view that have to be turned on each time dialog is opened is rather useless...
    I think i have no choice & have to implement own thumbnails view generating mechanism for my dialog. I'm a bit unconcerned that custom dialog won't have explorer's features such as drag&drop, rename/delete/new folder, but it's not open file dialog is for, so i'll have to live without it...

  8. #8
    Join Date
    Aug 2006
    Posts
    250
    Thanks
    19
    Thanked 49 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Open/Save dialog with images preview

    Quote Originally Posted by mchara View Post
    Hi again, i found that native dialog allows to show itself with additional custom dialog embedded(it's rather difficult & low level so i think i won't waste my time for it). Bigger problem for me is the fact that native dialog is not storing state(size, current view etc.) so thumbnails view that have to be turned on each time dialog is opened is rather useless...
    I think i have no choice & have to implement own thumbnails view generating mechanism for my dialog. I'm a bit unconcerned that custom dialog won't have explorer's features such as drag&drop, rename/delete/new folder, but it's not open file dialog is for, so i'll have to live without it...
    I would avoid designing a custom dialog if at all possible. Like you said, you will lose consistency with every other dialog in the system, also lots of potential for bugs.

    Have you investigated using the native open dialog with QFileDialog and listening for the filesSelected signal? You could just position a preview window beside the open dialog and show the currently selected image. Not as pretty as having it integrated into the dialog, but it should be very easy to implement.

  9. #9
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Open/Save dialog with images preview

    Quote Originally Posted by pherthyl View Post
    Have you investigated using the native open dialog with QFileDialog and listening for the filesSelected signal? You could just position a preview window beside the open dialog and show the currently selected image.
    The thing is that QFileDialog isn't a native dialog - it's customized to, but by trolls(besides it's weak in my opinion), native dialog can be called by QFileDialog from a static method, but it's not emitting anything.
    Qt won't help because this behavior is determined by winApi.

    I know that I'm loosing lots of goodies by customizing fileDialog, but my application work's on images only so it's a priority to have preview or thumbnails & native dialog opens always in list mode. Imagine that on each file you're opening file dialog, changing view to thumbnails and picking a file then... thumbnails view that can't be set to default is useless, nobody will change it every opened file, in other hand soft for image processing that have no functionality that shows what you are actually opening - i already have one (written view years ago) and i'm ill when i'm using it... it's a priority and it seems that i can't achieve it without sacrificing some native functionalities.

    Native dialog is great, there's no discussion here, but it's not supporting applications that are meant to work with images.

    In addition, note that windows won't generate thumbnails for all formats supported by qt...

    On the margin: I already done custom dialog with scalable preview(that can be turned off), with mode that allows to open multiple files, and thumbnails view (with cache, xml file per directory with generated thumbnails & timestamps, thumbnails generating thread). It fits to my app better than native dialog & it have minimal assumed functionality (maybe it will be enhanced...)so i think problem is solved, at least temporary, but i'm still interested about your opinions...

Similar Threads

  1. File Open dialog with preview?
    By will49 in forum Qt Programming
    Replies: 2
    Last Post: 24th July 2007, 19:08
  2. Replies: 3
    Last Post: 17th May 2007, 14:50
  3. preview file dialog
    By mickey in forum Qt Programming
    Replies: 11
    Last Post: 22nd April 2006, 00:03

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.