Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.86 KB | None | 0 0
  1. Q_PROPERTY(QQmlListProperty<$type$> $list_name$ READ $list_name$ NOTIFY $list_name$Changed)
  2.  
  3. public:
  4.     QQmlListProperty<$type$> $list_name$()
  5.     {
  6.         return QQmlListProperty<$type$>(this,
  7.                                         this,
  8.                                         &$%{CurrentDocument:FileBaseName}$::append$list_name:c$,
  9.                                         &$%{CurrentDocument:FileBaseName}$::$list_name$Count,
  10.                                         &$%{CurrentDocument:FileBaseName}$::$list_name$ByIndex,
  11.                                         &$%{CurrentDocument:FileBaseName}$::clear$list_name:c$);
  12.     }
  13.     void append$list_name:c$($type$ * item)
  14.     {
  15.         /* TODO: implement*/
  16.     }
  17.    
  18.     int $list_name$Count() const
  19.     {
  20.         /* TODO: implement*/
  21.     }
  22.    
  23.     $type$ * $list_name$ByIndex(int index) const
  24.     {
  25.         /* TODO: implement*/
  26.     }
  27.    
  28.     void clear$list_name:c$()
  29.     {
  30.         /* TODO: implement*/
  31.     }
  32.  
  33. signals:
  34.     void $list_name$Changed(QQmlListProperty<$type$> $list_name$);
  35.  
  36. private:
  37.     static void append$list_name:c$(QQmlListProperty<$type$> * list, $type$ * item)
  38.     {
  39.         reinterpret_cast<$%{CurrentDocument:FileBaseName}$*>(list->data)->append$list_name:c$(item);
  40.     }
  41.    
  42.     static int $list_name$Count(QQmlListProperty<$type$> * list)
  43.     {
  44.         return reinterpret_cast<$%{CurrentDocument:FileBaseName}$*>(list->data)->$list_name$Count();
  45.     }
  46.    
  47.     static $type$* $list_name$ByIndex(QQmlListProperty<$type$> * list, int index)
  48.     {
  49.         return reinterpret_cast<$%{CurrentDocument:FileBaseName}$*>(list->data)->$list_name$ByIndex(index);
  50.     }
  51.    
  52.     static void clear$list_name:c$(QQmlListProperty<$type$> * list)
  53.     {
  54.         reinterpret_cast<$%{CurrentDocument:FileBaseName}$*>(list->data)->clear$list_name:c$();
  55.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement