PictureFlow - listing images in PyQt4
Check out the new site at https://rkblog.dev.
17 April 2009
Comments
PictureFlow is a Qt4 (and PyQt4) widget that allows "awesome" listing of images. PyQt4 bindings are only available in the SVN code (download tar.gz snapshot) that you can get from:
svn export http://pictureflow.googlecode.com/svn/trunk/ pictureflow
To compile and install PictureFlow use:
- Go to pictureflow-qt folder and execute: qmake, make and make install
- Go to pyqt folder and execute: python configure.py, make, make install
import sys
from os import listdir
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from pictureflow import *
app = QApplication(sys.argv)
w = PictureFlow()
images = listdir('/path/to/folder/with/images/')
for i in images:
if i.endswith('jpg'):
w.addSlide(QPixmap('/path/to/folder/with/images/%s' % i))
w.show()
sys.exit(app.exec_())

PictureFlow class
Below is the PictureFlow class definition for SIP:public:
enum ReflectionEffect
{
NoReflection,
PlainReflection,
BlurredReflection
};
PictureFlow(QWidget *parent /TransferThis/ = 0);
~PictureFlow();
QColor backgroundColor() const;
void setBackgroundColor(const QColor& c);
QSize slideSize() const;
void setSlideSize(QSize size);
int slideCount() const;
QImage slide(int index) const;
int centerIndex() const;
ReflectionEffect reflectionEffect() const;
void setReflectionEffect(ReflectionEffect effect);
public slots:
void addSlide(const QImage& image);
void addSlide(const QPixmap& pixmap);
void setSlide(int index, const QImage& image);
void setSlide(int index, const QPixmap& pixmap);
void setCenterIndex(int index);
void clear();
void showPrevious();
void showNext();
void showSlide(int index);
void render();
void triggerRender();
signals:
void centerIndexChanged(int index);
protected:
void paintEvent(QPaintEvent *event);
void keyPressEvent(QKeyEvent* event);
void mousePressEvent(QMouseEvent* event);
void resizeEvent(QResizeEvent* event);
RkBlog
Check out the new site at https://rkblog.dev.
Comment article