Introduce SimpleTextFloat
Introduce the new class SimpleTextFloat which simply shows a text and that works like a pseudo tool tip with a narrow margin. It was extracted from TextFloat to adhere to the single responsibility principle. The new class is used by: * Fader: display the current volume when moving the fader * Knob: display the current value when the knob is moved * PianoRoll: display the current value when setting the note volume and panning Add stylings for the new widget in style.css.
This commit is contained in:
@@ -55,10 +55,11 @@
|
||||
|
||||
#include "AutomatableModelView.h"
|
||||
|
||||
|
||||
namespace lmms::gui
|
||||
{
|
||||
|
||||
class TextFloat;
|
||||
class SimpleTextFloat;
|
||||
|
||||
|
||||
class LMMS_EXPORT Fader : public QWidget, public FloatModelView
|
||||
@@ -164,7 +165,7 @@ private:
|
||||
int m_moveStartPoint;
|
||||
float m_startValue;
|
||||
|
||||
static TextFloat * s_textFloat;
|
||||
static SimpleTextFloat * s_textFloat;
|
||||
|
||||
QColor m_peakGreen;
|
||||
QColor m_peakRed;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace lmms::gui
|
||||
{
|
||||
|
||||
|
||||
class TextFloat;
|
||||
class SimpleTextFloat;
|
||||
|
||||
enum knobTypes
|
||||
{
|
||||
@@ -175,7 +175,7 @@ private:
|
||||
}
|
||||
|
||||
|
||||
static TextFloat * s_textFloat;
|
||||
static SimpleTextFloat * s_textFloat;
|
||||
|
||||
QString m_label;
|
||||
bool m_isHtmlLabel;
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace gui
|
||||
|
||||
class ComboBox;
|
||||
class PositionLine;
|
||||
class TextFloat;
|
||||
class SimpleTextFloat;
|
||||
class TimeLineWidget;
|
||||
|
||||
|
||||
@@ -345,7 +345,7 @@ private:
|
||||
|
||||
static std::array<PianoRollKeyTypes, 12> prKeyOrder;
|
||||
|
||||
static TextFloat * s_textFloat;
|
||||
static SimpleTextFloat * s_textFloat;
|
||||
|
||||
ComboBoxModel m_zoomingModel;
|
||||
ComboBoxModel m_zoomingYModel;
|
||||
|
||||
61
include/SimpleTextFloat.h
Normal file
61
include/SimpleTextFloat.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* TextFloat.h - class textFloat, a floating text-label
|
||||
*
|
||||
* Copyright (c) 2023 LMMS team
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* 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 2 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 (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SIMPLE_TEXT_FLOAT_H
|
||||
#define SIMPLE_TEXT_FLOAT_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "lmms_export.h"
|
||||
|
||||
class QLabel;
|
||||
|
||||
namespace lmms::gui
|
||||
{
|
||||
|
||||
class LMMS_EXPORT SimpleTextFloat : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SimpleTextFloat();
|
||||
~SimpleTextFloat() override = default;
|
||||
|
||||
void setText( const QString & _text );
|
||||
|
||||
void setVisibilityTimeOut( int _msecs );
|
||||
|
||||
void moveGlobal( QWidget * _w, const QPoint & _offset )
|
||||
{
|
||||
move( _w->mapToGlobal( QPoint( 0, 0 ) ) + _offset );
|
||||
}
|
||||
|
||||
private:
|
||||
QLabel * m_textLabel;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lmms::gui
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user