-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathpqObjectPlayer.cxx
More file actions
56 lines (46 loc) · 1.39 KB
/
pqObjectPlayer.cxx
File metadata and controls
56 lines (46 loc) · 1.39 KB
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
// SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
// SPDX-License-Identifier: BSD-3-Clause
#include "pqObjectPlayer.h"
#include "pqEventTypes.h"
#include <QVariant>
#include <QtDebug>
// ----------------------------------------------------------------------------
pqObjectPlayer::pqObjectPlayer(QObject* parent)
: Superclass(parent)
{
}
// ----------------------------------------------------------------------------
bool pqObjectPlayer::playEvent(
QObject* object, const QString& command, const QString& arguments, int eventType, bool& error)
{
if (!object)
{
return false;
}
if (eventType == pqEventTypes::CHECK_EVENT)
{
QVariant propertyValue = object->property(command.toUtf8().data());
if (!propertyValue.isValid())
{
return false;
}
if (propertyValue.toString().replace("\t", " ") != arguments)
{
QString errorMessage = object->objectName() +
" property value is: " + propertyValue.toString() + ". Expecting: " + arguments + ".";
qCritical() << errorMessage.toUtf8().data();
error = true;
}
return true;
}
if (eventType == pqEventTypes::ACTION_EVENT)
{
return this->playEvent(object, command, arguments, error);
}
return false;
}
// ----------------------------------------------------------------------------
bool pqObjectPlayer::playEvent(QObject*, const QString&, const QString&, bool&)
{
return false;
}