mirror of
https://github.com/LMMS/lmms.git
synced 2026-05-19 04:06:17 -04:00
Improve readability of text floats
Improve the readability of text floats by removing the hard coded pixel font size. The widget is now composed of three QLabels which are used to display the title, text and pixmap. Remove the methods paintEvent and updateSize because the widget is now updated automatically whenever the QLabels change state. Merge both versions of TextFloat::displayMessage because one of them was only called by the other. The default constructor of TextFloat now delegates to the "full" constructor. The latter is private because it is only used from within displayMessage. The methods setTitle, setText and setPixmap show/hide their corresponding labels depending on whether there is text or a pixmap to show. Adjust the class Fader so that the text float is shown to the right of the fader. Otherwise the new implementation would have covered the fader while it is being moved.
This commit is contained in:
@@ -27,10 +27,11 @@
|
||||
#define TEXT_FLOAT_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPixmap>
|
||||
|
||||
#include "lmms_export.h"
|
||||
|
||||
class QLabel;
|
||||
|
||||
namespace lmms::gui
|
||||
{
|
||||
|
||||
@@ -47,11 +48,6 @@ public:
|
||||
|
||||
void setVisibilityTimeOut( int _msecs );
|
||||
|
||||
|
||||
static TextFloat * displayMessage( const QString & _msg,
|
||||
int _timeout = 2000,
|
||||
QWidget * _parent = nullptr,
|
||||
int _add_y_margin = 0 );
|
||||
static TextFloat * displayMessage( const QString & _title,
|
||||
const QString & _msg,
|
||||
const QPixmap & _pixmap =
|
||||
@@ -66,16 +62,15 @@ public:
|
||||
|
||||
|
||||
protected:
|
||||
void paintEvent( QPaintEvent * _me ) override;
|
||||
void mousePressEvent( QMouseEvent * _me ) override;
|
||||
|
||||
|
||||
private:
|
||||
void updateSize();
|
||||
TextFloat(const QString & _title, const QString & _text, const QPixmap & _pixmap);
|
||||
|
||||
QString m_title;
|
||||
QString m_text;
|
||||
QPixmap m_pixmap;
|
||||
QLabel * m_pixmapLabel;
|
||||
QLabel * m_titleLabel;
|
||||
QLabel * m_textLabel;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user