~ubuntu-branches/ubuntu/karmic/ugene/karmic

« back to all changes in this revision

Viewing changes to src/libs_3rdparty/qtbindings_gui/src/qtscript_QCompleter.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Ivan Efremov
  • Date: 2009-01-26 19:17:51 UTC
  • Revision ID: james.westby@ubuntu.com-20090126191751-9kqqevd3yf4o098r
Tags: upstream-1.3.2+repack
ImportĀ upstreamĀ versionĀ 1.3.2+repack

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************
 
2
* Unipro UGENE - Integrated Bioinformatics Suite
 
3
* Copyright (C) 2008 Unipro, Russia (http://ugene.unipro.ru)
 
4
* All Rights Reserved
 
5
 
6
*     This source code is distributed under the terms of the
 
7
*     GNU General Public License. See the files COPYING and LICENSE
 
8
*     for details.
 
9
*****************************************************************/
 
10
 
 
11
#include <QtScript/QScriptEngine>
 
12
#include <QtScript/QScriptContext>
 
13
#include <QtScript/QScriptValue>
 
14
#include <QtCore/QStringList>
 
15
#include <QtCore/QDebug>
 
16
#include <qmetaobject.h>
 
17
 
 
18
#include <qcompleter.h>
 
19
#include <QVariant>
 
20
#include <qabstractitemmodel.h>
 
21
#include <qabstractitemview.h>
 
22
#include <qbytearray.h>
 
23
#include <qcompleter.h>
 
24
#include <qcoreevent.h>
 
25
#include <qlist.h>
 
26
#include <qobject.h>
 
27
#include <qrect.h>
 
28
#include <qstringlist.h>
 
29
#include <qwidget.h>
 
30
 
 
31
#include "qtscriptshell_QCompleter.h"
 
32
 
 
33
static const char * const qtscript_QCompleter_function_names[] = {
 
34
    "QCompleter"
 
35
    // static
 
36
    // prototype
 
37
    , "completionCount"
 
38
    , "completionModel"
 
39
    , "currentCompletion"
 
40
    , "currentIndex"
 
41
    , "currentRow"
 
42
    , "model"
 
43
    , "pathFromIndex"
 
44
    , "popup"
 
45
    , "setCurrentRow"
 
46
    , "setModel"
 
47
    , "setPopup"
 
48
    , "setWidget"
 
49
    , "splitPath"
 
50
    , "widget"
 
51
    , "toString"
 
52
};
 
53
 
 
54
static const char * const qtscript_QCompleter_function_signatures[] = {
 
55
    "QAbstractItemModel model, QObject parent\nQObject parent\nList completions, QObject parent"
 
56
    // static
 
57
    // prototype
 
58
    , ""
 
59
    , ""
 
60
    , ""
 
61
    , ""
 
62
    , ""
 
63
    , ""
 
64
    , "QModelIndex index"
 
65
    , ""
 
66
    , "int row"
 
67
    , "QAbstractItemModel c"
 
68
    , "QAbstractItemView popup"
 
69
    , "QWidget widget"
 
70
    , "String path"
 
71
    , ""
 
72
""
 
73
};
 
74
 
 
75
static QScriptValue qtscript_QCompleter_throw_ambiguity_error_helper(
 
76
    QScriptContext *context, const char *functionName, const char *signatures)
 
77
{
 
78
    QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
 
79
    QStringList fullSignatures;
 
80
    for (int i = 0; i < lines.size(); ++i)
 
81
        fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
 
82
    return context->throwError(QString::fromLatin1("QFile::%0(): could not find a function match; candidates are:\n%1")
 
83
        .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
 
84
}
 
85
 
 
86
Q_DECLARE_METATYPE(QCompleter*)
 
87
Q_DECLARE_METATYPE(QtScriptShell_QCompleter*)
 
88
Q_DECLARE_METATYPE(QCompleter::ModelSorting)
 
89
Q_DECLARE_METATYPE(QCompleter::CompletionMode)
 
90
Q_DECLARE_METATYPE(QAbstractItemModel*)
 
91
Q_DECLARE_METATYPE(QModelIndex)
 
92
Q_DECLARE_METATYPE(QAbstractItemView*)
 
93
 
 
94
static QScriptValue qtscript_create_enum_class_helper(
 
95
    QScriptEngine *engine,
 
96
    QScriptEngine::FunctionSignature construct,
 
97
    QScriptEngine::FunctionSignature valueOf,
 
98
    QScriptEngine::FunctionSignature toString)
 
99
{
 
100
    QScriptValue proto = engine->newObject();
 
101
    proto.setProperty(QString::fromLatin1("valueOf"),
 
102
        engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
 
103
    proto.setProperty(QString::fromLatin1("toString"),
 
104
        engine->newFunction(toString), QScriptValue::SkipInEnumeration);
 
105
    return engine->newFunction(construct, proto, 1);
 
106
}
 
107
 
 
108
//
 
109
// QCompleter::ModelSorting
 
110
//
 
111
 
 
112
static const QCompleter::ModelSorting qtscript_QCompleter_ModelSorting_values[] = {
 
113
    QCompleter::UnsortedModel
 
114
    , QCompleter::CaseSensitivelySortedModel
 
115
    , QCompleter::CaseInsensitivelySortedModel
 
116
};
 
117
 
 
118
static const char * const qtscript_QCompleter_ModelSorting_keys[] = {
 
119
    "UnsortedModel"
 
120
    , "CaseSensitivelySortedModel"
 
121
    , "CaseInsensitivelySortedModel"
 
122
};
 
123
 
 
124
static QString qtscript_QCompleter_ModelSorting_toStringHelper(QCompleter::ModelSorting value)
 
125
{
 
126
    if ((value >= QCompleter::UnsortedModel) && (value <= QCompleter::CaseInsensitivelySortedModel))
 
127
        return qtscript_QCompleter_ModelSorting_keys[static_cast<int>(value)];
 
128
    return QString();
 
129
}
 
130
 
 
131
static QScriptValue qtscript_QCompleter_ModelSorting_toScriptValue(QScriptEngine *engine, const QCompleter::ModelSorting &value)
 
132
{
 
133
    QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QCompleter"));
 
134
    return clazz.property(qtscript_QCompleter_ModelSorting_toStringHelper(value));
 
135
}
 
136
 
 
137
static void qtscript_QCompleter_ModelSorting_fromScriptValue(const QScriptValue &value, QCompleter::ModelSorting &out)
 
138
{
 
139
    out = qvariant_cast<QCompleter::ModelSorting>(value.toVariant());
 
140
}
 
141
 
 
142
static QScriptValue qtscript_construct_QCompleter_ModelSorting(QScriptContext *context, QScriptEngine *engine)
 
143
{
 
144
    int arg = context->argument(0).toInt32();
 
145
    if ((arg >= QCompleter::UnsortedModel) && (arg <= QCompleter::CaseInsensitivelySortedModel))
 
146
        return qScriptValueFromValue(engine,  static_cast<QCompleter::ModelSorting>(arg));
 
147
    return context->throwError(QString::fromLatin1("ModelSorting(): invalid enum value (%0)").arg(arg));
 
148
}
 
149
 
 
150
static QScriptValue qtscript_QCompleter_ModelSorting_valueOf(QScriptContext *context, QScriptEngine *engine)
 
151
{
 
152
    QCompleter::ModelSorting value = qscriptvalue_cast<QCompleter::ModelSorting>(context->thisObject());
 
153
    return QScriptValue(engine, static_cast<int>(value));
 
154
}
 
155
 
 
156
static QScriptValue qtscript_QCompleter_ModelSorting_toString(QScriptContext *context, QScriptEngine *engine)
 
157
{
 
158
    QCompleter::ModelSorting value = qscriptvalue_cast<QCompleter::ModelSorting>(context->thisObject());
 
159
    return QScriptValue(engine, qtscript_QCompleter_ModelSorting_toStringHelper(value));
 
160
}
 
161
 
 
162
static QScriptValue qtscript_create_QCompleter_ModelSorting_class(QScriptEngine *engine, QScriptValue &clazz)
 
163
{
 
164
    QScriptValue ctor = qtscript_create_enum_class_helper(
 
165
        engine, qtscript_construct_QCompleter_ModelSorting,
 
166
        qtscript_QCompleter_ModelSorting_valueOf, qtscript_QCompleter_ModelSorting_toString);
 
167
    qScriptRegisterMetaType<QCompleter::ModelSorting>(engine, qtscript_QCompleter_ModelSorting_toScriptValue,
 
168
        qtscript_QCompleter_ModelSorting_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
 
169
    for (int i = 0; i < 3; ++i) {
 
170
        clazz.setProperty(QString::fromLatin1(qtscript_QCompleter_ModelSorting_keys[i]),
 
171
            engine->newVariant(qVariantFromValue(qtscript_QCompleter_ModelSorting_values[i])),
 
172
            QScriptValue::ReadOnly | QScriptValue::Undeletable);
 
173
    }
 
174
    return ctor;
 
175
}
 
176
 
 
177
//
 
178
// QCompleter::CompletionMode
 
179
//
 
180
 
 
181
static const QCompleter::CompletionMode qtscript_QCompleter_CompletionMode_values[] = {
 
182
    QCompleter::PopupCompletion
 
183
    , QCompleter::UnfilteredPopupCompletion
 
184
    , QCompleter::InlineCompletion
 
185
};
 
186
 
 
187
static const char * const qtscript_QCompleter_CompletionMode_keys[] = {
 
188
    "PopupCompletion"
 
189
    , "UnfilteredPopupCompletion"
 
190
    , "InlineCompletion"
 
191
};
 
192
 
 
193
static QString qtscript_QCompleter_CompletionMode_toStringHelper(QCompleter::CompletionMode value)
 
194
{
 
195
    if ((value >= QCompleter::PopupCompletion) && (value <= QCompleter::InlineCompletion))
 
196
        return qtscript_QCompleter_CompletionMode_keys[static_cast<int>(value)];
 
197
    return QString();
 
198
}
 
199
 
 
200
static QScriptValue qtscript_QCompleter_CompletionMode_toScriptValue(QScriptEngine *engine, const QCompleter::CompletionMode &value)
 
201
{
 
202
    QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QCompleter"));
 
203
    return clazz.property(qtscript_QCompleter_CompletionMode_toStringHelper(value));
 
204
}
 
205
 
 
206
static void qtscript_QCompleter_CompletionMode_fromScriptValue(const QScriptValue &value, QCompleter::CompletionMode &out)
 
207
{
 
208
    out = qvariant_cast<QCompleter::CompletionMode>(value.toVariant());
 
209
}
 
210
 
 
211
static QScriptValue qtscript_construct_QCompleter_CompletionMode(QScriptContext *context, QScriptEngine *engine)
 
212
{
 
213
    int arg = context->argument(0).toInt32();
 
214
    if ((arg >= QCompleter::PopupCompletion) && (arg <= QCompleter::InlineCompletion))
 
215
        return qScriptValueFromValue(engine,  static_cast<QCompleter::CompletionMode>(arg));
 
216
    return context->throwError(QString::fromLatin1("CompletionMode(): invalid enum value (%0)").arg(arg));
 
217
}
 
218
 
 
219
static QScriptValue qtscript_QCompleter_CompletionMode_valueOf(QScriptContext *context, QScriptEngine *engine)
 
220
{
 
221
    QCompleter::CompletionMode value = qscriptvalue_cast<QCompleter::CompletionMode>(context->thisObject());
 
222
    return QScriptValue(engine, static_cast<int>(value));
 
223
}
 
224
 
 
225
static QScriptValue qtscript_QCompleter_CompletionMode_toString(QScriptContext *context, QScriptEngine *engine)
 
226
{
 
227
    QCompleter::CompletionMode value = qscriptvalue_cast<QCompleter::CompletionMode>(context->thisObject());
 
228
    return QScriptValue(engine, qtscript_QCompleter_CompletionMode_toStringHelper(value));
 
229
}
 
230
 
 
231
static QScriptValue qtscript_create_QCompleter_CompletionMode_class(QScriptEngine *engine, QScriptValue &clazz)
 
232
{
 
233
    QScriptValue ctor = qtscript_create_enum_class_helper(
 
234
        engine, qtscript_construct_QCompleter_CompletionMode,
 
235
        qtscript_QCompleter_CompletionMode_valueOf, qtscript_QCompleter_CompletionMode_toString);
 
236
    qScriptRegisterMetaType<QCompleter::CompletionMode>(engine, qtscript_QCompleter_CompletionMode_toScriptValue,
 
237
        qtscript_QCompleter_CompletionMode_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
 
238
    for (int i = 0; i < 3; ++i) {
 
239
        clazz.setProperty(QString::fromLatin1(qtscript_QCompleter_CompletionMode_keys[i]),
 
240
            engine->newVariant(qVariantFromValue(qtscript_QCompleter_CompletionMode_values[i])),
 
241
            QScriptValue::ReadOnly | QScriptValue::Undeletable);
 
242
    }
 
243
    return ctor;
 
244
}
 
245
 
 
246
//
 
247
// QCompleter
 
248
//
 
249
 
 
250
static QScriptValue qtscript_QCompleter_prototype_call(QScriptContext *context, QScriptEngine *)
 
251
{
 
252
#if QT_VERSION > 0x040400
 
253
    Q_ASSERT(context->callee().isFunction());
 
254
    uint _id = context->callee().data().toUInt32();
 
255
#else
 
256
    uint _id;
 
257
    if (context->callee().isFunction())
 
258
        _id = context->callee().data().toUInt32();
 
259
    else
 
260
        _id = 0xBABE0000 + 14;
 
261
#endif
 
262
    Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
 
263
    _id &= 0x0000FFFF;
 
264
    QCompleter* _q_self = qscriptvalue_cast<QCompleter*>(context->thisObject());
 
265
    if (!_q_self) {
 
266
        return context->throwError(QScriptContext::TypeError,
 
267
            QString::fromLatin1("QCompleter.%0(): this object is not a QCompleter")
 
268
            .arg(qtscript_QCompleter_function_names[_id+1]));
 
269
    }
 
270
 
 
271
    switch (_id) {
 
272
    case 0:
 
273
    if (context->argumentCount() == 0) {
 
274
        int _q_result = _q_self->completionCount();
 
275
        return QScriptValue(context->engine(), _q_result);
 
276
    }
 
277
    break;
 
278
 
 
279
    case 1:
 
280
    if (context->argumentCount() == 0) {
 
281
        QAbstractItemModel* _q_result = _q_self->completionModel();
 
282
        return qScriptValueFromValue(context->engine(), _q_result);
 
283
    }
 
284
    break;
 
285
 
 
286
    case 2:
 
287
    if (context->argumentCount() == 0) {
 
288
        QString _q_result = _q_self->currentCompletion();
 
289
        return QScriptValue(context->engine(), _q_result);
 
290
    }
 
291
    break;
 
292
 
 
293
    case 3:
 
294
    if (context->argumentCount() == 0) {
 
295
        QModelIndex _q_result = _q_self->currentIndex();
 
296
        return qScriptValueFromValue(context->engine(), _q_result);
 
297
    }
 
298
    break;
 
299
 
 
300
    case 4:
 
301
    if (context->argumentCount() == 0) {
 
302
        int _q_result = _q_self->currentRow();
 
303
        return QScriptValue(context->engine(), _q_result);
 
304
    }
 
305
    break;
 
306
 
 
307
    case 5:
 
308
    if (context->argumentCount() == 0) {
 
309
        QAbstractItemModel* _q_result = _q_self->model();
 
310
        return qScriptValueFromValue(context->engine(), _q_result);
 
311
    }
 
312
    break;
 
313
 
 
314
    case 6:
 
315
    if (context->argumentCount() == 1) {
 
316
        QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
 
317
        QString _q_result = _q_self->pathFromIndex(_q_arg0);
 
318
        return QScriptValue(context->engine(), _q_result);
 
319
    }
 
320
    break;
 
321
 
 
322
    case 7:
 
323
    if (context->argumentCount() == 0) {
 
324
        QAbstractItemView* _q_result = _q_self->popup();
 
325
        return qScriptValueFromValue(context->engine(), _q_result);
 
326
    }
 
327
    break;
 
328
 
 
329
    case 8:
 
330
    if (context->argumentCount() == 1) {
 
331
        int _q_arg0 = context->argument(0).toInt32();
 
332
        bool _q_result = _q_self->setCurrentRow(_q_arg0);
 
333
        return QScriptValue(context->engine(), _q_result);
 
334
    }
 
335
    break;
 
336
 
 
337
    case 9:
 
338
    if (context->argumentCount() == 1) {
 
339
        QAbstractItemModel* _q_arg0 = qscriptvalue_cast<QAbstractItemModel*>(context->argument(0));
 
340
        _q_self->setModel(_q_arg0);
 
341
        return context->engine()->undefinedValue();
 
342
    }
 
343
    break;
 
344
 
 
345
    case 10:
 
346
    if (context->argumentCount() == 1) {
 
347
        QAbstractItemView* _q_arg0 = qscriptvalue_cast<QAbstractItemView*>(context->argument(0));
 
348
        _q_self->setPopup(_q_arg0);
 
349
        return context->engine()->undefinedValue();
 
350
    }
 
351
    break;
 
352
 
 
353
    case 11:
 
354
    if (context->argumentCount() == 1) {
 
355
        QWidget* _q_arg0 = qscriptvalue_cast<QWidget*>(context->argument(0));
 
356
        _q_self->setWidget(_q_arg0);
 
357
        return context->engine()->undefinedValue();
 
358
    }
 
359
    break;
 
360
 
 
361
    case 12:
 
362
    if (context->argumentCount() == 1) {
 
363
        QString _q_arg0 = context->argument(0).toString();
 
364
        QStringList _q_result = _q_self->splitPath(_q_arg0);
 
365
        return qScriptValueFromSequence(context->engine(), _q_result);
 
366
    }
 
367
    break;
 
368
 
 
369
    case 13:
 
370
    if (context->argumentCount() == 0) {
 
371
        QWidget* _q_result = _q_self->widget();
 
372
        return qScriptValueFromValue(context->engine(), _q_result);
 
373
    }
 
374
    break;
 
375
 
 
376
    case 14: {
 
377
    QString result = QString::fromLatin1("QCompleter");
 
378
    return QScriptValue(context->engine(), result);
 
379
    }
 
380
 
 
381
    default:
 
382
    Q_ASSERT(false);
 
383
    }
 
384
    return qtscript_QCompleter_throw_ambiguity_error_helper(context,
 
385
        qtscript_QCompleter_function_names[_id+1],
 
386
        qtscript_QCompleter_function_signatures[_id+1]);
 
387
}
 
388
 
 
389
static QScriptValue qtscript_QCompleter_static_call(QScriptContext *context, QScriptEngine *)
 
390
{
 
391
    uint _id = context->callee().data().toUInt32();
 
392
    Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
 
393
    _id &= 0x0000FFFF;
 
394
    switch (_id) {
 
395
    case 0:
 
396
    if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
 
397
        return context->throwError(QString::fromLatin1("QCompleter(): Did you forget to construct with 'new'?"));
 
398
    }
 
399
    if (context->argumentCount() == 0) {
 
400
        QtScriptShell_QCompleter* _q_cpp_result = new QtScriptShell_QCompleter();
 
401
        QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QCompleter*)_q_cpp_result, QScriptEngine::AutoOwnership);
 
402
        _q_cpp_result->__qtscript_self = _q_result;
 
403
        return _q_result;
 
404
    } else if (context->argumentCount() == 1) {
 
405
        if (qscriptvalue_cast<QAbstractItemModel*>(context->argument(0))) {
 
406
            QAbstractItemModel* _q_arg0 = qscriptvalue_cast<QAbstractItemModel*>(context->argument(0));
 
407
            QtScriptShell_QCompleter* _q_cpp_result = new QtScriptShell_QCompleter(_q_arg0);
 
408
            QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QCompleter*)_q_cpp_result, QScriptEngine::AutoOwnership);
 
409
            _q_cpp_result->__qtscript_self = _q_result;
 
410
            return _q_result;
 
411
        } else if (context->argument(0).isQObject()) {
 
412
            QObject* _q_arg0 = context->argument(0).toQObject();
 
413
            QtScriptShell_QCompleter* _q_cpp_result = new QtScriptShell_QCompleter(_q_arg0);
 
414
            QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QCompleter*)_q_cpp_result, QScriptEngine::AutoOwnership);
 
415
            _q_cpp_result->__qtscript_self = _q_result;
 
416
            return _q_result;
 
417
        } else if (context->argument(0).isArray()) {
 
418
            QStringList _q_arg0;
 
419
            qScriptValueToSequence(context->argument(0), _q_arg0);
 
420
            QtScriptShell_QCompleter* _q_cpp_result = new QtScriptShell_QCompleter(_q_arg0);
 
421
            QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QCompleter*)_q_cpp_result, QScriptEngine::AutoOwnership);
 
422
            _q_cpp_result->__qtscript_self = _q_result;
 
423
            return _q_result;
 
424
        }
 
425
    } else if (context->argumentCount() == 2) {
 
426
        if (qscriptvalue_cast<QAbstractItemModel*>(context->argument(0))
 
427
            && context->argument(1).isQObject()) {
 
428
            QAbstractItemModel* _q_arg0 = qscriptvalue_cast<QAbstractItemModel*>(context->argument(0));
 
429
            QObject* _q_arg1 = context->argument(1).toQObject();
 
430
            QtScriptShell_QCompleter* _q_cpp_result = new QtScriptShell_QCompleter(_q_arg0, _q_arg1);
 
431
            QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QCompleter*)_q_cpp_result, QScriptEngine::AutoOwnership);
 
432
            _q_cpp_result->__qtscript_self = _q_result;
 
433
            return _q_result;
 
434
        } else if (context->argument(0).isArray()
 
435
            && context->argument(1).isQObject()) {
 
436
            QStringList _q_arg0;
 
437
            qScriptValueToSequence(context->argument(0), _q_arg0);
 
438
            QObject* _q_arg1 = context->argument(1).toQObject();
 
439
            QtScriptShell_QCompleter* _q_cpp_result = new QtScriptShell_QCompleter(_q_arg0, _q_arg1);
 
440
            QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QCompleter*)_q_cpp_result, QScriptEngine::AutoOwnership);
 
