forked from qt-creator/qt-creator
Snippets: Make it flexible for adding builtin snippets
Instead of in one XML embedded as a resource, now builtin snippets can be specified on any XML distributed under share.
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<snippets>
|
||||
<snippet group="C++" trigger="class" id="cpp_genericclass">class $name$
|
||||
{
|
||||
public:
|
||||
$name$() {}
|
||||
};</snippet>
|
||||
<snippet group="C++" trigger="class" id="cpp_qobjectclass" complement="derived from QObject">class $name$ : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
$name$() {}
|
||||
virtual ~$name$() {}
|
||||
};</snippet>
|
||||
<snippet group="C++" trigger="class" id="cpp_qwidgetclass" complement="derived from QWidget">class $name$ : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
$name$() {}
|
||||
virtual ~$name$() {}
|
||||
};</snippet>
|
||||
<snippet group="C++" trigger="class" id="cpp_classtemplate" complement="template">template <typename $T$>
|
||||
class $name$
|
||||
{
|
||||
public:
|
||||
$name$() {}
|
||||
};</snippet>
|
||||
<snippet group="C++" trigger="do" id="cpp_do">do {
|
||||
|
||||
} while ($condition$);</snippet>
|
||||
<snippet group="C++" trigger="else" id="cpp_else" >else {
|
||||
|
||||
}</snippet>
|
||||
<snippet group="C++" trigger="else" id="cpp_elsewithif" complement="with if">else if ($condition$) {
|
||||
|
||||
}</snippet>
|
||||
<snippet group="C++" trigger="for" id="cpp_for">for (int $var$ = 0; $var$ < $total$; ++$var$) {
|
||||
|
||||
}</snippet>
|
||||
<snippet group="C++" trigger="foreach" id="cpp_foreach">foreach ($var$, $container$) {
|
||||
|
||||
}</snippet>
|
||||
<snippet group="C++" trigger="if" id="cpp_if">if ($condition$) {
|
||||
|
||||
}</snippet>
|
||||
<snippet group="C++" trigger="if" id="cpp_ifandelse" complement="and else">if ($condition$) {
|
||||
|
||||
} else {
|
||||
|
||||
}</snippet>
|
||||
<snippet group="C++" trigger="namespace" id="cpp_namespace">namespace $name$ {
|
||||
|
||||
}</snippet>
|
||||
<snippet group="C++" trigger="try" id="cpp_trycatch" complement="and catch">try {
|
||||
|
||||
} catch (...) {
|
||||
|
||||
}</snippet>
|
||||
<snippet group="C++" trigger="using" id="cpp_usingnamespace" complement="namespace">using namespace $name$;</snippet>
|
||||
<snippet group="C++" trigger="while" id="cpp_while">while ($condition$) {
|
||||
|
||||
}</snippet>
|
||||
</snippets>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<snippets>
|
||||
<snippet group="QML" trigger="property" id="qml_property">property $type$ $name$: $value$</snippet>
|
||||
<snippet group="QML" trigger="Item" id="qml_item">Item {
|
||||
id: $name$
|
||||
}</snippet>
|
||||
<snippet group="QML" trigger="BorderImage" id="qml_borderimage">BorderImage {
|
||||
id: $name$
|
||||
source: "$file$"
|
||||
width: $100$; height: $100$
|
||||
border.left: $5$; border.top: $5$
|
||||
border.right: $5$; border.bottom: $5$
|
||||
}</snippet>
|
||||
<snippet group="QML" trigger="Image" id="qml_image">Image {
|
||||
id: $name$
|
||||
source: "$file$"
|
||||
}</snippet>
|
||||
<snippet group="QML" trigger="Text" id="qml_text">Text {
|
||||
id: $name$
|
||||
text: "$text$"
|
||||
}</snippet>
|
||||
<snippet group="QML" trigger="states" id="qml_states">states: [
|
||||
State {
|
||||
name: "$name$"
|
||||
PropertyChanges {
|
||||
target: $name$
|
||||
$$
|
||||
}
|
||||
}
|
||||
]</snippet>
|
||||
<snippet group="QML" trigger="State" id="qml_state">State {
|
||||
name: "$name$"
|
||||
PropertyChanges {
|
||||
target: $name$
|
||||
$$
|
||||
}
|
||||
}</snippet>
|
||||
<snippet group="QML" trigger="transitions" id="qml_transitions">transitions: [
|
||||
Transition {
|
||||
from: "$name$"
|
||||
to: "$name$"
|
||||
$$
|
||||
}
|
||||
]</snippet>
|
||||
<snippet group="QML" trigger="Transition" id="qml_transition">Transition {
|
||||
from: "$name$"
|
||||
to: "$name$"
|
||||
$$
|
||||
}</snippet>
|
||||
<snippet group="QML" trigger="PropertyChanges" id="qml_propertychanges">PropertyChanges {
|
||||
target: $name$
|
||||
$$
|
||||
}</snippet>
|
||||
<snippet group="QML" trigger="NumberAnimation" id="qml_numberanimationwithtargets" complement="with targets">NumberAnimation { targets: [$name$]; properties: "$name$"; duration: $200$ }</snippet>
|
||||
<snippet group="QML" trigger="NumberAnimation" id="qml_numberanimationwithtarget" complement="with target">NumberAnimation { target: $name$; property: "$name$"; to: $value$; duration: $200$ }</snippet>
|
||||
<snippet group="QML" trigger="PropertyAction" id="qml_propertyactionwithtargets" complement="with targets">PropertyAction { targets: [$name$]; properties: "$name$" }</snippet>
|
||||
<snippet group="QML" trigger="PropertyAction" id="qml_propertyactionwithtarget" complement="with target">PropertyAction { target: $name$; property: "$name$"; value: $value$ }</snippet>
|
||||
<snippet group="QML" trigger="PauseAnimation" id="qml_pauseanimation">PauseAnimation { duration: $200$ }</snippet>
|
||||
<snippet group="QML" trigger="ColorAnimation" id="qml_coloranimation">ColorAnimation { from: $"white"$; to: $"black"$; duration: $200$ }</snippet>
|
||||
</snippets>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<snippets>
|
||||
<snippet group="Text" trigger="global" id="text_global" complement="example">// This is available in all editors.</snippet>
|
||||
</snippets>
|
||||
Reference in New Issue
Block a user