Details
Details
- Reviewers
kfunk - Group Reviewers
KDevelop - Commits
- R32:d6093beea8f9: Feature: add template for QDialog (pimp) with a UI File
Diff Detail
Diff Detail
- Repository
- R32 KDevelop
- Branch
- addqdialogtemplate
- Lint
No Linters Available - Unit
No Unit Test Coverage
Comment Actions
Get created template from https://share.kde.org/index.php/s/eimwxBm0TwqKG2G
Example for created files:
class name: Foo::BarDialog
methods: constructor
license: none
options: window title -> "My empty dialog", button set -> "Close"
bardialog.h:
#ifndef FOO_BARDIALOG_H #define FOO_BARDIALOG_H #include <QDialog> namespace Foo { class BarDialogPrivate; /** * @todo write docs */ class BarDialog : public QDialog { Q_OBJECT public: /** * Default constructor */ BarDialog(); private: BarDialogPrivate* const d_ptr; Q_DECLARE_PRIVATE ( BarDialog ) }; } #endif // FOO_BARDIALOG_H
bardialog_p.h:
#ifndef FOO_BARDIALOG_P_H #define FOO_BARDIALOG_P_H #include "ui_bardialog.h" namespace Foo { /** * @todo write docs */ class BarDialogPrivate { public: Ui::BarDialog ui; }; } #endif // FOO_BARDIALOG_P_H
bardialog.cpp:
#include "bardialog.h" #include "bardialog_p.h" using namespace Foo; BarDialog::BarDialog() : d_ptr(new BarDialogPrivate()) { d_ptr->ui.setupUi(this); }
bardialog.ui:
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>BarDialog</class> <widget class="QDialog" name="BarDialog"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>520</width> <height>300</height> </rect> </property> <property name="windowTitle"> <string>My empty dialog</string> </property> <layout class="QVBoxLayout" name="verticalLayout" stretch="1,0"> <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> </spacer> </item> <item> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="standardButtons"> <set>QDialogButtonBox::Close</set> </property> </widget> </item> </layout> </widget> <resources/> <connections> <connection> <sender>buttonBox</sender> <signal>rejected()</signal> <receiver>BarDialog</receiver> <slot>reject()</slot> </connection> </connections> </ui>
Comment Actions
I also have a non-impl variant of this dialog template, as well as a pimpl variant of the existing qwidget template.
IMHO (well, my usage experience, that's why I did those templates) it would be good to have KDevelop offer by default templates with pimpl and non-pimpl variants for all three classic QObject type, QObject, QWidget & QDialog.
If you agree I would create a review request with the two missing templates as well.