QTfrontend/itemNum.cpp
changeset 640 e69b651bb336
parent 624 e7673b036db5
child 642 3178a83c7043
--- a/QTfrontend/itemNum.cpp	Mon Dec 10 22:05:50 2007 +0000
+++ b/QTfrontend/itemNum.cpp	Mon Dec 10 22:36:54 2007 +0000
@@ -22,7 +22,8 @@
 #include <QPainter>
 
 ItemNum::ItemNum(const QImage& im, QWidget * parent, unsigned char min, unsigned char max) :
-  m_im(im), QWidget(parent), nonInteractive(false), minItems(min), maxItems(max), numItems(min)
+  m_im(im), QWidget(parent), nonInteractive(false), minItems(min), maxItems(max), numItems(min),
+  infinityState(false)
 {
 }
 
@@ -35,6 +36,9 @@
   if(nonInteractive) return;
   if(event->button()==Qt::LeftButton) {
     event->accept();
+    if(infinityState && numItems==maxItems) {
+      incItems();
+    }
     if(numItems < maxItems) {
       incItems();
     }
@@ -54,9 +58,14 @@
 {
   QPainter painter(this);
 
-  for(int i=0; i<numItems; i++) {
-    QRect target(11 * i, i % 2, 25, 25);
-    painter.drawImage(target, m_im);
+  if (numItems==maxItems+1) {
+    QRect target(0, 0, 250, 32);
+    painter.drawImage(target, QImage(":/res/infinity.png"));
+  } else {
+    for(int i=0; i<numItems; i++) {
+      QRect target(11 * i, i % 2, 25, 25);
+      painter.drawImage(target, m_im);
+    }
   }
 }
 
@@ -69,3 +78,8 @@
 {
   numItems=num;
 }
+
+void ItemNum::setInfinityState(bool value)
+{
+  infinityState=value;
+}