What i want to do is to make a simple thing...
A combobox which have option ( off, 5 minutes, 10 minutes, 30 minutes, 1 hour ) and if is for example choosed to 1 hour every hour ( 17:00, 18:00 and all of that ) show a ballon that the time now is ( current_time ).

So i have some ideas but i do not know hot to put it..

Qt Code:
  1. QTimer *timer = new QTimer(this);
  2. this->updateTimeLabel();
  3. timer->start(1000);
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. void roloi::updateTimeLabel()
  2. {
  3. //this basicaly takes the first 5 characters of the time string, starting from right to left
  4. QString clockSharp = QTime::currentTime().toString().right(5);
  5. //set a new pallete to color our label
  6. QColor fg;
  7. fg.setNamedColor("black");
  8. QPalette pal = ui->timeLabel->palette();
  9.  
  10. if (reminder.left(1) != "C" && reminder.left(1) != "0")
  11. {
  12. switch (reminder.toInt()) {
  13. case 1:
  14. if (clockSharp=="00:00" || clockSharp=="05:00" || clockSharp=="10:00" || clockSharp=="15:00" || clockSharp=="20:00" || clockSharp=="25:00" || clockSharp=="30:00" || clockSharp=="35:00" || clockSharp=="40:00" || clockSharp=="45:00" || clockSharp=="50:00" || clockSharp=="55:00") {
  15. fg = sharpColor;
  16. if (showPop) showBaloon();
  17. }
  18. break;
  19. case 2:
  20. if (clockSharp=="00:00" || clockSharp=="10:00" || clockSharp=="20:00" || clockSharp=="30:00" || clockSharp=="40:00" || clockSharp=="50:00" ) {
  21. fg = sharpColor;
  22. if (showPop) showBaloon();
  23. }
  24. break;
  25. case 3:
  26. if (clockSharp=="00:00" || clockSharp=="15:00" || clockSharp=="30:00" || clockSharp=="45:00" ) {
  27. fg = sharpColor;
  28. if (showPop) showBaloon();
  29. }
  30. break;
  31. case 4:
  32. if (clockSharp=="00:00" || clockSharp=="30:00" ) {
  33. fg = sharpColor;
  34. if (showPop) showBaloon();
  35. }
  36. break;
  37. case 5:
  38. if (clockSharp=="00:00" ) {
  39. fg = sharpColor;
  40. if (showPop) showBaloon();
  41. }
  42. break;
  43. }
  44. }
  45. pal.setColor(QPalette::Foreground,fg);
  46. ui->timeLabel->setPalette(pal);
  47. ui->timeLabel->setText(QTime::currentTime().toString());
  48. trayIcon->setToolTip("Clock | " + ui->timeLabel->text() + "\n\nDouble click to show the window.\nMiddle click to exit the application.");
  49. this->setWindowTitle("Clock | " + ui->timeLabel->text());
  50.  
  51. if (reminder.left(1)=="C" && reminder.length() > 1 && !cstTimer->isActive() && QTime::currentTime().toString().right(2) == "00")
  52. {
  53. cstTimer = new QTimer(this);
  54. connect(cstTimer, SIGNAL(timeout()), this, SLOT(customReminder()));
  55. cstTimer->start(60000 * reminder.right(reminder.length()-1).toInt());
  56. } else if (reminder.left(1)!="C" && cstTimer->isActive()){
  57. cstTimer->stop();
  58. }
  59. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. void roloi::showBaloon()
  2. {
  3. trayIcon->showMessage("Clock alert", "It's " + QTime::currentTime().toString().left(5) + ".",
  4. QSystemTrayIcon::Information, 5000);
  5.  
  6. }
To copy to clipboard, switch view to plain text mode