Qt 5.10 Book Examples
Calculation.h
Go to the documentation of this file.
1 // ======================================================================
2 // Calculation.h
3 // ======================================================================
4 // This file is a part of the book
5 // "Qt 5.10 Professional programming with C++"
6 // http://qt-book.com
7 // ======================================================================
8 // Copyright (c) 2017 by Max Schlee
9 // ======================================================================
10 
11 #pragma once
12 
13 #include <QObject>
14 
15 // ======================================================================
16 class Calculation : public QObject {
17 Q_OBJECT
18 private:
19  Q_PROPERTY(qulonglong input WRITE setInputValue
20  READ inputValue
21  NOTIFY inputValueChanged
22  )
23  Q_PROPERTY(qulonglong result READ resultValue
24  NOTIFY resultValueChanged
25  )
26 
27  qulonglong m_nInput;
28  qulonglong m_nResult;
29 
30 public:
31  Calculation(QObject* pobj = 0);
32 
33  Q_INVOKABLE qulonglong factorial(const qulonglong& n);
34 
35  qulonglong inputValue ( ) const;
36  void setInputValue(const qulonglong&);
37  qulonglong resultValue ( ) const;
38 
39 signals:
40  void inputValueChanged (qulonglong);
41  void resultValueChanged(qulonglong);
42 };
43 
void resultValueChanged(qulonglong)
Q_INVOKABLE qulonglong factorial(const qulonglong &n)
Definition: Calculation.cpp:21
void setInputValue(const qulonglong &)
Definition: Calculation.cpp:39
qulonglong resultValue() const
Definition: Calculation.cpp:33
void inputValueChanged(qulonglong)
qulonglong result
Definition: Calculation.h:25
qulonglong inputValue() const
Definition: Calculation.cpp:27
qulonglong input
Definition: Calculation.h:22