PageRenderTime 21ms CodeModel.GetById 12ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/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
19#ifndef OVERLAYBUTTON_H
20#define OVERLAYBUTTON_H
21
22#include <QPushButton>
23#include <QAbstractItemView>
24#include <QTimer>
25
26#include "DllMacro.h"
27
28class DLLEXPORT OverlayButton : public QPushButton
29{
30Q_OBJECT
31Q_PROPERTY( qreal opacity READ opacity WRITE setOpacity )
32
33public:
34    OverlayButton( QWidget* parent );
35    ~OverlayButton();
36
37    qreal opacity() const { return m_opacity; }
38    void setOpacity( qreal opacity );
39
40    QString text() const { return m_text; }
41    void setText( const QString& text );
42
43    bool shown() const;
44
45public slots:
46    void show( int timeoutSecs = 0 );
47    void hide();
48
49protected:
50//    void changeEvent( QEvent* e );
51    void paintEvent( QPaintEvent* event );
52
53private:
54    QString m_text;
55    qreal m_opacity;
56
57    QWidget* m_parent;
58    QTimer m_timer;
59};
60
61#endif // OVERLAYBUTTON_H