KParts

browserinterface.cpp
1 /*
2  This file is part of the KDE project
3  SPDX-FileCopyrightText: 2001 Simon Hausmann <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #include "browserinterface.h"
9 
10 #include <QStringList>
11 #include <QVariant>
12 
13 using namespace KParts;
14 
15 BrowserInterface::BrowserInterface(QObject *parent)
16  : QObject(parent)
17 {
18 }
19 
20 BrowserInterface::~BrowserInterface()
21 {
22 }
23 
24 void BrowserInterface::callMethod(const char *name, const QVariant &argument)
25 {
26  // clang-format off
27  switch (argument.type()) {
28  case QVariant::Invalid:
29  break;
30  case QVariant::String:
31  QMetaObject::invokeMethod(this, name,
32  Q_ARG(QString, argument.toString()));
33  break;
34  case QVariant::StringList: {
35  QStringList strLst = argument.toStringList();
36  QMetaObject::invokeMethod(this, name,
37  Q_ARG(QStringList*, &strLst));
38  break;
39  }
40  case QVariant::Int:
41  QMetaObject::invokeMethod(this, name,
42  Q_ARG(int, argument.toInt()));
43  break;
44  case QVariant::UInt: {
45  unsigned int i = argument.toUInt();
46  QMetaObject::invokeMethod(this, name,
47  Q_ARG(uint*, &i));
48  break;
49  }
50  case QVariant::Bool:
51  QMetaObject::invokeMethod(this, name,
52  Q_ARG(bool, argument.toBool()));
53  break;
54  default:
55  break;
56  }
57  // clang-format on
58 }
void callMethod(const char *name, const QVariant &argument)
Perform a dynamic invocation of a method in the BrowserInterface implementation.
QVariant::Type type() const const
uint toUInt(bool *ok) const const
int toInt(bool *ok) const const
bool toBool() const const
bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType type, QGenericReturnArgument ret, QGenericArgument val0, QGenericArgument val1, QGenericArgument val2, QGenericArgument val3, QGenericArgument val4, QGenericArgument val5, QGenericArgument val6, QGenericArgument val7, QGenericArgument val8, QGenericArgument val9)
QStringList toStringList() const const
The KParts namespace,.
QString toString() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Aug 9 2022 03:51:33 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.