Render text of LedCheckBox with default font

Extend LedCheckBox so that it adds support to render the text with the
default font in the default size. The class now supports two modes:
* Legacy mode
* Non-legacy mode

Legacy mode is the default and renders the LedCheckBox as before. The
font is set to 7 pixels and all the text is rendered with a shadow.

Non-legacy mode uses the current font to render the text. The text is
rendered without a shadow and the pixmap is centered vertically to the
left side of the text.

The non-legacy mode is currently only used in the context of the matrix
LADSPA dialog. Toggle options are rendered using it as well as the "Link
Channels" button.
This commit is contained in:
Michael Gregorius
2023-07-09 19:10:56 +02:00
parent 4c0c4aa245
commit 660f2e96b3
4 changed files with 73 additions and 25 deletions

View File

@@ -48,10 +48,12 @@ public:
LedCheckBox( const QString & _txt, QWidget * _parent,
const QString & _name = QString(),
LedColors _color = Yellow );
LedColors _color = Yellow,
bool legacyMode = true);
LedCheckBox( QWidget * _parent,
const QString & _name = QString(),
LedColors _color = Yellow );
LedColors _color = Yellow,
bool legacyMode = true);
~LedCheckBox() override;
@@ -75,8 +77,12 @@ private:
QString m_text;
bool m_legacyMode;
void initUi( LedColors _color ); //!< to be called by ctors
void onTextUpdated(); //!< to be called when you updated @a m_text
void paintLegacy(QPaintEvent * p);
void paintNonLegacy(QPaintEvent * p);
} ;