[2] | 1 | /****************************************************************************
|
---|
| 2 | **
|
---|
[846] | 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
[561] | 4 | ** All rights reserved.
|
---|
| 5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
|
---|
[2] | 6 | **
|
---|
| 7 | ** This file is part of the tools applications of the Qt Toolkit.
|
---|
| 8 | **
|
---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
| 10 | ** Commercial Usage
|
---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
| 14 | ** a written agreement between you and Nokia.
|
---|
| 15 | **
|
---|
| 16 | ** GNU Lesser General Public License Usage
|
---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
| 20 | ** packaging of this file. Please review the following information to
|
---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
| 23 | **
|
---|
[561] | 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
[2] | 27 | **
|
---|
| 28 | ** GNU General Public License Usage
|
---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 32 | ** packaging of this file. Please review the following information to
|
---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
| 35 | **
|
---|
[561] | 36 | ** If you have questions regarding the use of this file, please contact
|
---|
| 37 | ** Nokia at qt-info@nokia.com.
|
---|
[2] | 38 | ** $QT_END_LICENSE$
|
---|
| 39 | **
|
---|
| 40 | ****************************************************************************/
|
---|
| 41 |
|
---|
| 42 | #include "controlinfo.h"
|
---|
| 43 |
|
---|
| 44 | #include <QtGui>
|
---|
| 45 |
|
---|
| 46 | QT_BEGIN_NAMESPACE
|
---|
| 47 |
|
---|
| 48 | ControlInfo::ControlInfo(QWidget *parent)
|
---|
| 49 | : QDialog(parent)
|
---|
| 50 | {
|
---|
| 51 | setupUi(this);
|
---|
| 52 |
|
---|
| 53 | listInfo->setColumnCount(2);
|
---|
| 54 | listInfo->headerItem()->setText(0, tr("Item"));
|
---|
| 55 | listInfo->headerItem()->setText(1, tr("Details"));
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | void ControlInfo::setControl(QWidget *activex)
|
---|
| 59 | {
|
---|
| 60 | listInfo->clear();
|
---|
| 61 |
|
---|
| 62 | const QMetaObject *mo = activex->metaObject();
|
---|
| 63 | QTreeWidgetItem *group = new QTreeWidgetItem(listInfo);
|
---|
| 64 | group->setText(0, tr("Class Info"));
|
---|
| 65 | group->setText(1, QString::number(mo->classInfoCount()));
|
---|
| 66 |
|
---|
| 67 | QTreeWidgetItem *item = 0;
|
---|
| 68 | int i;
|
---|
| 69 | int count;
|
---|
| 70 | for (i = mo->classInfoOffset(); i < mo->classInfoCount(); ++i) {
|
---|
| 71 | const QMetaClassInfo info = mo->classInfo(i);
|
---|
| 72 | item = new QTreeWidgetItem(group);
|
---|
| 73 | item->setText(0, QString::fromLatin1(info.name()));
|
---|
| 74 | item->setText(1, QString::fromLatin1(info.value()));
|
---|
| 75 | }
|
---|
| 76 | group = new QTreeWidgetItem(listInfo);
|
---|
| 77 | group->setText(0, tr("Signals"));
|
---|
| 78 |
|
---|
| 79 | count = 0;
|
---|
| 80 | for (i = mo->methodOffset(); i < mo->methodCount(); ++i) {
|
---|
| 81 | const QMetaMethod method = mo->method(i);
|
---|
| 82 | if (method.methodType() == QMetaMethod::Signal) {
|
---|
| 83 | ++count;
|
---|
| 84 | item = new QTreeWidgetItem(group);
|
---|
| 85 | item->setText(0, QString::fromLatin1(method.signature()));
|
---|
| 86 | }
|
---|
| 87 | }
|
---|
| 88 | group->setText(1, QString::number(count));
|
---|
| 89 |
|
---|
| 90 | group = new QTreeWidgetItem(listInfo);
|
---|
| 91 | group->setText(0, tr("Slots"));
|
---|
| 92 |
|
---|
| 93 | count = 0;
|
---|
| 94 | for (i = mo->methodOffset(); i < mo->methodCount(); ++i) {
|
---|
| 95 | const QMetaMethod method = mo->method(i);
|
---|
| 96 | if (method.methodType() == QMetaMethod::Slot) {
|
---|
| 97 | ++count;
|
---|
| 98 | item = new QTreeWidgetItem(group);
|
---|
| 99 | item->setText(0, QString::fromLatin1(method.signature()));
|
---|
| 100 | }
|
---|
| 101 | }
|
---|
| 102 | group->setText(1, QString::number(count));
|
---|
| 103 |
|
---|
| 104 | group = new QTreeWidgetItem(listInfo);
|
---|
| 105 | group->setText(0, tr("Properties"));
|
---|
| 106 |
|
---|
| 107 | count = 0;
|
---|
| 108 | for (i = mo->propertyOffset(); i < mo->propertyCount(); ++i) {
|
---|
| 109 | ++count;
|
---|
| 110 | const QMetaProperty property = mo->property(i);
|
---|
| 111 | item = new QTreeWidgetItem(group);
|
---|
| 112 | item->setText(0, QString::fromLatin1(property.name()));
|
---|
| 113 | item->setText(1, QString::fromLatin1(property.typeName()));
|
---|
| 114 | if (!property.isDesignable()) {
|
---|
| 115 | item->setTextColor(0, Qt::gray);
|
---|
| 116 | item->setTextColor(1, Qt::gray);
|
---|
| 117 | }
|
---|
| 118 | }
|
---|
| 119 | group->setText(1, QString::number(count));
|
---|
| 120 | }
|
---|
| 121 |
|
---|
| 122 | QT_END_NAMESPACE
|
---|