mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Move signallabel code out from its header
This commit is contained in:
parent
89d7b7db87
commit
1c7f397f1b
|
@ -177,7 +177,8 @@ SOURCES += \
|
||||||
src/providers/irc/ircserver.cpp \
|
src/providers/irc/ircserver.cpp \
|
||||||
src/providers/irc/ircchannel2.cpp \
|
src/providers/irc/ircchannel2.cpp \
|
||||||
src/util/streamlink.cpp \
|
src/util/streamlink.cpp \
|
||||||
src/providers/twitch/twitchhelpers.cpp
|
src/providers/twitch/twitchhelpers.cpp \
|
||||||
|
src/widgets/helper/signallabel.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
src/precompiled_header.hpp \
|
src/precompiled_header.hpp \
|
||||||
|
|
34
src/widgets/helper/signallabel.cpp
Normal file
34
src/widgets/helper/signallabel.cpp
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
#include "widgets/helper/signallabel.hpp"
|
||||||
|
|
||||||
|
SignalLabel::SignalLabel(QWidget *parent, Qt::WindowFlags f)
|
||||||
|
: QLabel(parent, f)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SignalLabel::mouseDoubleClickEvent(QMouseEvent *ev)
|
||||||
|
{
|
||||||
|
emit this->mouseDoubleClick(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SignalLabel::mousePressEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::LeftButton) {
|
||||||
|
emit mouseDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SignalLabel::mouseReleaseEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::LeftButton) {
|
||||||
|
emit mouseUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SignalLabel::mouseMoveEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
event->ignore();
|
||||||
|
}
|
|
@ -10,11 +10,8 @@ class SignalLabel : public QLabel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SignalLabel(QWidget *parent = 0, Qt::WindowFlags f = 0)
|
explicit SignalLabel(QWidget *parent = nullptr, Qt::WindowFlags f = 0);
|
||||||
: QLabel(parent, f)
|
~SignalLabel() override = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
virtual ~SignalLabel() = default;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void mouseDoubleClick(QMouseEvent *ev);
|
void mouseDoubleClick(QMouseEvent *ev);
|
||||||
|
@ -23,31 +20,8 @@ signals:
|
||||||
void mouseUp();
|
void mouseUp();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void mouseDoubleClickEvent(QMouseEvent *ev) override
|
void mouseDoubleClickEvent(QMouseEvent *ev) override;
|
||||||
{
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
emit this->mouseDoubleClick(ev);
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
}
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
virtual void mousePressEvent(QMouseEvent *event) override
|
|
||||||
{
|
|
||||||
if (event->button() == Qt::LeftButton) {
|
|
||||||
emit mouseDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
event->ignore();
|
|
||||||
}
|
|
||||||
|
|
||||||
void mouseReleaseEvent(QMouseEvent *event) override
|
|
||||||
{
|
|
||||||
if (event->button() == Qt::LeftButton) {
|
|
||||||
emit mouseUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
event->ignore();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void mouseMoveEvent(QMouseEvent *event) override
|
|
||||||
{
|
|
||||||
event->ignore();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue