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
-2
View File
@@ -24,8 +24,6 @@ set(OLIVE_SOURCES
widget/slider/sliderbase.cpp
widget/slider/sliderlabel.h
widget/slider/sliderlabel.cpp
widget/slider/sliderlineedit.h
widget/slider/sliderlineedit.cpp
widget/slider/stringslider.h
widget/slider/stringslider.cpp
widget/slider/timeslider.h
+1 -1
View File
@@ -40,7 +40,7 @@ SliderBase::SliderBase(Mode mode, QWidget *parent) :
addWidget(label_);
editor_ = new SliderLineEdit(this);
editor_ = new FocusableLineEdit(this);
addWidget(editor_);
connect(label_, SIGNAL(drag_start()), this, SLOT(LabelPressed()));
+2 -2
View File
@@ -24,7 +24,7 @@
#include <QStackedWidget>
#include "sliderlabel.h"
#include "sliderlineedit.h"
#include "widget/focusablelineedit/focusablelineedit.h"
class SliderBase : public QStackedWidget
{
@@ -73,7 +73,7 @@ private:
SliderLabel* label_;
SliderLineEdit* editor_;
FocusableLineEdit* editor_;
QVariant value_;
-51
View File
@@ -1,51 +0,0 @@
/***
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/>.
***/
#include "sliderlineedit.h"
#include <QKeyEvent>
SliderLineEdit::SliderLineEdit(QWidget *parent) :
QLineEdit(parent)
{
}
void SliderLineEdit::keyPressEvent(QKeyEvent *e)
{
switch (e->key()) {
case Qt::Key_Return:
case Qt::Key_Enter:
emit Confirmed();
break;
case Qt::Key_Escape:
emit Cancelled();
break;
default:
QLineEdit::keyPressEvent(e);
}
}
void SliderLineEdit::focusOutEvent(QFocusEvent *e)
{
QLineEdit::focusOutEvent(e);
emit Confirmed();
}
-45
View File
@@ -1,45 +0,0 @@
/***
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/>.
***/
#ifndef SLIDERLINEEDIT_H
#define SLIDERLINEEDIT_H
#include <QLineEdit>
class SliderLineEdit : public QLineEdit
{
Q_OBJECT
public:
SliderLineEdit(QWidget* parent);
signals:
void Confirmed();
void Cancelled();
protected:
void keyPressEvent(QKeyEvent *) override;
void focusOutEvent(QFocusEvent *) override;
};
#endif // SLIDERLINEEDIT_H