<table><tr><td style="">kossebau added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D4435" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>The QObject non-pimpl changes are supposed to be in a different commit, only added here for the big picture. That commit extracts reusable snippets and adds creation of signals for the properties,</p>
<p>Example generation:<br />
name: KDevelop::Foo<br />
member: QString bar<br />
methods selected: constructor, copy constructor, destructor, event()</p>
<p>foo.h:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">/*
* <one line to give the library's name and an idea of what it does.>
* Copyright (C) 2017 Hans Entwickler <email>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef KDEVELOP_FOO_H
#define KDEVELOP_FOO_H
#include <qt5/QtCore/QObject>
namespace KDevelop {
/**
* @todo write docs
*/
class Foo : public QObject
{
Q_OBJECT
Q_PROPERTY(QString bar READ bar WRITE setBar NOTIFY barChanged)
public:
/**
* Default constructor
*/
Foo();
/**
* Copy Constructor
*
* @param other TODO
*/
Foo(const Foo& other);
/**
* Destructor
*/
~Foo();
/**
* @todo write docs
*
* @param event TODO
* @return TODO
*/
virtual bool event(QEvent* event);
/**
* @return the bar
*/
QString bar() const;
public Q_SLOTS:
/**
* Sets the bar.
*
* @param bar the new bar
*/
void setBar(const QString& bar);
Q_SIGNALS:
void barChanged(const QString& bar);
private:
class FooPrivate* const d_ptr;
Q_DECLARE_PRIVATE(Foo)
};
}
#endif // KDEVELOP_FOO_H</pre></div>
<p>foo_p.h:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">/*
* <one line to give the library's name and an idea of what it does.>
* Copyright (C) 2017 Hans Entwickler <email>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef KDEVELOP_FOO_P_H
#define KDEVELOP_FOO_P_H
namespace KDevelop {
/**
* @todo write docs
*/
class FooPrivate
{
public:
QString bar;
};
}
#endif // KDEVELOP_FOO_P_H</pre></div>
<p>foo.cpp:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">/*
* <one line to give the library's name and an idea of what it does.>
* Copyright (C) 2017 Hans Entwickler <email>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "foo.h"
#include "foo_p.h"
using namespace KDevelop;
Foo::Foo()
: d_ptr(new FooPrivate())
{
}
Foo::Foo(const Foo& other)
: d_ptr(new FooPrivate())
{
}
Foo::~Foo()
{
delete d_ptr;
}
bool Foo::event(QEvent* event)
{
}
QString Foo::bar() const
{
Q_D(const Foo);
return d->bar;
}
void Foo::setBar(const QString& bar)
{
Q_D(Foo);
if (d->bar == bar) {
return;
}
d->bar = bar;
emit barChanged(d->bar);
}</pre></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D4435" rel="noreferrer">https://phabricator.kde.org/D4435</a></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href="https://phabricator.kde.org/settings/panel/emailpreferences/" rel="noreferrer">https://phabricator.kde.org/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>kossebau, KDevelop<br /><strong>Cc: </strong>kdevelop-devel<br /></div>