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
Tobias Hunger
qt-creator
Commits
bb64cc70
Commit
bb64cc70
authored
Aug 05, 2010
by
Thomas Hartmann
Browse files
QtQuickToolbar: adds isAvailable() to IContextPane
isAvailable() returns true if a Quick ToolBar is available for that node
parent
d02c4083
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/libs/qmljs/qmljsicontextpane.h
View file @
bb64cc70
...
...
@@ -54,6 +54,7 @@ public:
virtual
~
IContextPane
()
{}
virtual
void
apply
(
TextEditor
::
BaseTextEditorEditable
*
editor
,
Document
::
Ptr
doc
,
const
QmlJS
::
Snapshot
&
snapshot
,
AST
::
Node
*
node
,
bool
update
,
bool
force
=
false
)
=
0
;
virtual
void
setEnabled
(
bool
)
=
0
;
virtual
bool
isAvailable
(
TextEditor
::
BaseTextEditorEditable
*
editor
,
Document
::
Ptr
doc
,
const
QmlJS
::
Snapshot
&
snapshot
,
AST
::
Node
*
node
)
=
0
;
virtual
QWidget
*
widget
()
=
0
;
};
...
...
src/plugins/qmldesigner/qmlcontextpane.cpp
View file @
bb64cc70
...
...
@@ -68,8 +68,10 @@ QmlContextPane::~QmlContextPane()
void
QmlContextPane
::
apply
(
TextEditor
::
BaseTextEditorEditable
*
editor
,
Document
::
Ptr
doc
,
const
QmlJS
::
Snapshot
&
snapshot
,
AST
::
Node
*
node
,
bool
update
,
bool
force
)
{
if
(
!
Internal
::
BauhausPlugin
::
pluginInstance
()
->
settings
().
enableContextPane
&&
!
force
)
if
(
!
Internal
::
BauhausPlugin
::
pluginInstance
()
->
settings
().
enableContextPane
&&
!
force
&&
!
update
)
{
contextWidget
()
->
hide
();
return
;
}
if
(
doc
.
isNull
())
return
;
...
...
@@ -169,6 +171,36 @@ void QmlContextPane::apply(TextEditor::BaseTextEditorEditable *editor, Document:
}
bool
QmlContextPane
::
isAvailable
(
TextEditor
::
BaseTextEditorEditable
*
,
Document
::
Ptr
doc
,
const
QmlJS
::
Snapshot
&
snapshot
,
AST
::
Node
*
node
)
{
if
(
doc
.
isNull
())
return
false
;
if
(
!
node
)
return
false
;
LookupContext
::
Ptr
lookupContext
=
LookupContext
::
create
(
doc
,
snapshot
,
QList
<
Node
*>
());
const
Interpreter
::
ObjectValue
*
scopeObject
=
doc
->
bind
()
->
findQmlObject
(
node
);
QStringList
prototypes
;
while
(
scopeObject
)
{
prototypes
.
append
(
scopeObject
->
className
());
scopeObject
=
scopeObject
->
prototype
(
lookupContext
->
context
());
}
if
(
prototypes
.
contains
(
"Rectangle"
)
||
prototypes
.
contains
(
"Image"
)
||
prototypes
.
contains
(
"BorderImage"
)
||
prototypes
.
contains
(
"TextEdit"
)
||
prototypes
.
contains
(
"TextInput"
)
||
prototypes
.
contains
(
"PropertyAnimation"
)
||
prototypes
.
contains
(
"Text"
))
return
true
;
return
false
;
}
void
QmlContextPane
::
setProperty
(
const
QString
&
propertyName
,
const
QVariant
&
value
)
{
...
...
src/plugins/qmldesigner/qmlcontextpane.h
View file @
bb64cc70
...
...
@@ -29,6 +29,7 @@ public:
QmlContextPane
(
QObject
*
parent
=
0
);
~
QmlContextPane
();
void
apply
(
TextEditor
::
BaseTextEditorEditable
*
editor
,
QmlJS
::
Document
::
Ptr
doc
,
const
QmlJS
::
Snapshot
&
snapshot
,
QmlJS
::
AST
::
Node
*
node
,
bool
update
,
bool
force
=
0
);
bool
isAvailable
(
TextEditor
::
BaseTextEditorEditable
*
editor
,
QmlJS
::
Document
::
Ptr
doc
,
const
QmlJS
::
Snapshot
&
snapshot
,
QmlJS
::
AST
::
Node
*
node
);
void
setProperty
(
const
QString
&
propertyName
,
const
QVariant
&
value
);
void
removeProperty
(
const
QString
&
propertyName
);
void
setEnabled
(
bool
);
...
...
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