2011-03-03 18:29:20 +01:00
|
|
|
/* ============================================================
|
2017-08-25 17:11:29 +02:00
|
|
|
* Falkon - Qt web browser
|
2014-01-11 16:11:42 +01:00
|
|
|
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
|
2011-03-03 18:29:20 +01:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
2011-03-03 15:24:59 +01:00
|
|
|
#ifndef CLICKABLELABEL_H
|
|
|
|
#define CLICKABLELABEL_H
|
|
|
|
|
|
|
|
#include <QLabel>
|
2013-04-27 13:51:08 +02:00
|
|
|
#include <QIcon>
|
2011-03-03 15:24:59 +01:00
|
|
|
|
2014-02-26 20:03:20 +01:00
|
|
|
#include "qzcommon.h"
|
2012-02-29 18:33:50 +01:00
|
|
|
|
|
|
|
class QMouseEvent;
|
|
|
|
|
2017-08-25 17:11:29 +02:00
|
|
|
class FALKON_EXPORT ClickableLabel : public QLabel
|
2011-03-03 15:24:59 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2011-09-11 19:15:06 +02:00
|
|
|
Q_PROPERTY(QSize fixedsize READ size WRITE setFixedSize)
|
|
|
|
Q_PROPERTY(int fixedwidth READ width WRITE setFixedWidth)
|
|
|
|
Q_PROPERTY(int fixedheight READ height WRITE setFixedHeight)
|
2013-01-21 22:39:20 +01:00
|
|
|
Q_PROPERTY(QString themeIcon READ themeIcon WRITE setThemeIcon)
|
2013-04-27 13:51:08 +02:00
|
|
|
Q_PROPERTY(QIcon fallbackIcon READ fallbackIcon WRITE setFallbackIcon)
|
2011-09-11 19:15:06 +02:00
|
|
|
|
2011-03-03 15:24:59 +01:00
|
|
|
public:
|
2011-03-17 17:03:04 +01:00
|
|
|
explicit ClickableLabel(QWidget* parent = 0);
|
2011-03-03 15:24:59 +01:00
|
|
|
|
2013-01-21 22:39:20 +01:00
|
|
|
QString themeIcon() const;
|
2013-04-26 23:40:54 +02:00
|
|
|
void setThemeIcon(const QString &name);
|
|
|
|
|
2013-04-27 13:51:08 +02:00
|
|
|
QIcon fallbackIcon() const;
|
2016-01-24 13:03:16 +01:00
|
|
|
void setFallbackIcon(const QIcon &fallbackIcon);
|
2013-01-21 22:39:20 +01:00
|
|
|
|
2018-02-25 13:33:07 +01:00
|
|
|
Q_SIGNALS:
|
2011-03-03 15:24:59 +01:00
|
|
|
void clicked(QPoint);
|
2012-01-18 16:52:30 +01:00
|
|
|
void middleClicked(QPoint);
|
2011-03-03 15:24:59 +01:00
|
|
|
|
|
|
|
private:
|
2016-01-24 13:03:16 +01:00
|
|
|
void updateIcon();
|
|
|
|
|
|
|
|
void resizeEvent(QResizeEvent *ev);
|
2011-12-12 21:14:43 +01:00
|
|
|
void mouseReleaseEvent(QMouseEvent* ev);
|
2011-03-03 15:24:59 +01:00
|
|
|
|
2013-01-21 22:39:20 +01:00
|
|
|
QString m_themeIcon;
|
2016-01-24 13:03:16 +01:00
|
|
|
QIcon m_fallbackIcon;
|
2013-01-21 22:39:20 +01:00
|
|
|
|
2011-03-03 15:24:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CLICKABLELABEL_H
|