bulletindicator.h 839 Bytes
#ifndef BULLETINDICATOR_H
#define BULLETINDICATOR_H

#include <QWidget>
#include <QLabel>

class BulletIndicator : public QWidget
{
    Q_OBJECT
public:
    explicit BulletIndicator(QWidget *parent = 0);

    void setBulletPixmap(const QPixmap &pixmap);
    void setBulletPixmap(const QString &path);
    void setCurrentBulletPixmap(const QPixmap &pixmap);
    void setCurrentBulletPixmap(const QString &path);

    int maximum() { return max; }
    int currentIndex() { return cur; }

signals:

public slots:
    void setCurrentIndex(int index);
    void setMaximum(int maximum);

protected:
    void resizeEvent(QResizeEvent *event);

private:
    int max;
    int cur;

    int padding;
    QPixmap bulletPixmap;
    QPixmap currentBulletPixmap;

    QList<QLabel *> bullets;

    void updatePosition();
};

#endif // BULLETINDICATOR_H