DefaultMainWindow.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * NICE-Core - efficient algebra and computer vision methods
  3. * - libimagedisplay - A library for image and video display
  4. * See file License for license information.
  5. */
  6. #ifndef _IMAGEDISPLAY_DEFAULTMAINWINDOW_H
  7. #define _IMAGEDISPLAY_DEFAULTMAINWINDOW_H
  8. #include <qwidget.h>
  9. #include <qtimer.h>
  10. #include <memory>
  11. namespace NICE {
  12. /**
  13. * A simple Qt widget used by \c QtFramework as default main window
  14. * if no custom widget is specified.
  15. *
  16. * @author Ferid Bajramovic
  17. *
  18. * @note
  19. * This class is experimental and might change in the future.
  20. */
  21. class DefaultMainWindow : public QWidget {
  22. Q_OBJECT;
  23. public:
  24. /**
  25. * Constructor.
  26. * @param title If not NULL, this will be used as the main window's caption.
  27. */
  28. DefaultMainWindow(const char* title = NULL);
  29. //! Destructor
  30. virtual ~DefaultMainWindow();
  31. protected:
  32. /**
  33. * Override this method to handle timer events.
  34. * @param nextSleepMS Change this value to change the delay until
  35. * the next call to \c loop(). Set to -1 to stop the timer, so
  36. * \c loop will not be called any more.
  37. */
  38. virtual void loop(int& nextSleepMS);
  39. private slots:
  40. //! receives timer signals
  41. void timerSlot();
  42. private:
  43. //! A timer to call \c loop()
  44. std::auto_ptr<QTimer> timer;
  45. //! The current delay time of the timer.
  46. int timerIntervalMS;
  47. };
  48. } // namespace
  49. #endif /* _IMAGEDISPLAY_DEFAULTMAINWINDOW_H */