hydrogen 1.2.6
ClickableLabel.h
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4 * Copyright(c) 2008-2025 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
5 *
6 * http://www.hydrogen-music.org
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY, without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see https://www.gnu.org/licenses
20 *
21 */
22
23#ifndef CLICKABLE_LABEL_H
24#define CLICKABLE_LABEL_H
25
26#include <core/Object.h>
29
30#include <QtGui>
31#include <QtWidgets>
32
41class ClickableLabel : public QLabel, public H2Core::Object<ClickableLabel>
42{
44 Q_OBJECT
45
46public:
49 enum class Color {
52 };
53
54 explicit ClickableLabel( QWidget *pParent, QSize size = QSize( 0, 0 ),
55 QString sText = "", Color color = Color::Bright,
56 bool bIsEditable = false );
57
58public slots:
60 void setText( const QString& sNewText );
61
62signals:
64
65private:
66 void updateStyleSheet();
67 void updateFont( QString sFontFamily, H2Core::FontTheme::FontSize fontSize );
68
69 virtual void mousePressEvent( QMouseEvent * e ) override;
70#ifdef H2CORE_HAVE_QT6
71 virtual void enterEvent( QEnterEvent *ev ) override;
72#else
73 virtual void enterEvent( QEvent *ev ) override;
74#endif
75 virtual void leaveEvent( QEvent * e ) override;
76 virtual void paintEvent( QPaintEvent * e ) override;
77 QSize m_size;
79
85};
86
87
88#endif
89
#define H2_OBJECT(name)
Definition Object.h:227
void labelClicked(ClickableLabel *pLabel)
virtual void mousePressEvent(QMouseEvent *e) override
bool m_bIsEditable
If set to true a highlight will be painted when hovered.
virtual void leaveEvent(QEvent *e) override
void onPreferencesChanged(H2Core::Preferences::Changes changes)
void setText(const QString &sNewText)
ClickableLabel(QWidget *pParent, QSize size=QSize(0, 0), QString sText="", Color color=Color::Bright, bool bIsEditable=false)
Color
The individual colors of the text won't be exposed but are up to the palette/application-wide setting...
void updateFont(QString sFontFamily, H2Core::FontTheme::FontSize fontSize)
virtual void enterEvent(QEvent *ev) override
virtual void paintEvent(QPaintEvent *e) override
FontSize
Enables custom scaling of the font size in the GUI.
Definition Theme.h:184
Changes
Bitwise or-able options showing which part of the Preferences were altered using the PreferencesDialo...