hydrogen 1.2.3
LCDCombo.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-2024 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 LCDCOMBO_H
24#define LCDCOMBO_H
25
26
27#include <QtGui>
28#include <QComboBox>
30
31#include <core/Object.h>
33
35class LCDCombo : public QComboBox, protected WidgetWithScalableFont<6, 8, 9>, public H2Core::Object<LCDCombo>
36{
38 Q_OBJECT
39
40public:
41 explicit LCDCombo( QWidget *pParent, QSize size = QSize( 0, 0 ), bool bModifyOnChange = false );
42 ~LCDCombo();
43
44 void setSize( QSize size );
45 void setModifyOnChange( bool bModifyOnChange );
46
47 virtual void showPopup() override;
48 void addItem(const QString &text, const QVariant &userData = QVariant());
49
50 bool getIsActive() const;
51 void setIsActive( bool bIsActive );
52
53public slots:
55 void handleIsModified( int );
56
57private:
58 void updateStyleSheet();
59 QSize m_size;
60
63
67
72
73 virtual void paintEvent( QPaintEvent *ev ) override;
74 virtual void enterEvent( QEvent *ev ) override;
75 virtual void leaveEvent( QEvent *ev ) override;
76};
77inline void LCDCombo::setModifyOnChange( bool bModifyOnChange ) {
78 m_bModifyOnChange = bModifyOnChange;
79}
80inline bool LCDCombo::getIsActive() const {
81 return m_bIsActive;
82}
83#endif
#define H2_OBJECT(name)
Definition Object.h:224
Changes
Bitwise or-able options showing which part of the Preferences were altered using the PreferencesDialo...
virtual void showPopup() override
Definition LCDCombo.cpp:84
QSize m_size
Definition LCDCombo.h:59
void setModifyOnChange(bool bModifyOnChange)
Definition LCDCombo.h:77
LCDCombo(QWidget *pParent, QSize size=QSize(0, 0), bool bModifyOnChange=false)
Definition LCDCombo.cpp:31
int m_nMaxWidth
Keep track of the text width of the items added.
Definition LCDCombo.h:71
void onPreferencesChanged(H2Core::Preferences::Changes changes)
Definition LCDCombo.cpp:129
bool m_bModifyOnChange
Whether Hydrogen::setIsModified() is invoked with true as soon as the value of the widget does change...
Definition LCDCombo.h:66
bool getIsActive() const
Definition LCDCombo.h:80
virtual void leaveEvent(QEvent *ev) override
Definition LCDCombo.cpp:169
void updateStyleSheet()
Definition LCDCombo.cpp:92
void setSize(QSize size)
Definition LCDCombo.cpp:174
bool m_bIsActive
Definition LCDCombo.h:62
void handleIsModified(int)
Definition LCDCombo.cpp:57
virtual void paintEvent(QPaintEvent *ev) override
Definition LCDCombo.cpp:137
void setIsActive(bool bIsActive)
Definition LCDCombo.cpp:76
void addItem(const QString &text, const QVariant &userData=QVariant())
Definition LCDCombo.cpp:63
virtual void enterEvent(QEvent *ev) override
Definition LCDCombo.cpp:164
bool m_bEntered
Definition LCDCombo.h:61
Widget is affected by the "Font size" settings in the PreferencesDialog.