441
            _q_cpp_result->__qtscript_self = _q_result;
 
442
            return _q_result;
 
443
        }
 
444
    }
 
445
    break;
 
446
 
 
447
    default:
 
448
    Q_ASSERT(false);
 
449
    }
 
450
    return qtscript_QCompleter_throw_ambiguity_error_helper(context,
 
451
        qtscript_QCompleter_function_names[_id],
 
452
        qtscript_QCompleter_function_signatures[_id]);
 
453
}
 
454
 
 
455
static QScriptValue qtscript_QCompleter_toScriptValue(QScriptEngine *engine, QCompleter* const &in)
 
456
{
 
457
    return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
 
458
}
 
459
 
 
460
static void qtscript_QCompleter_fromScriptValue(const QScriptValue &value, QCompleter* &out)
 
461
{
 
462
    out = qobject_cast<QCompleter*>(value.toQObject());
 
463
}
 
464
 
 
465
QScriptValue qtscript_create_QCompleter_class(QScriptEngine *engine)
 
466
{
 
467
    static const int function_lengths[] = {
 
468
        2
 
469
        // static
 
470
        // prototype
 
471
        , 0
 
472
        , 0
 
473
        , 0
 
474
        , 0
 
475
        , 0
 
476
        , 0
 
477
        , 1
 
478
        , 0
 
479
        , 1
 
480
        , 1
 
481
        , 1
 
482
        , 1
 
483
        , 1
 
484
        , 0
 
485
        , 0
 
486
    };
 
487
    engine->setDefaultPrototype(qMetaTypeId<QCompleter*>(), QScriptValue());
 
488
    QScriptValue proto = engine->newVariant(qVariantFromValue((QCompleter*)0));
 
489
    proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
 
490
    for (int i = 0; i < 15; ++i) {
 
491
        QScriptValue fun = engine->newFunction(qtscript_QCompleter_prototype_call, function_lengths[i+1]);
 
492
        fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
 
493
        proto.setProperty(QString::fromLatin1(qtscript_QCompleter_function_names[i+1]),
 
494
            fun, QScriptValue::SkipInEnumeration);
 
495
    }
 
496
 
 
497
    qScriptRegisterMetaType<QCompleter*>(engine, qtscript_QCompleter_toScriptValue, 
 
498
        qtscript_QCompleter_fromScriptValue, proto);
 
499
 
 
500
    QScriptValue ctor = engine->newFunction(qtscript_QCompleter_static_call, proto, function_lengths[0]);
 
501
    ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
 
502
 
 
503
    ctor.setProperty(QString::fromLatin1("ModelSorting"),
 
504
        qtscript_create_QCompleter_ModelSorting_class(engine, ctor));
 
505
    ctor.setProperty(QString::fromLatin1("CompletionMode"),
 
506
        qtscript_create_QCompleter_CompletionMode_class(engine, ctor));
 
507
    return ctor;
 
508
}