22#include " ui_alertwidget.h"
33#include " changealarmdialog.h"
44
5-
65#include < iostream>
76
87int getMsecs (const QTime& t)
@@ -126,6 +125,7 @@ void alertwidget::onTickCheck()
126125 blinking = true ;
127126 player->play ();
128127 ui->stopButton ->show ();
128+ ui->stopButton ->setEnabled (true );
129129}
130130
131131void alertwidget::blink ()
@@ -137,11 +137,15 @@ void alertwidget::blink()
137137 " background-color: qlineargradient(spread:pad, x1:0.622, y1:0.0113636,"
138138 " x2:1, y2:0, stop:0 rgb(183, 106, 56), stop:0.626368 rgba(0, 0, 0, 0));"
139139 " border-radius: 30px;"
140+ " border: 0px;"
140141 " }" );
141142 }
142143 else
143144 {
144- ui->widget ->setStyleSheet (" QWidget { background-color: rgb(113,113,113); }" );
145+ ui->widget ->setStyleSheet (" QWidget {"
146+ " background-color: rgb(113,113,113);"
147+ " border: 0px; "
148+ " }" );
145149 }
146150 blinky = !blinky;
147151}
@@ -187,14 +191,16 @@ void alertwidget::ShowContextMenu(const QPoint &pos)
187191{
188192 QMenu contextMenu (tr (" Context menu" ), this );
189193
190- QAction action1 (" Delete alarm" , this );
191- QAction action2 (" Change alarm" , this );
192- connect (&action1, SIGNAL (triggered ()), this , SLOT (closeAlarm ()));
193- connect (&action2, SIGNAL (triggered ()), this , SLOT (changeAlarm ()));
194- contextMenu.addAction (&action1);
195- contextMenu.addAction (&action2);
194+ QAction actionDelete (" Delete alarm" , this );
195+ QAction actionChange (" Change alarm" , this );
196+
197+ connect (&actionDelete, SIGNAL (triggered ()), this , SLOT (closeAlarm ()));
198+ connect (&actionChange, SIGNAL (triggered ()), this , SLOT (changeAlarm ()));
199+ contextMenu.addAction (&actionDelete);
200+ contextMenu.addAction (&actionChange);
196201
197202 contextMenu.exec (mapToGlobal (pos));
203+
198204}
199205
200206void alertwidget::setAlarm (int msecs, const QString & _name)
@@ -209,15 +215,12 @@ void alertwidget::setAlarm(int msecs, const QString & _name)
209215
210216}
211217
212-
213218void alertwidget::mousePressEvent (QMouseEvent *e)
214219{
215220 if (e->button () == Qt::RightButton)
216221 {
217222 player->stop ();
218-
219223 ShowContextMenu (e->pos ());
220- // emit closeAlarm();
221224 }
222225}
223226
0 commit comments