QFileDialog.getOpenFileName with preview?
-
Hallo,
I give the user a QFileDialog.getOpenFileName to chose a picture (*.png, *.jpg and so on).
It would be very nice to have a preview of the pictures in this file dialog, so the user don't have to know the filename but can look at the pictures... Is there a chance? -
Hello,
of course there is a chance ;). One of possible solutions would be writing Your own delegate which could visiualize the picture for You/User. To do this You should derive from QStyledItemDelegate (here's example: "Star delegate":http://qt-project.org/doc/qt-4.8/itemviews-stardelegate.html ) and implemented Your own paint and sizeHint methods. Then You can set this delegate to Your view with "SetItemDelegate":http://qt-project.org/doc/qt-5.0/qtwidgets/qfiledialog.html#setItemDelegate# setItemDelegate method.
EDIT: Sorry, seems like I read to fast Your post and I bit missunderstood Your problem... So I made a small update of methods and links above.
with best regards,
Robert :)