QTfrontend/itemNum.cpp
changeset 1455 7d0a4ecd8210
parent 1066 1f1b3686a2b0
child 1886 0bb8f61e5630
equal deleted inserted replaced
1454:e58d3bbfc7af 1455:7d0a4ecd8210
    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), 
    25   m_im(im), QFrame(parent), nonInteractive(false), minItems(min), maxItems(max),
    26   numItems(min+2 >= max ? min : min+2),
    26   numItems(min+2 >= max ? min : min+2),
    27   infinityState(false)
    27   infinityState(false)
    28 {
    28 {
    29 }
    29 }
    30 
    30 
    67   if (numItems==maxItems+1) {
    67   if (numItems==maxItems+1) {
    68     QRect target(0, 0, 100, 32);
    68     QRect target(0, 0, 100, 32);
    69     painter.drawImage(target, QImage(":/res/infinity.png"));
    69     painter.drawImage(target, QImage(":/res/infinity.png"));
    70   } else {
    70   } else {
    71     for(int i=0; i<numItems; i++) {
    71     for(int i=0; i<numItems; i++) {
    72       QRect target(11 * i, i % 2, 25, 25);
    72       QRect target(11 * i, i % 2, 25, 35);
    73       painter.drawImage(target, m_im);
    73       painter.drawImage(target, m_im);
    74     }
    74     }
    75   }
    75   }
    76 }
    76 }
    77 
    77