Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
bf8c0b8a
Commit
bf8c0b8a
authored
Jan 26, 2010
by
Roberto Raggi
Browse files
Complete signals, slots and generate slots of QML items.
parent
2a5506b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/libs/qmljs/qmljsinterpreter.cpp
View file @
bf8c0b8a
...
...
@@ -77,25 +77,30 @@ public:
for
(
int
index
=
0
;
index
<
_metaObject
->
methodCount
();
++
index
)
{
QMetaMethod
meth
=
_metaObject
->
method
(
index
);
if
(
meth
.
methodType
()
!=
QMetaMethod
::
Signal
)
continue
;
if
(
meth
.
access
()
==
QMetaMethod
::
Private
)
continue
;
const
QString
signature
=
QString
::
fromUtf8
(
meth
.
signature
());
int
indexOfParen
=
signature
.
indexOf
(
QLatin1Char
(
'('
));
const
int
indexOfParen
=
signature
.
indexOf
(
QLatin1Char
(
'('
));
if
(
indexOfParen
==
-
1
)
continue
;
// skip it, invalid signature.
const
QString
signalName
=
signature
.
left
(
indexOfParen
);
QString
slotName
;
slotName
+=
QLatin1String
(
"on"
);
slotName
+=
signalName
.
at
(
0
).
toUpper
();
slotName
+=
signalName
.
midRef
(
1
);
const
QString
methodName
=
signature
.
left
(
indexOfParen
);
processor
->
processSignal
(
signalName
,
engine
()
->
undefinedValue
());
// ### FIXME: assign a decent type to the signal
processor
->
processSlot
(
slotName
,
engine
()
->
undefinedValue
());
// ### FIXME: assign a decent type to the slot
if
(
meth
.
methodType
()
==
QMetaMethod
::
Slot
&&
meth
.
access
()
==
QMetaMethod
::
Public
)
{
processor
->
processSlot
(
methodName
,
engine
()
->
undefinedValue
());
}
else
if
(
meth
.
methodType
()
==
QMetaMethod
::
Signal
&&
meth
.
access
()
!=
QMetaMethod
::
Private
)
{
// process the signal
processor
->
processSignal
(
methodName
,
engine
()
->
undefinedValue
());
// ### FIXME: assign a decent type to the signal
QString
slotName
;
slotName
+=
QLatin1String
(
"on"
);
slotName
+=
methodName
.
at
(
0
).
toUpper
();
slotName
+=
methodName
.
midRef
(
1
);
// process the generated slot
processor
->
processGeneratedSlot
(
slotName
,
engine
()
->
undefinedValue
());
// ### FIXME: assign a decent type to the slot
}
}
ObjectValue
::
processMembers
(
processor
);
...
...
@@ -584,6 +589,11 @@ bool MemberProcessor::processSlot(const QString &, const Value *)
return
true
;
}
bool
MemberProcessor
::
processGeneratedSlot
(
const
QString
&
,
const
Value
*
)
{
return
true
;
}
ObjectValue
::
ObjectValue
(
Engine
*
engine
)
:
_engine
(
engine
),
_prototype
(
0
),
_scope
(
0
)
{
...
...
src/libs/qmljs/qmljsinterpreter.h
View file @
bf8c0b8a
...
...
@@ -205,6 +205,7 @@ public:
virtual
bool
processProperty
(
const
QString
&
name
,
const
Value
*
value
);
virtual
bool
processSignal
(
const
QString
&
name
,
const
Value
*
value
);
virtual
bool
processSlot
(
const
QString
&
name
,
const
Value
*
value
);
virtual
bool
processGeneratedSlot
(
const
QString
&
name
,
const
Value
*
value
);
};
class
QMLJS_EXPORT
ObjectValue
:
public
Value
,
public
Environment
...
...
src/plugins/qmljseditor/qmlcodecompletion.cpp
View file @
bf8c0b8a
...
...
@@ -410,7 +410,21 @@ private:
return
true
;
}
virtual
bool
processSignal
(
const
QString
&
name
,
const
Interpreter
::
Value
*
value
)
{
if
(
!
_globalCompletion
)
_properties
.
insert
(
name
,
value
);
return
true
;
}
virtual
bool
processSlot
(
const
QString
&
name
,
const
Interpreter
::
Value
*
value
)
{
if
(
!
_globalCompletion
)
_properties
.
insert
(
name
,
value
);
return
true
;
}
virtual
bool
processGeneratedSlot
(
const
QString
&
name
,
const
Interpreter
::
Value
*
value
)
{
if
(
_globalCompletion
)
_properties
.
insert
(
name
,
value
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment