source: trunk/tools/activeqt/testcon/controlinfo.cpp@ 235

Last change on this file since 235 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 4.3 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the tools applications of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
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**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#include "controlinfo.h"
43
44#include <QtGui>
45
46QT_BEGIN_NAMESPACE
47
48ControlInfo::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
58void 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
122QT_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.