| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the Qt Designer of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
| 21 | ** included in the packaging of this file. Please review the following |
| 22 | ** information to ensure the GNU General Public License requirements will |
| 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 24 | ** |
| 25 | ** $QT_END_LICENSE$ |
| 26 | ** |
| 27 | ****************************************************************************/ |
| 28 | |
| 29 | #include "abstractintrospection_p.h" |
| 30 | |
| 31 | QT_BEGIN_NAMESPACE |
| 32 | |
| 33 | /*! |
| 34 | \class QDesignerMetaEnumInterface |
| 35 | \internal |
| 36 | \since 4.4 |
| 37 | |
| 38 | \brief QDesignerMetaEnumInterface is part of \QD's introspection interface and represents an enumeration. |
| 39 | |
| 40 | \inmodule QtDesigner |
| 41 | |
| 42 | The QDesignerMetaEnumInterface class provides meta-data about an enumerator. |
| 43 | |
| 44 | \sa QDesignerMetaObjectInterface |
| 45 | */ |
| 46 | |
| 47 | /*! |
| 48 | Constructs a QDesignerMetaEnumInterface object. |
| 49 | */ |
| 50 | |
| 51 | QDesignerMetaEnumInterface::QDesignerMetaEnumInterface() = default; |
| 52 | |
| 53 | /*! |
| 54 | Destroys the QDesignerMetaEnumInterface object. |
| 55 | */ |
| 56 | QDesignerMetaEnumInterface::~QDesignerMetaEnumInterface() = default; |
| 57 | |
| 58 | /*! |
| 59 | \fn bool QDesignerMetaEnumInterface::isFlag() const |
| 60 | |
| 61 | Returns true if this enumerator is used as a flag. |
| 62 | */ |
| 63 | |
| 64 | /*! |
| 65 | \fn QString QDesignerMetaEnumInterface::key(int index) const |
| 66 | |
| 67 | Returns the key with the given \a index. |
| 68 | */ |
| 69 | |
| 70 | /*! |
| 71 | \fn int QDesignerMetaEnumInterface::keyCount() const |
| 72 | |
| 73 | Returns the number of keys. |
| 74 | */ |
| 75 | |
| 76 | /*! |
| 77 | \fn int QDesignerMetaEnumInterface::keyToValue(const QString &key) const |
| 78 | |
| 79 | Returns the integer value of the given enumeration \a key, or -1 if \a key is not defined. |
| 80 | */ |
| 81 | |
| 82 | /*! |
| 83 | \fn int QDesignerMetaEnumInterface::keysToValue(const QString &keys) const |
| 84 | |
| 85 | Returns the value derived from combining together the values of the \a keys using the OR operator, or -1 if keys is not defined. Note that the strings in \a keys must be '|'-separated. |
| 86 | */ |
| 87 | |
| 88 | /*! |
| 89 | \fn QString QDesignerMetaEnumInterface::name() const |
| 90 | |
| 91 | Returns the name of the enumerator (without the scope). |
| 92 | */ |
| 93 | |
| 94 | /*! |
| 95 | \fn QString QDesignerMetaEnumInterface::scope() const |
| 96 | |
| 97 | Returns the scope this enumerator was declared in. |
| 98 | */ |
| 99 | |
| 100 | /*! |
| 101 | \fn QString QDesignerMetaEnumInterface::separator() const |
| 102 | |
| 103 | Returns the separator to be used when building enumeration names. |
| 104 | */ |
| 105 | |
| 106 | /*! |
| 107 | \fn int QDesignerMetaEnumInterface::value(int index) const |
| 108 | |
| 109 | Returns the value with the given \a index; or returns -1 if there is no such value. |
| 110 | */ |
| 111 | |
| 112 | /*! |
| 113 | \fn QString QDesignerMetaEnumInterface::valueToKey(int value) const |
| 114 | |
| 115 | Returns the string that is used as the name of the given enumeration \a value, or QString::null if value is not defined. |
| 116 | */ |
| 117 | |
| 118 | /*! |
| 119 | \fn QString QDesignerMetaEnumInterface::valueToKeys(int value) const |
| 120 | |
| 121 | Returns a byte array of '|'-separated keys that represents the given \a value. |
| 122 | */ |
| 123 | |
| 124 | /*! |
| 125 | \class QDesignerMetaPropertyInterface |
| 126 | \internal |
| 127 | \since 4.4 |
| 128 | |
| 129 | \brief QDesignerMetaPropertyInterface is part of \QD's introspection interface and represents a property. |
| 130 | |
| 131 | \inmodule QtDesigner |
| 132 | |
| 133 | The QDesignerMetaPropertyInterface class provides meta-data about a property. |
| 134 | |
| 135 | \sa QDesignerMetaObjectInterface |
| 136 | */ |
| 137 | |
| 138 | /*! |
| 139 | Constructs a QDesignerMetaPropertyInterface object. |
| 140 | */ |
| 141 | |
| 142 | QDesignerMetaPropertyInterface::QDesignerMetaPropertyInterface() = default; |
| 143 | |
| 144 | /*! |
| 145 | Destroys the QDesignerMetaPropertyInterface object. |
| 146 | */ |
| 147 | |
| 148 | QDesignerMetaPropertyInterface::~QDesignerMetaPropertyInterface() = default; |
| 149 | |
| 150 | /*! |
| 151 | \enum QDesignerMetaPropertyInterface::Kind |
| 152 | |
| 153 | This enum indicates whether the property is of a special type. |
| 154 | |
| 155 | \value EnumKind The property is of an enumeration type |
| 156 | \value FlagKind The property is of an flag type |
| 157 | \value OtherKind The property is of another type |
| 158 | */ |
| 159 | |
| 160 | /*! |
| 161 | \enum QDesignerMetaPropertyInterface::AccessFlag |
| 162 | |
| 163 | These flags specify the access the property provides. |
| 164 | |
| 165 | \value ReadAccess Property can be read |
| 166 | \value WriteAccess Property can be written |
| 167 | \value ResetAccess Property can be reset to a default value |
| 168 | */ |
| 169 | |
| 170 | /*! |
| 171 | \enum QDesignerMetaPropertyInterface::Attribute |
| 172 | |
| 173 | Various attributes of the property. |
| 174 | |
| 175 | \value DesignableAttribute Property is designable (visible in \QD) |
| 176 | \value ScriptableAttribute Property is scriptable |
| 177 | \value StoredAttribute Property is stored, that is, not calculated |
| 178 | \value UserAttribute Property is the property that the user can edit for the QObject |
| 179 | */ |
| 180 | |
| 181 | /*! |
| 182 | \fn const QDesignerMetaEnumInterface *QDesignerMetaPropertyInterface::enumerator() const |
| 183 | |
| 184 | Returns the enumerator if this property's type is an enumerator type; |
| 185 | */ |
| 186 | |
| 187 | /*! |
| 188 | \fn Kind QDesignerMetaPropertyInterface::kind() const |
| 189 | |
| 190 | Returns the type of the property. |
| 191 | */ |
| 192 | |
| 193 | /*! |
| 194 | \fn AccessFlags QDesignerMetaPropertyInterface::accessFlags() const |
| 195 | |
| 196 | Returns a combination of access flags. |
| 197 | */ |
| 198 | |
| 199 | /*! |
| 200 | \fn Attributes QDesignerMetaPropertyInterface::attributes(const QObject *object) const |
| 201 | |
| 202 | Returns the attributes of the property for the gives \a object. |
| 203 | */ |
| 204 | |
| 205 | /*! |
| 206 | \fn QVariant::Type QDesignerMetaPropertyInterface::type() const |
| 207 | |
| 208 | Returns the type of the property. |
| 209 | */ |
| 210 | |
| 211 | /*! |
| 212 | \fn QString QDesignerMetaPropertyInterface::name() const |
| 213 | |
| 214 | Returns the name of the property. |
| 215 | */ |
| 216 | |
| 217 | /*! |
| 218 | \fn QString QDesignerMetaPropertyInterface::typeName() const |
| 219 | |
| 220 | Returns the name of this property's type. |
| 221 | */ |
| 222 | |
| 223 | |
| 224 | /*! |
| 225 | \fn int QDesignerMetaPropertyInterface::userType() const |
| 226 | |
| 227 | Returns this property's user type. |
| 228 | */ |
| 229 | |
| 230 | /*! |
| 231 | \fn bool QDesignerMetaPropertyInterface::hasSetter() const |
| 232 | |
| 233 | Returns whether getter and setter methods exist for this property. |
| 234 | */ |
| 235 | |
| 236 | /*! |
| 237 | \fn QVariant QDesignerMetaPropertyInterface::read(const QObject *object) const |
| 238 | |
| 239 | Reads the property's value from the given \a object. Returns the value if it was able to read it; otherwise returns an invalid variant. |
| 240 | */ |
| 241 | |
| 242 | /*! |
| 243 | \fn bool QDesignerMetaPropertyInterface::reset(QObject *object) const |
| 244 | |
| 245 | Resets the property for the given \a object with a reset method. Returns true if the reset worked; otherwise returns false. |
| 246 | */ |
| 247 | |
| 248 | /*! |
| 249 | \fn bool QDesignerMetaPropertyInterface::write(QObject *object, const QVariant &value) const |
| 250 | |
| 251 | Writes \a value as the property's value to the given \a object. Returns true if the write succeeded; otherwise returns false. |
| 252 | */ |
| 253 | |
| 254 | /*! |
| 255 | \class QDesignerMetaMethodInterface |
| 256 | \internal |
| 257 | \since 4.4 |
| 258 | |
| 259 | \brief QDesignerMetaMethodInterface is part of \QD's introspection interface and represents a member function. |
| 260 | |
| 261 | \inmodule QtDesigner |
| 262 | |
| 263 | The QDesignerMetaMethodInterface class provides meta-data about a member function. |
| 264 | |
| 265 | \sa QDesignerMetaObjectInterface |
| 266 | */ |
| 267 | |
| 268 | /*! |
| 269 | Constructs a QDesignerMetaMethodInterface object. |
| 270 | */ |
| 271 | |
| 272 | QDesignerMetaMethodInterface::QDesignerMetaMethodInterface() = default; |
| 273 | |
| 274 | /*! |
| 275 | Destroys the QDesignerMetaMethodInterface object. |
| 276 | */ |
| 277 | |
| 278 | QDesignerMetaMethodInterface::~QDesignerMetaMethodInterface() = default; |
| 279 | |
| 280 | /*! |
| 281 | \enum QDesignerMetaMethodInterface::MethodType |
| 282 | |
| 283 | This enum specifies the type of the method |
| 284 | |
| 285 | \value Method The function is a plain member function. |
| 286 | \value Signal The function is a signal. |
| 287 | \value Slot The function is a slot. |
| 288 | \value Constructor The function is a constructor. |
| 289 | |
| 290 | */ |
| 291 | |
| 292 | /*! |
| 293 | \enum QDesignerMetaMethodInterface::Access |
| 294 | |
| 295 | This enum represents the access specification of the method |
| 296 | |
| 297 | \value Private A private member function |
| 298 | \value Protected A protected member function |
| 299 | \value Public A public member function |
| 300 | */ |
| 301 | |
| 302 | /*! |
| 303 | \fn QDesignerMetaMethodInterface::Access QDesignerMetaMethodInterface::access() const |
| 304 | |
| 305 | Returns the access specification of this method. |
| 306 | */ |
| 307 | |
| 308 | |
| 309 | /*! |
| 310 | \fn QDesignerMetaMethodInterface::MethodType QDesignerMetaMethodInterface::methodType() const |
| 311 | |
| 312 | Returns the type of this method. |
| 313 | */ |
| 314 | |
| 315 | /*! |
| 316 | \fn QStringList QDesignerMetaMethodInterface::parameterNames() const |
| 317 | |
| 318 | Returns a list of parameter names. |
| 319 | */ |
| 320 | |
| 321 | /*! |
| 322 | \fn QStringList QDesignerMetaMethodInterface::parameterTypes() const |
| 323 | |
| 324 | Returns a list of parameter types. |
| 325 | */ |
| 326 | |
| 327 | /*! |
| 328 | \fn QString QDesignerMetaMethodInterface::signature() const |
| 329 | |
| 330 | Returns the signature of this method. |
| 331 | */ |
| 332 | |
| 333 | /*! |
| 334 | \fn QString QDesignerMetaMethodInterface::normalizedSignature() const |
| 335 | |
| 336 | Returns the normalized signature of this method (suitable as signal/slot specification). |
| 337 | */ |
| 338 | |
| 339 | |
| 340 | /*! |
| 341 | \fn QString QDesignerMetaMethodInterface::tag() const |
| 342 | |
| 343 | Returns the tag associated with this method. |
| 344 | */ |
| 345 | |
| 346 | /*! |
| 347 | \fn QString QDesignerMetaMethodInterface::typeName() const |
| 348 | |
| 349 | Returns the return type of this method, or an empty string if the return type is void. |
| 350 | */ |
| 351 | |
| 352 | /*! |
| 353 | \class QDesignerMetaObjectInterface |
| 354 | \internal |
| 355 | \since 4.4 |
| 356 | |
| 357 | \brief QDesignerMetaObjectInterface is part of \QD's introspection interface and provides meta-information about Qt objects |
| 358 | |
| 359 | \inmodule QtDesigner |
| 360 | |
| 361 | The QDesignerMetaObjectInterface class provides meta-data about Qt objects. For a given object, it can be obtained |
| 362 | by querying QDesignerIntrospectionInterface. |
| 363 | |
| 364 | \sa QDesignerIntrospectionInterface |
| 365 | */ |
| 366 | |
| 367 | /*! |
| 368 | Constructs a QDesignerMetaObjectInterface object. |
| 369 | */ |
| 370 | |
| 371 | QDesignerMetaObjectInterface::QDesignerMetaObjectInterface() = default; |
| 372 | |
| 373 | /*! |
| 374 | Destroys the QDesignerMetaObjectInterface object. |
| 375 | */ |
| 376 | |
| 377 | QDesignerMetaObjectInterface::~QDesignerMetaObjectInterface() = default; |
| 378 | |
| 379 | /*! |
| 380 | \fn QString QDesignerMetaObjectInterface::className() const |
| 381 | |
| 382 | Returns the class name. |
| 383 | */ |
| 384 | |
| 385 | /*! |
| 386 | \fn const QDesignerMetaEnumInterface *QDesignerMetaObjectInterface::enumerator(int index) const |
| 387 | |
| 388 | Returns the meta-data for the enumerator with the given \a index. |
| 389 | */ |
| 390 | |
| 391 | /*! |
| 392 | \fn int QDesignerMetaObjectInterface::enumeratorCount() const |
| 393 | |
| 394 | Returns the number of enumerators in this class. |
| 395 | */ |
| 396 | |
| 397 | /*! |
| 398 | \fn int QDesignerMetaObjectInterface::enumeratorOffset() const |
| 399 | |
| 400 | Returns the enumerator offset for this class; i.e. the index position of this class's first enumerator. |
| 401 | */ |
| 402 | |
| 403 | /*! |
| 404 | \fn int QDesignerMetaObjectInterface::indexOfEnumerator(const QString &name) const |
| 405 | |
| 406 | Finds enumerator \a name and returns its index; otherwise returns -1. |
| 407 | */ |
| 408 | |
| 409 | /*! |
| 410 | \fn int QDesignerMetaObjectInterface::indexOfMethod(const QString &method) const |
| 411 | |
| 412 | Finds \a method and returns its index; otherwise returns -1. |
| 413 | */ |
| 414 | |
| 415 | /*! |
| 416 | \fn int QDesignerMetaObjectInterface::indexOfProperty(const QString &name) const |
| 417 | |
| 418 | Finds property \a name and returns its index; otherwise returns -1. |
| 419 | */ |
| 420 | |
| 421 | /*! |
| 422 | \fn int QDesignerMetaObjectInterface::indexOfSignal(const QString &signal) const |
| 423 | |
| 424 | Finds \a signal and returns its index; otherwise returns -1. |
| 425 | */ |
| 426 | |
| 427 | /*! |
| 428 | \fn int QDesignerMetaObjectInterface::indexOfSlot(const QString &slot) const |
| 429 | |
| 430 | Finds \a slot and returns its index; otherwise returns -1. |
| 431 | */ |
| 432 | |
| 433 | /*! |
| 434 | \fn const QDesignerMetaMethodInterface *QDesignerMetaObjectInterface::method(int index) const |
| 435 | |
| 436 | Returns the meta-data for the method with the given \a index. |
| 437 | */ |
| 438 | |
| 439 | /*! |
| 440 | \fn int QDesignerMetaObjectInterface::methodCount() const |
| 441 | |
| 442 | Returns the number of methods in this class. These include ordinary methods, signals, and slots. |
| 443 | */ |
| 444 | |
| 445 | /*! |
| 446 | \fn int QDesignerMetaObjectInterface::methodOffset() const |
| 447 | |
| 448 | Returns the method offset for this class; i.e. the index position of this class's first member function. |
| 449 | */ |
| 450 | |
| 451 | /*! |
| 452 | \fn const QDesignerMetaPropertyInterface *QDesignerMetaObjectInterface::property(int index) const |
| 453 | |
| 454 | Returns the meta-data for the property with the given \a index. |
| 455 | */ |
| 456 | /*! |
| 457 | \fn int QDesignerMetaObjectInterface::propertyCount() const |
| 458 | |
| 459 | Returns the number of properties in this class. |
| 460 | */ |
| 461 | /*! |
| 462 | \fn int QDesignerMetaObjectInterface::propertyOffset() const |
| 463 | |
| 464 | Returns the property offset for this class; i.e. the index position of this class's first property. |
| 465 | */ |
| 466 | |
| 467 | /*! |
| 468 | \fn const QDesignerMetaObjectInterface *QDesignerMetaObjectInterface::superClass() const |
| 469 | |
| 470 | Returns the meta-object of the superclass, or 0 if there is no such object. |
| 471 | */ |
| 472 | |
| 473 | /*! |
| 474 | \fn const QDesignerMetaPropertyInterface *QDesignerMetaObjectInterface::userProperty() const |
| 475 | |
| 476 | Returns the property that has the USER flag set to true. |
| 477 | */ |
| 478 | |
| 479 | /*! |
| 480 | \class QDesignerIntrospectionInterface |
| 481 | \internal |
| 482 | \since 4.4 |
| 483 | |
| 484 | \brief QDesignerIntrospectionInterface provides access to a QDesignerMetaObjectInterface for a given Qt object. |
| 485 | |
| 486 | \inmodule QtDesigner |
| 487 | |
| 488 | QDesignerIntrospectionInterface is the main class of \QD's introspection interface. These |
| 489 | interfaces provide a layer of abstraction around QMetaObject and related classes to allow for the integration |
| 490 | of other programming languages. |
| 491 | |
| 492 | An instance of QDesignerIntrospectionInterface can be obtained from the core. |
| 493 | |
| 494 | \sa QDesignerMetaObjectInterface |
| 495 | */ |
| 496 | |
| 497 | /*! |
| 498 | Constructs a QDesignerIntrospectionInterface object. |
| 499 | */ |
| 500 | |
| 501 | QDesignerIntrospectionInterface::QDesignerIntrospectionInterface() |
| 502 | { |
| 503 | } |
| 504 | |
| 505 | /*! |
| 506 | Destroys the QDesignerIntrospectionInterface object. |
| 507 | */ |
| 508 | |
| 509 | QDesignerIntrospectionInterface::~QDesignerIntrospectionInterface() |
| 510 | { |
| 511 | } |
| 512 | |
| 513 | /*! |
| 514 | \fn const QDesignerMetaObjectInterface* QDesignerIntrospectionInterface::metaObject(const QObject *object) const |
| 515 | |
| 516 | Returns the meta object of this \a object. |
| 517 | */ |
| 518 | |
| 519 | QT_END_NAMESPACE |
| 520 | |