[PyQt] linking listwidget with Qgraphicsview
Matt Smith
melkor at orangepalantir.org
Tue Mar 10 23:14:46 GMT 2009
>From the looks of it your list widget has the name of the file you want
to open and display so what you can do is connect the signal being
emitted, itemClicked(QListWidgetItem *), and then get the text from the
item passed with say my_list_item.text().
>From that you should be able to make a QPixmap with the file name and
put that in your graphicscene as a QGraphicsPixmapItem.
mbs
there are a couple signals you could use:
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qlistwidget.html
> Message: 2
> Date: Tue, 10 Mar 2009 05:49:35 -0700 (PDT)
> From: klia <alwaseem307ster at yahoo.com>
> Subject: [PyQt] linking listwidget with Qgraphicsview
> To: pyqt at riverbankcomputing.com
> Message-ID: <22433529.post at talk.nabble.com>
> Content-Type: text/plain; charset=us-ascii
>
>
> hey guys;
>
> in my application i have Listwidegt and Qgraphics view beside to each other
> in the interface, my intension is after i list my photos in the listwidget,
> i want that whenever i click on the photo on listwidget it will be displayed
> on the graphics view...
>
> Any idea on how to do that?
>
> here's the code of inserting photos into Listwidegt
>
> files = QFileDialog.getOpenFileNames(self, self.trUtf8("Add documentation"),
> QString("/home"), self.trUtf8("Images (*.png *.tiff *.jpg)"))
> for file_ in files:
> data = ""
> f = open(file_)
> #data = file.read()
> self.listWidget.addItem(file_)
>
> here's a screen shot of my inquiry
> http://www.nabble.com/file/p22433529/Screenshot-MainWindow-1.png
> --
More information about the PyQt
mailing list