Skip to content
GitLab
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
74610a91
Commit
74610a91
authored
Jul 09, 2010
by
Thomas Hartmann
Browse files
QmlDesigner: change interface for context pane
parent
4d9fae56
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/libs/qmljs/qmljsicontextpane.h
View file @
74610a91
...
...
@@ -52,7 +52,7 @@ class QMLJS_EXPORT IContextPane : public QObject
public:
IContextPane
(
QObject
*
parent
=
0
)
:
QObject
(
parent
)
{}
virtual
~
IContextPane
()
{}
virtual
void
apply
(
TextEditor
::
BaseTextEditorEditable
*
editor
,
Document
::
Ptr
doc
,
AST
::
Node
*
node
,
bool
update
)
=
0
;
virtual
void
apply
(
TextEditor
::
BaseTextEditorEditable
*
editor
,
Document
::
Ptr
doc
,
const
QmlJS
::
Snapshot
&
snapshot
,
AST
::
Node
*
node
,
bool
update
)
=
0
;
virtual
void
setEnabled
(
bool
)
=
0
;
};
...
...
src/plugins/qmldesigner/components/propertyeditor/contextpanewidget.h
View file @
74610a91
...
...
@@ -22,8 +22,8 @@ class ContextPaneWidget : public QFrame
public:
explicit
ContextPaneWidget
(
QWidget
*
parent
=
0
);
~
ContextPaneWidget
();
void
activate
(
const
QPoint
&
pos
,
const
QPoint
&
alternative
);
void
rePosition
(
const
QPoint
&
pos
,
const
QPoint
&
alternative
);
void
activate
(
const
QPoint
&
pos
,
const
QPoint
&
alternative
,
const
QPoint
&
alternative2
);
void
rePosition
(
const
QPoint
&
pos
,
const
QPoint
&
alternative
,
const
QPoint
&
alternative3
);
void
deactivate
();
BauhausColorDialog
*
colorDialog
();
void
setProperties
(
QmlJS
::
PropertyReader
*
propertyReader
);
...
...
src/plugins/qmldesigner/qmlcontextpane.cpp
View file @
74610a91
...
...
@@ -8,6 +8,9 @@
#include
<qmljs/qmljspropertyreader.h>
#include
<qmljs/qmljsrewriter.h>
#include
<qmljs/qmljsindenter.h>
#include
<qmljs/qmljslookupcontext.h>
#include
<qmljs/qmljsinterpreter.h>
#include
<qmljs/qmljsbind.h>
#include
<texteditor/basetexteditor.h>
#include
<texteditor/tabsettings.h>
#include
<colorwidget.h>
...
...
@@ -62,7 +65,7 @@ QmlContextPane::~QmlContextPane()
m_widget
.
clear
();
}
void
QmlContextPane
::
apply
(
TextEditor
::
BaseTextEditorEditable
*
editor
,
Document
::
Ptr
doc
,
Node
*
node
,
bool
update
)
void
QmlContextPane
::
apply
(
TextEditor
::
BaseTextEditorEditable
*
editor
,
Document
::
Ptr
doc
,
const
QmlJS
::
Snapshot
&
snapshot
,
AST
::
Node
*
node
,
bool
update
)
{
if
(
!
Internal
::
BauhausPlugin
::
pluginInstance
()
->
settings
().
enableContextPane
)
return
;
...
...
@@ -73,6 +76,15 @@ void QmlContextPane::apply(TextEditor::BaseTextEditorEditable *editor, Document:
if
(
update
&&
editor
!=
m_editor
)
return
;
//do not update for different editor
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
());
}
setEnabled
(
doc
->
isParsedCorrectly
());
m_editor
=
editor
;
contextWidget
()
->
setParent
(
editor
->
widget
()
->
parentWidget
());
...
...
src/plugins/qmljseditor/qmljseditor.cpp
View file @
74610a91
...
...
@@ -1085,7 +1085,7 @@ bool QmlJSTextEditor::event(QEvent *e)
switch
(
e
->
type
())
{
case
QEvent
::
ShortcutOverride
:
if
(
static_cast
<
QKeyEvent
*>
(
e
)
->
key
()
==
Qt
::
Key_Escape
&&
m_contextPane
)
{
m_contextPane
->
apply
(
editableInterface
(),
m_semanticInfo
.
document
,
0
,
false
);
m_contextPane
->
apply
(
editableInterface
(),
m_semanticInfo
.
document
,
m_semanticInfo
.
snapshot
,
0
,
false
);
}
break
;
default:
...
...
@@ -1100,7 +1100,7 @@ void QmlJSTextEditor::wheelEvent(QWheelEvent *event)
{
BaseTextEditor
::
wheelEvent
(
event
);
if
(
m_contextPane
)
m_contextPane
->
apply
(
editableInterface
(),
m_semanticInfo
.
document
,
m_semanticInfo
.
declaringMember
(
position
()),
true
);
m_contextPane
->
apply
(
editableInterface
(),
m_semanticInfo
.
document
,
m_semanticInfo
.
snapshot
,
m_semanticInfo
.
declaringMember
(
position
()),
true
);
}
void
QmlJSTextEditor
::
unCommentSelection
()
...
...
@@ -1344,7 +1344,7 @@ void QmlJSTextEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
if
(
m_contextPane
)
{
Node
*
newNode
=
m_semanticInfo
.
declaringMember
(
position
());
if
(
newNode
)
{
m_contextPane
->
apply
(
editableInterface
(),
doc
,
newNode
,
true
);
m_contextPane
->
apply
(
editableInterface
(),
doc
,
m_semanticInfo
.
snapshot
,
newNode
,
true
);
m_oldCurserPosition
=
position
();
}
}
...
...
@@ -1361,11 +1361,13 @@ void QmlJSTextEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
void
QmlJSTextEditor
::
onCursorPositionChanged
()
{
if
(
m_contextPane
)
{
Node
*
newNode
=
m_semanticInfo
.
declaringMember
(
position
());
Node
*
oldNode
=
m_semanticInfo
.
declaringMember
(
m_oldCurserPosition
);
if
(
oldNode
!=
newNode
)
m_contextPane
->
apply
(
editableInterface
(),
m_semanticInfo
.
document
,
newNode
,
false
);
m_contextPane
->
apply
(
editableInterface
(),
m_semanticInfo
.
document
,
m_semanticInfo
.
snapshot
,
newNode
,
false
);
m_oldCurserPosition
=
position
();
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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