equal
deleted
inserted
replaced
20 |
20 |
21 #include <QMouseEvent> |
21 #include <QMouseEvent> |
22 #include <QPainter> |
22 #include <QPainter> |
23 |
23 |
24 ItemNum::ItemNum(const QImage& im, QWidget * parent, unsigned char min, unsigned char max) : |
24 ItemNum::ItemNum(const QImage& im, QWidget * parent, unsigned char min, unsigned char max) : |
25 m_im(im), QWidget(parent), nonInteractive(false), minItems(min), maxItems(max), numItems(min), |
25 m_im(im), QWidget(parent), nonInteractive(false), minItems(min), maxItems(max), |
|
26 numItems(min+2 >= max ? min : min+2), |
26 infinityState(false) |
27 infinityState(false) |
27 { |
28 { |
28 } |
29 } |
29 |
30 |
30 ItemNum::~ItemNum() |
31 ItemNum::~ItemNum() |
57 void ItemNum::paintEvent(QPaintEvent* event) |
58 void ItemNum::paintEvent(QPaintEvent* event) |
58 { |
59 { |
59 QPainter painter(this); |
60 QPainter painter(this); |
60 |
61 |
61 if (numItems==maxItems+1) { |
62 if (numItems==maxItems+1) { |
62 QRect target(0, 0, 250, 32); |
63 QRect target(0, 0, 100, 32); |
63 painter.drawImage(target, QImage(":/res/infinity.png")); |
64 painter.drawImage(target, QImage(":/res/infinity.png")); |
64 } else { |
65 } else { |
65 for(int i=0; i<numItems; i++) { |
66 for(int i=0; i<numItems; i++) { |
66 QRect target(11 * i, i % 2, 25, 25); |
67 QRect target(11 * i, i % 2, 25, 25); |
67 painter.drawImage(target, m_im); |
68 painter.drawImage(target, m_im); |