Qt Property snippet for Visual Studio

3 Apr
2014
  1. <?xmlversion=1.0encoding=utf-8 ?>
  2.   <CodeSnippetsxmlns=http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet>
  3.   <CodeSnippetFormat=1.0.0>
  4.     <Header>
  5.       <Title>Qt Property</Title>
  6.       <Shortcut>QtProp</Shortcut>
  7.       <Description>
  8.         Code snippet for an automatically implemented Qt property
  9.         Language Version: C++ Qt
  10.       </Description>
  11.       <Author>cihant</Author>
  12.       <SnippetTypes>
  13.         <SnippetType>Expansion</SnippetType>
  14.       </SnippetTypes>
  15.     </Header>
  16.     <Snippet>
  17.       <Declarations>
  18.         <Literal>
  19.           <ID>type</ID>
  20.           <ToolTip>Property type</ToolTip>
  21.           <Default>QString</Default>
  22.         </Literal>
  23.         <Literal>
  24.           <ID>propertyName</ID>
  25.           <ToolTip>Property name</ToolTip>
  26.           <Default>MyProperty</Default>
  27.         </Literal>
  28.       </Declarations>
  29.       <CodeLanguage=csharp>
  30.         <![CDATA[
  31. public: /* $propertyName$ Property */                                                                         
  32.     Q_PROPERTY($type$ $propertyName$ READ $propertyName$ WRITE set$propertyName$ NOTIFY $propertyName$Changed)
  33.     $type$ $propertyName$() const { return m_$propertyName$; }
  34. public Q_SLOT:
  35.     void set$propertyName$($type$ _$propertyName$) { if(m_$propertyName$ != _$propertyName$){m_$propertyName$ = _$propertyName$; emit $propertyName$Changed(_$propertyName$); }  }
  36. private:
  37.         $type$ m_$propertyName$;
  38. Q_SIGNAL:
  39.     void $propertyName$Changed($type$ $propertyName$);
  40.             ]]>
  41.       </Code>
  42.     </Snippet>
  43.   </CodeSnippet>
  44. </CodeSnippets>
Be Sociable, Share!

Comment Form

You must be logged in to post a comment.

top