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:
@@ -15,8 +15,10 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
add_subdirectory(audiomonitor)
|
add_subdirectory(audiomonitor)
|
||||||
|
add_subdirectory(clickablelabel)
|
||||||
add_subdirectory(columnedgridlayout)
|
add_subdirectory(columnedgridlayout)
|
||||||
add_subdirectory(flowlayout)
|
add_subdirectory(flowlayout)
|
||||||
|
add_subdirectory(focusablelineedit)
|
||||||
add_subdirectory(footagecombobox)
|
add_subdirectory(footagecombobox)
|
||||||
add_subdirectory(menu)
|
add_subdirectory(menu)
|
||||||
add_subdirectory(nodeview)
|
add_subdirectory(nodeview)
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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/focusablelineedit/focusablelineedit.h
|
||||||
|
widget/focusablelineedit/focusablelineedit.cpp
|
||||||
|
PARENT_SCOPE
|
||||||
|
)
|
||||||
+4
-4
@@ -18,17 +18,17 @@
|
|||||||
|
|
||||||
***/
|
***/
|
||||||
|
|
||||||
#include "sliderlineedit.h"
|
#include "focusablelineedit.h"
|
||||||
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
SliderLineEdit::SliderLineEdit(QWidget *parent) :
|
FocusableLineEdit::FocusableLineEdit(QWidget *parent) :
|
||||||
QLineEdit(parent)
|
QLineEdit(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SliderLineEdit::keyPressEvent(QKeyEvent *e)
|
void FocusableLineEdit::keyPressEvent(QKeyEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->key()) {
|
switch (e->key()) {
|
||||||
case Qt::Key_Return:
|
case Qt::Key_Return:
|
||||||
@@ -43,7 +43,7 @@ void SliderLineEdit::keyPressEvent(QKeyEvent *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SliderLineEdit::focusOutEvent(QFocusEvent *e)
|
void FocusableLineEdit::focusOutEvent(QFocusEvent *e)
|
||||||
{
|
{
|
||||||
QLineEdit::focusOutEvent(e);
|
QLineEdit::focusOutEvent(e);
|
||||||
|
|
||||||
+2
-2
@@ -23,11 +23,11 @@
|
|||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
class SliderLineEdit : public QLineEdit
|
class FocusableLineEdit : public QLineEdit
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SliderLineEdit(QWidget* parent);
|
FocusableLineEdit(QWidget* parent = nullptr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Confirmed();
|
void Confirmed();
|
||||||
@@ -24,8 +24,6 @@ set(OLIVE_SOURCES
|
|||||||
widget/slider/sliderbase.cpp
|
widget/slider/sliderbase.cpp
|
||||||
widget/slider/sliderlabel.h
|
widget/slider/sliderlabel.h
|
||||||
widget/slider/sliderlabel.cpp
|
widget/slider/sliderlabel.cpp
|
||||||
widget/slider/sliderlineedit.h
|
|
||||||
widget/slider/sliderlineedit.cpp
|
|
||||||
widget/slider/stringslider.h
|
widget/slider/stringslider.h
|
||||||
widget/slider/stringslider.cpp
|
widget/slider/stringslider.cpp
|
||||||
widget/slider/timeslider.h
|
widget/slider/timeslider.h
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ SliderBase::SliderBase(Mode mode, QWidget *parent) :
|
|||||||
|
|
||||||
addWidget(label_);
|
addWidget(label_);
|
||||||
|
|
||||||
editor_ = new SliderLineEdit(this);
|
editor_ = new FocusableLineEdit(this);
|
||||||
addWidget(editor_);
|
addWidget(editor_);
|
||||||
|
|
||||||
connect(label_, SIGNAL(drag_start()), this, SLOT(LabelPressed()));
|
connect(label_, SIGNAL(drag_start()), this, SLOT(LabelPressed()));
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
|
|
||||||
#include "sliderlabel.h"
|
#include "sliderlabel.h"
|
||||||
#include "sliderlineedit.h"
|
#include "widget/focusablelineedit/focusablelineedit.h"
|
||||||
|
|
||||||
class SliderBase : public QStackedWidget
|
class SliderBase : public QStackedWidget
|
||||||
{
|
{
|
||||||
@@ -73,7 +73,7 @@ private:
|
|||||||
|
|
||||||
SliderLabel* label_;
|
SliderLabel* label_;
|
||||||
|
|
||||||
SliderLineEdit* editor_;
|
FocusableLineEdit* editor_;
|
||||||
|
|
||||||
QVariant value_;
|
QVariant value_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user