blob: 3730efef325651d3f6e48cda1199bad131a233f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "gitutils.h"
#include <QInputDialog>
#include <QLineEdit>
namespace Git::Internal {
// Make QInputDialog play nicely, widen it a bit.
bool inputText(QWidget *parent, const QString &title, const QString &prompt, QString *s)
{
QInputDialog dialog(parent);
dialog.setWindowTitle(title);
dialog.setLabelText(prompt);
dialog.setTextValue(*s);
// Nasty hack:
if (auto le = dialog.findChild<QLineEdit*>())
le->setMinimumWidth(500);
if (dialog.exec() != QDialog::Accepted)
return false;
*s = dialog.textValue();
return true;
}
} // Git::Internal
|