made the hog count thingy prettier when on low space... have fun squishing hogs!
--- a/QTfrontend/ui/widget/hedgehogerWidget.cpp Mon Apr 30 23:14:40 2012 +0200
+++ b/QTfrontend/ui/widget/hedgehogerWidget.cpp Tue May 01 00:22:10 2012 +0200
@@ -35,7 +35,7 @@
} else numItems = 4;
pOurFrameTeams->overallHedgehogs += numItems;*/
- this->setMinimumWidth(20);
+ this->setMinimumWidth(48);
}
void CHedgehogerWidget::incItems()
@@ -83,12 +83,30 @@
{
Q_UNUSED(event);
- if (this->width() >= 11 * numItems + 28)
+ if (this->width() >= 11 * numItems + 26)
ItemNum::paintEvent(event);
+ else
+ {
+ int width = this->width() - 38;
+ QPainter painter(this);
+
+ for(int i=0; i<numItems; i++)
+ {
+ QRect target((i * width) / (numItems -1), i % 2, 25, 35);
+ if (enabled)
+ {
+ painter.drawImage(target, m_im);
+ }
+ else
+ {
+ painter.drawImage(target, m_img);
+ }
+ }
+ }
QPainter painter(this);
const QFont font("MS Shell Dlg", 12);
painter.setFont(font);
- painter.drawText(this->width() - 14, 24, QString::number(numItems));
+ painter.drawText(this->width() - 12, 24, QString::number(numItems));
}
--- a/QTfrontend/ui/widget/itemNum.h Mon Apr 30 23:14:40 2012 +0200
+++ b/QTfrontend/ui/widget/itemNum.h Tue May 01 00:22:10 2012 +0200
@@ -32,13 +32,12 @@
unsigned char getItemsNum() const;
void setItemsNum(const unsigned char num);
- private:
+ protected:
QImage m_im;
QImage m_img;
bool infinityState;
bool enabled;
- protected:
ItemNum(const QImage& im, const QImage& img, QWidget * parent, unsigned char min=2, unsigned char max=8);
virtual QSize sizeHint () const;
virtual ~ItemNum()=0;