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]
11{
12public:
13 Counter() { m_value = 0; }
14
15 int value() const { return m_value; }
16 void setValue(int value);
17
18private:
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]
31class Counter : public QObject
32//! [2] //! [3]
33{
35
36// Note. The Q_OBJECT macro starts a private section.
37// To declare public members, use the 'public:' access modifier.
38public:
39 Counter() { m_value = 0; }
40
41 int value() const { return m_value; }
42
43public slots:
44 void setValue(int value);
45
48
49private:
50 int m_value;
51};
52//! [3]
53
54#endif
int value() const
void setValue(int value)
[0]
int main()
[open]
#define Counter
[0]