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  switch (argument.type()) {
27  case QVariant::Invalid:
28  break;
29  case QVariant::String:
30  QMetaObject::invokeMethod(this, name,
31  Q_ARG(QString, argument.toString()));
32  break;
33  case QVariant::StringList: {
34  QStringList strLst = argument.toStringList();
35  QMetaObject::invokeMethod(this, name,
36  Q_ARG(QStringList*, &strLst));
37  break;
38  }
39  case QVariant::Int:
40  QMetaObject::invokeMethod(this, name,
41  Q_ARG(int, argument.toInt()));
42  break;
43  case QVariant::UInt: {
44  unsigned int i = argument.toUInt();
45  QMetaObject::invokeMethod(this, name,
46  Q_ARG(uint*, &i));
47  break;
48  }
49  case QVariant::Bool:
50  QMetaObject::invokeMethod(this, name,
51  Q_ARG(bool, argument.toBool()));
52  break;
53  default:
54  break;
55  }
56 }
57 
uint toUInt(bool *ok) const const
int toInt(bool *ok) const const
void callMethod(const char *name, const QVariant &argument)
Perform a dynamic invocation of a method in the BrowserInterface implementation.
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
bool toBool() const const
QVariant::Type type() const const
The KParts namespace,.
QString toString() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Aug 12 2020 22:54:47 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.