~ubuntu-branches/ubuntu/vivid/muon/vivid-proposed

1.4.38 by Jonathan Riddell
Import upstream version 5.2.2-1
1
/*
2
    Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
3
4
    This library is free software; you can redistribute it and/or modify it
5
    under the terms of the GNU Library General Public License as published by
6
    the Free Software Foundation; either version 2 of the License, or (at your
7
    option) any later version.
8
9
    This library is distributed in the hope that it will be useful, but WITHOUT
10
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
12
    License for more details.
13
14
    You should have received a copy of the GNU Library General Public License
15
    along with this library; see the file COPYING.LIB.  If not, write to the
16
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17
    02110-1301, USA.
18
*/
19
20
#ifndef SCREENSHOTOVERLAY_H
21
#define SCREENSHOTOVERLAY_H
22
23
#include <QtCore/QPointer>
24
#include <QtWidgets/QWidget>
25
#include <QPixmap>
26
27
class QMouseEvent;
28
class QScrollArea;
29
30
class ClickableLabel;
31
32
/**
33
 * Class to display a screenshot as an overlay of a widget
34
 */
35
class ScreenShotOverlay : public QWidget
36
{
37
  Q_OBJECT
38
  public:
39
    /**
40
     * Create an overlay widget on @p baseWidget for the image at @p url.
41
     * @p baseWidget must not be null.
42
     * @p parent must not be equal to @p baseWidget
43
     */
44
    explicit ScreenShotOverlay(const QString &url, QWidget *baseWidget, QWidget *parent = 0);
45
    ~ScreenShotOverlay();
46
47
  protected:
48
    bool eventFilter( QObject *object, QEvent *event );
49
    virtual void mousePressEvent(QMouseEvent *event);
50
51
  private slots:
52
    void fadeIn();
53
54
  private:
55
    QPointer<QWidget> mBaseWidget;
56
    QScrollArea *m_scrollArea;
57
    QPixmap m_screenshot;
58
    ClickableLabel *m_screenshotL;
59
60
    void reposition();
61
62
  signals:
63
    void clicked();
64
};
65
66
#endif