Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
signalsandslots.h
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4
#
ifndef
SIGNALSANDSLOTS_H
5
#
define
SIGNALSANDSLOTS_H
6
7
#
define
Counter
PlainCounter
8
9
//! [0]
10
class
Counter
11
{
12
public
:
13
Counter
() { m_value = 0; }
14
15
int
value
()
const
{
return
m_value; }
16
void
setValue
(
int
value);
17
18
private
:
19
int
m_value;
20
};
21
//! [0]
22
23
#
undef
Counter
24
#
define
Counter
ObjectCounter
25
26
//! [1]
27
#
include
<
QObject
>
28
//! [1]
29
30
//! [2]
31
class
Counter
:
public
QObject
32
//! [2] //! [3]
33
{
34
Q_OBJECT
35
36
// Note. The Q_OBJECT macro starts a private section.
37
// To declare public members, use the 'public:' access modifier.
38
public
:
39
Counter
() {
m_value
= 0; }
40
41
int
value
()
const
{
return
m_value
; }
42
43
public
slots
:
44
void
setValue
(
int
value
);
45
46
signals
:
47
void
valueChanged
(
int
newValue
);
48
49
private
:
50
int
m_value;
51
};
52
//! [3]
53
54
#
endif
Counter::value
int value() const
Definition
signalsandslots.h:15
Counter::setValue
void setValue(int value)
[0]
Definition
signalsandslots.cpp:7
main
int main()
[open]
Definition
doc_src_objecttrees.cpp:7
Counter
#define Counter
[0]
Definition
signalsandslots.h:7
qtbase
src
corelib
doc
snippets
signalsandslots
signalsandslots.h
Generated on
for Qt by
1.14.0