diff --git a/NumberDisplay.cpp b/NumberDisplay.cpp index 3b1cdff..1deed91 100644 --- a/NumberDisplay.cpp +++ b/NumberDisplay.cpp @@ -1,8 +1,9 @@ #include "MainWindow.h" #include "NumberDisplay.h" -NumberDisplay::NumberDisplay (QWidget *parent, uint w, uint startpx) : PixWidget (parent) +NumberDisplay::NumberDisplay (QWidget *parent, TimeDisplay *td,uint w, uint startpx) : PixWidget (parent) { + m_td = td; m_w = w; m_startpx = startpx; @@ -53,6 +54,8 @@ NumberDisplay::mousePressEvent (QMouseEvent *event) void NumberDisplay::mouseReleaseEvent (QMouseEvent *event) { +// TimeDisplay *td = dynamic_cast(parent()); emit clicked(); + m_td->drawMinus (); } diff --git a/NumberDisplay.h b/NumberDisplay.h index c611932..6e029bb 100644 --- a/NumberDisplay.h +++ b/NumberDisplay.h @@ -1,13 +1,16 @@ #ifndef __NUMBERDISPLAY_H__ #define __NUMBERDISPLAY_H__ +class TimeDisplay; + #include "PixWidget.h" +//#include "TimeDisplay.h" class NumberDisplay : public PixWidget { Q_OBJECT public: - NumberDisplay (QWidget *parent, uint, uint); + NumberDisplay (QWidget *parent, TimeDisplay *td, uint, uint); ~NumberDisplay (); void setNumber (uint, uint); @@ -23,6 +26,7 @@ class NumberDisplay : public PixWidget int m_w; int m_startpx; + TimeDisplay *m_td; uint m_n1; uint m_n2; }; diff --git a/TimeDisplay.cpp b/TimeDisplay.cpp index f5f70fb..8cf2a3d 100644 --- a/TimeDisplay.cpp +++ b/TimeDisplay.cpp @@ -24,9 +24,9 @@ TimeDisplay::TimeDisplay (QWidget *parent, int time) : PixWidget (parent) m_number_sec->move (78-37, 0); */ - m_number_min = new NumberDisplay (parent, 24, 0); + m_number_min = new NumberDisplay (parent, this,24, 0); m_number_min->move (37+10, 26); - m_number_sec = new NumberDisplay (parent, 24, 0); + m_number_sec = new NumberDisplay (parent, this,24, 0); m_number_sec->move (78, 26); connect (m_number_min, SIGNAL(clicked()), parent, SLOT(toggleTime())); @@ -95,5 +95,6 @@ void TimeDisplay::mouseReleaseEvent (QMouseEvent *event) { emit clicked(); + drawMinus (); } diff --git a/TimeDisplay.h b/TimeDisplay.h index 6099a19..f0f878b 100644 --- a/TimeDisplay.h +++ b/TimeDisplay.h @@ -1,6 +1,8 @@ #ifndef __TIMEDISPLAY_H__ #define __TIMEDISPLAY_H__ +class TimeDisplay; + #include "PixWidget.h" #include "NumberDisplay.h" @@ -11,6 +13,7 @@ class TimeDisplay : public PixWidget TimeDisplay (QWidget *parent, int time); ~TimeDisplay (); void setTime (int); + void drawMinus(); public slots: void setPixmaps (Skin *skin); signals: @@ -19,7 +22,6 @@ class TimeDisplay : public PixWidget protected: void mousePressEvent (QMouseEvent *event); void mouseReleaseEvent (QMouseEvent *event); - void drawMinus(); int m_time; NumberDisplay *m_number_min; NumberDisplay *m_number_sec;