theshell/shell/clickablelabel.h

55 lines
1.5 KiB
C
Raw Normal View History

2017-08-05 15:20:02 +10:00
/****************************************
2018-01-08 18:26:23 +11:00
*
2017-08-05 15:20:02 +10:00
* theShell - Desktop Environment
2018-01-08 18:26:23 +11:00
* Copyright (C) 2018 Victor Tran
2017-08-05 15:20:02 +10: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/>.
2018-01-08 18:26:23 +11:00
*
2017-08-05 15:20:02 +10:00
* *************************************/
2016-03-17 19:46:40 +11:00
#ifndef CLICKABLELABEL_H
#define CLICKABLELABEL_H
#include <QLabel>
#include <QMouseEvent>
2016-03-29 17:42:24 +11:00
#include <QStyle>
#include <QApplication>
2016-03-17 19:46:40 +11:00
class ClickableLabel : public QLabel
{
Q_OBJECT
public:
ClickableLabel(QWidget* parent);
2016-03-29 17:42:24 +11:00
void setShowDisabled(bool showDisabled);
bool showDisabled();
2016-03-17 19:46:40 +11:00
signals:
void clicked();
2017-01-12 01:00:27 +11:00
void dragging(int x, int y);
void mouseReleased();
2016-03-17 19:46:40 +11:00
private:
void mousePressEvent(QMouseEvent* event);
2016-10-15 22:26:43 +11:00
void mouseReleaseEvent(QMouseEvent* event);
2017-01-12 01:00:27 +11:00
void mouseMoveEvent(QMouseEvent* event);
2016-03-29 17:42:24 +11:00
//void paintEvent(QPaintEvent *event);
bool isShowDisabled = false;
2017-01-12 01:00:27 +11:00
bool isClicked = false;
bool didDrag = false;
2016-03-17 19:46:40 +11:00
};
#endif // CLICKABLELABEL_H