* `w` to instanciate a new QWidget type and setObjectName
* `connectl` to connect object to lambda
* update `widget` to take the class name from the filename
snippet connect "Qt connect()" b
connect(${1:this}, SIGNAL(${2:signal()}),
${3:this}, SLOT(${4:slot()}));
snippet connect "Qt connect()" b
connect(${1:this}, SIGNAL(${2:signal()}),
${3:this}, SLOT(${4:slot()}));
+endsnippet
+
+snippet connectl "Qt connect() lambda" b
+connect(${1:this}, &${2:class::function},
+ [=](${3:void}) { ${4} });
+${0}
+endsnippet
+
+snippet w "Define a new QWidget" b
+auto ${1:widget} = new ${2:QWidget};
+$1->setObjectName("${3:$1}");
${0}
endsnippet
snippet widget "Qt Widget Class" b
${0}
endsnippet
snippet widget "Qt Widget Class" b
-class ${1:WidgetClass} : public QWidget
+class ${1:`!p snip.rv = snip.basename or "WidgetClass"`} : public QWidget
{
Q_OBJECT
public:
explicit $1(${2}QWidget *parent = 0);
{
Q_OBJECT
public:
explicit $1(${2}QWidget *parent = 0);
+}; // class${1/.+/ $0/m}
endsnippet
# http://stackoverflow.com/a/9864472
endsnippet
# http://stackoverflow.com/a/9864472