Commit 8ab5857c authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Set tooltip of push button and line edit

To improve accessibility we set a tooltip for the push button and we
forward the tooltip set on the requester to the line edit.

GnuPG-bug-id: 5535
parent 0fb836a6
Pipeline #75655 passed with stage
in 8 minutes and 26 seconds
......@@ -10,6 +10,7 @@
#include "filenamerequester.h"
#include <KLineEdit>
#include <KLocalizedString>
#include <QHBoxLayout>
#include <QToolButton>
......@@ -17,6 +18,7 @@
#include <QDirModel>
#include <QString>
#include <QFileDialog>
#include <QEvent>
using namespace Kleo;
......@@ -70,6 +72,7 @@ FileNameRequester::Private::Private(FileNameRequester *qq)
hlay.setObjectName(QStringLiteral("hlay"));
button.setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
button.setToolTip(i18n("Open file dialog"));
#ifndef QT_NO_DIRMODEL
lineedit.setCompleter(&completer);
#endif
......@@ -163,6 +166,14 @@ void FileNameRequester::Private::slotButtonClicked()
}
}
bool FileNameRequester::event(QEvent *e)
{
if (e->type() == QEvent::ToolTipChange) {
d->lineedit.setToolTip(toolTip());
}
return QWidget::event(e);
}
QString FileNameRequester::requestFileName()
{
#ifndef QT_NO_FILEDIALOG
......
......@@ -43,6 +43,9 @@ public:
Q_SIGNALS:
void fileNameChanged(const QString &filename);
protected:
bool event(QEvent *event) override;
private:
virtual QString requestFileName();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment