Reformatted the code

This commit is contained in:
Filippo Cucchetto 2015-01-31 17:01:03 +01:00
parent 27db2ef854
commit 8e36e4d957
11 changed files with 95 additions and 96 deletions

View File

@ -25,8 +25,6 @@ class BaseQAbstractListModel : public QAbstractListModel
/// Return the roleNames /// Return the roleNames
virtual QHash<int, QByteArray> roleNames() const override; virtual QHash<int, QByteArray> roleNames() const override;
private: private:
void* m_modelObject; void* m_modelObject;
RowCountCallback m_rowCountCallback; RowCountCallback m_rowCountCallback;

View File

@ -59,17 +59,11 @@ DynamicProperty::DynamicProperty(const DynamicProperty& other)
DynamicProperty& DynamicProperty::operator=(const DynamicProperty& other) DynamicProperty& DynamicProperty::operator=(const DynamicProperty& other)
{ {
if (!other.d && d) if (!other.d && d)
{
d.reset(); d.reset();
}
else if (other.d && !d) else if (other.d && !d)
{
d.reset(new PropertyData(*other.d)); d.reset(new PropertyData(*other.d));
}
else if (other.d && d) else if (other.d && d)
{
*d = *other.d; *d = *other.d;
}
return *this; return *this;
} }

View File

@ -23,7 +23,9 @@ public:
QString name() const; QString name() const;
QMetaType::Type type() const; QMetaType::Type type() const;
bool isValid() const { return d != nullptr; } bool isValid() const {
return d != nullptr;
}
bool isReadable() const; bool isReadable() const;
bool isWriteable() const; bool isWriteable() const;

View File

@ -22,10 +22,14 @@ public:
virtual ~DynamicQObject(); virtual ~DynamicQObject();
/// Sets the function to be called from C++ to D or Nimrod /// Sets the function to be called from C++ to D or Nimrod
void setDObjectCallback(Callback callback) { m_dObjectCallback = callback; } void setDObjectCallback(Callback callback) {
m_dObjectCallback = callback;
}
/// Sets the D or Nimrod object that owns this DynamicQObject /// Sets the D or Nimrod object that owns this DynamicQObject
void setDObjectPointer(void* dObjectPointer) { m_dObjectPointer = dObjectPointer; } void setDObjectPointer(void* dObjectPointer) {
m_dObjectPointer = dObjectPointer;
}
/// Register a new signal /// Register a new signal
bool registerSignal(const QString& name, bool registerSignal(const QString& name,

View File

@ -6,6 +6,7 @@ import tables
type type
Roles {.pure.} = enum Roles {.pure.} = enum
Name = cint(0) Name = cint(0)
MyQAbstractListModel = ref object of QAbstractListModel MyQAbstractListModel = ref object of QAbstractListModel
m_roleNames: Table[int, cstring] m_roleNames: Table[int, cstring]
m_names: seq[string] m_names: seq[string]