-
Notifications
You must be signed in to change notification settings - Fork 364
/
CppObject.cpp
61 lines (51 loc) · 1.08 KB
/
CppObject.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "CppObject.h"
#include <QDebug>
CppObject::CppObject(QObject *parent)
: QObject(parent),
myName("none"),
myYear(0)
{
}
void CppObject::sendSignal()
{
//测试用,调用该函数后发送信号
qDebug()<<"CppObject::sendSignal";
emit cppSignalA();
emit cppSignalB(myName,myYear);
}
void CppObject::setName(const QString &name)
{
qDebug()<<"CppObject::setName"<<name;
if(myName!=name){
qDebug()<<"emit nameChanged";
myName=name;
emit nameChanged(name);
}
}
QString CppObject::getName() const
{
qDebug()<<"CppObject::getName";
return myName;
}
void CppObject::setYear(int year)
{
qDebug()<<"CppObject::setYear"<<year;
if(year!=myYear){
qDebug()<<"emit yearChanged";
myYear=year;
emit yearChanged(myYear);
}
}
int CppObject::getYear() const
{
qDebug()<<"CppObject::getYear";
return myYear;
}
void CppObject::cppSlotA()
{
qDebug()<<"CppObject::cppSlotA";
}
void CppObject::cppSlotB(const QString &str, int value)
{
qDebug()<<"CppObject::cppSlotB"<<str<<value;
}