-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathpqAbstractDoubleEventPlayer.cxx
More file actions
45 lines (38 loc) · 1.07 KB
/
pqAbstractDoubleEventPlayer.cxx
File metadata and controls
45 lines (38 loc) · 1.07 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
// SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
// SPDX-License-Identifier: BSD-3-Clause
#include "pqAbstractDoubleEventPlayer.h"
#include <QDoubleSpinBox>
#include <QtDebug>
pqAbstractDoubleEventPlayer::pqAbstractDoubleEventPlayer(QObject* p)
: pqWidgetEventPlayer(p)
{
}
bool pqAbstractDoubleEventPlayer::playEvent(
QObject* Object, const QString& Command, const QString& Arguments, bool& Error)
{
if (Command != "set_double" && Command != "spin")
return false;
const double value = Arguments.toDouble();
if (QDoubleSpinBox* const object = qobject_cast<QDoubleSpinBox*>(Object))
{
if (Command == "set_double")
{
object->setValue(value);
return true;
}
else if (Command == "spin" && Arguments == "up")
{
object->stepUp();
return true;
}
else if (Command == "spin" && Arguments == "down")
{
object->stepDown();
return true;
}
}
qCritical() << "calling set_double on unhandled type " << Object;
Error = true;
return true;
}