QTfrontend/ui/widget/hedgehogerWidget.cpp
changeset 6968 23722ba0f89a
parent 6952 7f70f37bbf08
child 6969 3273a2b983ca
--- a/QTfrontend/ui/widget/hedgehogerWidget.cpp	Mon Apr 30 23:35:40 2012 +0400
+++ b/QTfrontend/ui/widget/hedgehogerWidget.cpp	Mon Apr 30 23:14:40 2012 +0200
@@ -19,6 +19,8 @@
 
 #include "hedgehogerWidget.h"
 
+#include <QPainter>
+
 #include "frameTeam.h"
 
 CHedgehogerWidget::CHedgehogerWidget(const QImage& im, const QImage& img, QWidget * parent) :
@@ -32,6 +34,8 @@
       numItems = pOurFrameTeams->maxHedgehogsPerGame - pOurFrameTeams->overallHedgehogs;
     } else numItems = 4;
     pOurFrameTeams->overallHedgehogs += numItems;*/
+
+    this->setMinimumWidth(20);
 }
 
 void CHedgehogerWidget::incItems()
@@ -74,3 +78,17 @@
 {
     return numItems;
 }
+
+void CHedgehogerWidget::paintEvent(QPaintEvent* event)
+{
+    Q_UNUSED(event);
+
+    if (this->width() >= 11 * numItems + 28)
+        ItemNum::paintEvent(event);
+
+    QPainter painter(this);
+    const QFont font("MS Shell Dlg", 12);
+    painter.setFont(font);
+    painter.drawText(this->width() - 14, 24, QString::number(numItems));
+
+}