diff options
author | Jesper K. Pedersen <jesper.pedersen@kdab.com> | 2013-04-18 07:56:03 +0200 |
---|---|---|
committer | Jesper K. Pedersen <jesper.pedersen@kdab.com> | 2013-04-18 11:43:56 +0200 |
commit | 6c28191412ad2b7a7ebc50a808bb7c0f162466ff (patch) | |
tree | c042823bb3e15c54b6b1d70949845a5991435b1e /utils | |
parent | fb804983938054e5177bfce69a95275bda305b37 (diff) |
introduced Dialogs::getText
Change-Id: I79a431aae62dc78fc93eaad0d4182838d4b7802f
Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/dialogs.cpp | 18 | ||||
-rw-r--r-- | utils/dialogs.h | 25 |
2 files changed, 43 insertions, 0 deletions
diff --git a/utils/dialogs.cpp b/utils/dialogs.cpp new file mode 100644 index 0000000..5421bbf --- /dev/null +++ b/utils/dialogs.cpp @@ -0,0 +1,18 @@ +#include "dialogs.h" +#include <QInputDialog> + +namespace Scripting { +namespace Internal { + +Dialogs::Dialogs(QObject *parent) : + QObject(parent) +{ +} + +QString Dialogs::getText(const QString &title, const QString& label, const QString &defaultValue) +{ + return QInputDialog::getText(0, title, label, QLineEdit::Normal, defaultValue); +} + +} // namespace Internal +} // namespace Scripting diff --git a/utils/dialogs.h b/utils/dialogs.h new file mode 100644 index 0000000..6ee8b07 --- /dev/null +++ b/utils/dialogs.h @@ -0,0 +1,25 @@ +#ifndef SCRIPTING_INTERNAL_DIALOGS_H +#define SCRIPTING_INTERNAL_DIALOGS_H + +#include <QObject> + +namespace Scripting { +namespace Internal { + +/** + * @brief Asks user for various input + */ +class Dialogs : public QObject +{ + Q_OBJECT +public: + explicit Dialogs(QObject *parent = 0); + +public slots: + static QString getText(const QString& title, const QString &label, const QString& defaultValue = QString()); +}; + +} // namespace Internal +} // namespace Scripting + +#endif // SCRIPTING_INTERNAL_DIALOGS_H |