KSaneCore

invertoption.cpp
1/*
2 * SPDX-FileCopyrightText: 2021 Alexander Stippich <a.stippich@gmx.net>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6
7#include "invertoption.h"
8
9#include <ksanecore_debug.h>
10
11namespace KSaneCore
12{
13
14InvertOption::InvertOption()
15{
16 m_optionType = Option::TypeBool;
17}
18
19bool InvertOption::setValue(const QVariant &value)
20{
21 if (value.canConvert<bool>()) {
22 if (m_checked != value.toBool()) {
23 m_checked = value.toBool();
24 Q_EMIT valueChanged(m_checked);
25 }
26 return true;
27 } else {
28 return false;
29 }
30}
31
32QVariant InvertOption::value() const
33{
34 return m_checked;
35}
36
37QString InvertOption::valueAsString() const
38{
39 if (m_checked) {
40 return QStringLiteral("true");
41 } else {
42 return QStringLiteral("false");
43 }
44}
45
46Option::OptionState InvertOption::state() const
47{
48 return Option::StateActive;
49}
50
51QString InvertOption::name() const
52{
53 return InvertColorsOptionName;
54}
55
56QString InvertOption::title() const
57{
58 return i18n("Invert colors");
59}
60
61QString InvertOption::description() const
62{
63 return i18n("Invert the colors of the scanned image.");
64}
65
66} // namespace KSaneCore
67
68#include "moc_invertoption.cpp"
OptionState
This enumeration describes the current statue of the value of the option, indicating if this option s...
Definition option.h:46
QString i18n(const char *text, const TYPE &arg...)
Q_EMITQ_EMIT
bool canConvert() const const
bool toBool() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:34 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.