moved slider's focusable line edit to a separate distinct reusable widget

Some of the widgets designed for Slider have uses elsewhere so now they have
been moved to allow more generic usage.
This commit is contained in:
itsmattkc
2019-12-08 15:13:55 +11:00
parent 50f4e8767d
commit 2207aa3fd5
10 changed files with 101 additions and 11 deletions
+22
View File
@@ -0,0 +1,22 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2019 Olive Team
#
# 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/>.
set(OLIVE_SOURCES
${OLIVE_SOURCES}
widget/clickablelabel/clickablelabel.h
widget/clickablelabel/clickablelabel.cpp
PARENT_SCOPE
)
@@ -0,0 +1,23 @@
#include "clickablelabel.h"
ClickableLabel::ClickableLabel(const QString &text, QWidget *parent) :
QLabel(text, parent)
{
}
ClickableLabel::ClickableLabel(QWidget *parent) :
QLabel(parent)
{
}
void ClickableLabel::mouseReleaseEvent(QMouseEvent *)
{
if (underMouse()) {
emit MouseClicked();
}
}
void ClickableLabel::mouseDoubleClickEvent(QMouseEvent *)
{
emit MouseDoubleClicked();
}
@@ -0,0 +1,23 @@
#ifndef CLICKABLELABEL_H
#define CLICKABLELABEL_H
#include <QLabel>
class ClickableLabel : public QLabel
{
Q_OBJECT
public:
ClickableLabel(const QString& text, QWidget* parent = nullptr);
ClickableLabel(QWidget* parent = nullptr);
protected:
virtual void mouseReleaseEvent(QMouseEvent* event) override;
virtual void mouseDoubleClickEvent(QMouseEvent* event) override;
signals:
void MouseClicked();
void MouseDoubleClicked();
};
#endif // CLICKABLELABEL_H