/src/libtomahawk/widgets/OverlayButton.h

http://github.com/tomahawk-player/tomahawk · C Header · 61 lines · 30 code · 13 blank · 18 comment · 0 complexity · 79a1d118a54107cd878885e7745bb2c3 MD5 · raw file

  1. /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
  2. *
  3. * Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
  4. *
  5. * Tomahawk is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * Tomahawk is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef OVERLAYBUTTON_H
  19. #define OVERLAYBUTTON_H
  20. #include <QPushButton>
  21. #include <QAbstractItemView>
  22. #include <QTimer>
  23. #include "DllMacro.h"
  24. class DLLEXPORT OverlayButton : public QPushButton
  25. {
  26. Q_OBJECT
  27. Q_PROPERTY( qreal opacity READ opacity WRITE setOpacity )
  28. public:
  29. OverlayButton( QWidget* parent );
  30. ~OverlayButton();
  31. qreal opacity() const { return m_opacity; }
  32. void setOpacity( qreal opacity );
  33. QString text() const { return m_text; }
  34. void setText( const QString& text );
  35. bool shown() const;
  36. public slots:
  37. void show( int timeoutSecs = 0 );
  38. void hide();
  39. protected:
  40. // void changeEvent( QEvent* e );
  41. void paintEvent( QPaintEvent* event );
  42. private:
  43. QString m_text;
  44. qreal m_opacity;
  45. QWidget* m_parent;
  46. QTimer m_timer;
  47. };
  48. #endif // OVERLAYBUTTON_H