Qt Property snippet for Visual Studio
3
Apr
2014
- <?xmlversion=“1.0“encoding=“utf-8“ ?>
- <CodeSnippetsxmlns=“http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet“>
- <CodeSnippetFormat=“1.0.0“>
- <Header>
- <Title>Qt Property</Title>
- <Shortcut>QtProp</Shortcut>
- <Description>
- Code snippet for an automatically implemented Qt property
- Language Version: C++ Qt
- </Description>
- <Author>cihant</Author>
- <SnippetTypes>
- <SnippetType>Expansion</SnippetType>
- </SnippetTypes>
- </Header>
- <Snippet>
- <Declarations>
- <Literal>
- <ID>type</ID>
- <ToolTip>Property type</ToolTip>
- <Default>QString</Default>
- </Literal>
- <Literal>
- <ID>propertyName</ID>
- <ToolTip>Property name</ToolTip>
- <Default>MyProperty</Default>
- </Literal>
- </Declarations>
- <CodeLanguage=“csharp“>
- <![CDATA[
- public: /* $propertyName$ Property */
- Q_PROPERTY($type$ $propertyName$ READ $propertyName$ WRITE set$propertyName$ NOTIFY $propertyName$Changed)
- $type$ $propertyName$() const { return m_$propertyName$; }
- public Q_SLOT:
- void set$propertyName$($type$ _$propertyName$) { if(m_$propertyName$ != _$propertyName$){m_$propertyName$ = _$propertyName$; emit $propertyName$Changed(_$propertyName$); } }
- private:
- $type$ m_$propertyName$;
- Q_SIGNAL:
- void $propertyName$Changed($type$ $propertyName$);
- ]]>
- </Code>
- </Snippet>
- </CodeSnippet>
- </CodeSnippets>
Recent Comments