thumbnails in Qfilediloug using pyqt

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • klia
    New Member
    • Oct 2008
    • 14

    thumbnails in Qfilediloug using pyqt

    hey folks;

    i am working on my program using python and PYQT that is suppose to load digital photos into the main interface of my program and perform few action on them. i have here the codes that will prompt me to brows to the system directory and show the system files and any other files. any way the codes here deal only with text files and loads only one file at the time. my question how can i alter the code to deal with digital photos and be able to load photos to the system in thumbnails.


    thanks in advance

    Code:
    #!/usr/bin/python
     
    # openfiledialog.py
     
    import sys
    from PyQt4 import QtGui
    from PyQt4 import QtCore
     
     
    class OpenFile(QtGui.QMainWindow):
        def __init__(self, parent=None):
            QtGui.QMainWindow.__init__(self, parent)
     
            self.setGeometry(300, 300, 350, 300)
            self.setWindowTitle('OpenFile')
     
            self.textEdit = QtGui.QTextEdit()
            self.setCentralWidget(self.textEdit)
            self.statusBar()
            self.setFocus()
     
            exit = QtGui.QAction(QtGui.QIcon('open.png'), 'Open', self)
            exit.setShortcut('Ctrl+O')
            exit.setStatusTip('Open new File')
            self.connect(exit, QtCore.SIGNAL('triggered()'), self.showDialog)
     
            menubar = self.menuBar()
            file = menubar.addMenu('&File')
            file.addAction(exit)
     
        def showDialog(self):
            filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file',
                        '/home')
            file=open(filename)
            data = file.read()
            self.textEdit.setText(data)
     
    app = QtGui.QApplication(sys.argv)
    cd = OpenFile()
    cd.show()
    app.exec_()
  • QwertyManiac
    New Member
    • Dec 2008
    • 2

    #2
    On Windows and Mac, QFileDialog generally starts up the native File dialog, in which these features are present. The same is also possible for GNOME when using QGtkStyle.

    There, however, is no direct way to implement the file previewer in Qt 4.4. You may look at the Qt 3 support classes Q3FilePreview and Q3FileDialog both to implement this.

    Comment

    Working...