• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Kross

  • sources
  • kde-4.12
  • kdelibs
  • kross
  • core
childreninterface.h
Go to the documentation of this file.
1 /***************************************************************************
2  * childreninterface.h
3  * This file is part of the KDE project
4  * copyright (C)2004-2006 by Sebastian Sauer (mail@dipe.org)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  * You should have received a copy of the GNU Library General Public License
15  * along with this program; see the file COPYING. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  ***************************************************************************/
19 
20 #ifndef KROSS_CHILDRENINTERFACE_H
21 #define KROSS_CHILDRENINTERFACE_H
22 
23 
24 #include <QtCore/QHash>
25 #include <QtCore/QObject>
26 
27 #include "krossconfig.h"
28 
29 namespace Kross {
30 
38  class KROSSCORE_EXPORT ChildrenInterface
39  {
40  public:
41 
45  enum Options {
46  NoOption = 0x00,
47  AutoConnectSignals = 0x01,
48 
49  //TODO probably add more options like;
50  //ScriptableSlots = 0x01, ///< Publish slots that have Q_SCRIPTABLE defined.
51  //NonScriptableSlots = 0x02, ///< Publish slots that don't have Q_SCRIPTABLE defined.
52  //PrivateSlots = 0x04, ///< Publish private slots.
53  //ProtectedSlots = 0x08, ///< Publish protected slots.
54  //PublicSlots = 0x10, ///< Publish public slots.
55  //AllSlots = ScriptableSlots|NonScriptableSlots|PrivateSlots|ProtectedSlots|PublicSlots,
56  //ScriptableSignals = 0x100, ///< Publish signals that have Q_SCRIPTABLE defined.
57  //NonScriptableSignals = 0x200, ///< Publish signals that don't have Q_SCRIPTABLE defined.
58  //PrivateSignals = 0x400, ///< Publish private signals.
59  //ProtectedSignals = 0x800, ///< Publish protected signals.
60  //PublicSignals = 0x1000, ///< Publish public signals.
61  //AllSignals = ScriptableSignals|NonScriptableSignals|PrivateSignals|ProtectedSignals|PublicSignals,
62  //ScriptableProperties = 0x10000, ///< Publish properties that have Q_SCRIPTABLE defined.
63  //NonScriptableProperties = 0x20000, ///< Publish properties that don't have Q_SCRIPTABLE defined.
64  //AllProperties = ScriptableProperties|NonScriptableProperties,
65  //GetParentObject = 0x100000, ///< Provide access to the parent QObject the QObject has.
66  //SetParentObject = 0x200000, ///< Be able to set the parent QObject the QObject has.
67  //ChildObjects = 0x400000, ///< Provide access to the child QObject's the QObject has.
68  //AllObjects = GetParentObject|SetParentObject|ChildObjects
69 
70  LastOption = 0x1000000
71  };
72 
80  void addObject(QObject* object, const QString& name = QString(), Options options = NoOption) {
81  QString n = name.isNull() ? object->objectName() : name;
82  m_objects.insert(n, object);
83  if( options != NoOption )
84  m_options.insert(n, options);
85  }
86 
90  bool hasObject(const QString& name) const {
91  return m_objects.contains(name);
92  }
93 
97  QObject* object(const QString& name) const {
98  return m_objects.contains(name) ? m_objects.value(name) : 0;
99  }
100 
104  QHash< QString, QObject* > objects() const {
105  return m_objects;
106  }
107 
111  Options objectOption(const QString& name) const {
112  return m_options.contains(name) ? m_options.value(name) : NoOption;
113  }
114 
118  QHash< QString, Options > objectOptions() const {
119  return m_options;
120  }
121 
122  private:
123  QHash< QString, QObject* > m_objects;
124  QHash< QString, Options > m_options;
125  };
126 
127 }
128 
129 #endif
130 
Kross::ChildrenInterface::addObject
void addObject(QObject *object, const QString &name=QString(), Options options=NoOption)
Add a QObject to the list of children.
Definition: childreninterface.h:80
Kross::ChildrenInterface::objectOptions
QHash< QString, Options > objectOptions() const
Definition: childreninterface.h:118
name
const char * name(StandardAction id)
QString
QHash< QString, QObject * >
QObject
Kross::ChildrenInterface::hasObject
bool hasObject(const QString &name) const
Definition: childreninterface.h:90
Kross::ChildrenInterface::objects
QHash< QString, QObject * > objects() const
Definition: childreninterface.h:104
Kross::ChildrenInterface
Interface for managing Object collections.
Definition: childreninterface.h:38
Kross::ChildrenInterface::Options
Options
Additional options that could be defined for a QObject instance.
Definition: childreninterface.h:45
Kross::ChildrenInterface::object
QObject * object(const QString &name) const
Definition: childreninterface.h:97
krossconfig.h
Kross::ChildrenInterface::objectOption
Options objectOption(const QString &name) const
Definition: childreninterface.h:111
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:54 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kross

Skip menu "Kross"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal