Sayonara Player
Loading...
Searching...
No Matches
src
Gui
Utils
Widgets
WidgetTemplate.h
1
/* WidgetTemplate.h */
2
3
/* Copyright (C) 2011-2024 Michael Lugmair (Lucio Carreras)
4
*
5
* This file is part of sayonara player
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*/
20
21
#ifndef SAYONARAWIDGETTEMPLATE_H
22
#define SAYONARAWIDGETTEMPLATE_H
23
24
#include "Gui/Utils/GuiClass.h"
25
26
#include <QShowEvent>
27
#include <QObject>
28
#include <QVariant>
29
30
class
QWidget;
31
32
#define combo_current_index_changed_int static_cast<void (QComboBox::*) (int)>(&QComboBox::currentIndexChanged)
33
#define combo_activated_int static_cast<void (QComboBox::*) (int)>(&QComboBox::activated)
34
#define spinbox_value_changed_int static_cast<void (QSpinBox::*) (int)>(&QSpinBox::valueChanged)
35
36
namespace
Gui
37
{
38
class
WidgetTemplateParent
;
39
44
class
AbstrWidgetTemplate :
45
public
QObject
46
{
47
Q_OBJECT
48
49
private
:
50
WidgetTemplateParent
* mWtp =
nullptr
;
51
52
public
:
53
AbstrWidgetTemplate(QObject* parent,
WidgetTemplateParent
* wtp);
54
virtual
~AbstrWidgetTemplate()
override
;
55
56
protected
:
57
virtual
void
languageChanged();
58
virtual
void
skinChanged();
59
};
60
65
class
WidgetTemplateParent
66
{
67
friend
class
AbstrWidgetTemplate;
68
69
public
:
70
WidgetTemplateParent();
71
virtual
~WidgetTemplateParent();
72
73
protected
:
74
virtual
void
languageChanged();
75
virtual
void
skinChanged();
76
};
77
78
template
<
typename
T>
83
class
WidgetTemplate :
84
public
T,
85
protected
WidgetTemplateParent
86
{
87
friend
class
AbstrWidgetTemplate;
88
89
private
:
90
AbstrWidgetTemplate* mAwt =
nullptr
;
91
92
public
:
93
template
<
typename
... Args>
94
WidgetTemplate(Args... args) :
95
T(args...),
96
WidgetTemplateParent()
97
{
98
mAwt =
new
AbstrWidgetTemplate(
this
,
this
);
99
}
100
101
virtual
~WidgetTemplate() =
default
;
102
103
virtual
void
showEvent(QShowEvent* e)
override
104
{
105
languageChanged();
106
skinChanged();
107
108
T::showEvent(e);
109
}
110
};
111
}
112
113
#endif
// SAYONARAWIDGETTEMPLATE_H
Gui::WidgetTemplateParent
The WidgetTemplateParent class.
Definition
WidgetTemplate.h:66
Generated on Wed Apr 23 2025 00:00:00 for Sayonara Player by
1.13.2