ui: fixed error help dialog not showing up during indexing (issue #740) (#904)

This commit is contained in:
Malte Langkabel
2020-02-03 15:45:09 +01:00
committed by GitHub
parent f6bddec0ec
commit 3a6beb76fc
13 changed files with 121 additions and 81 deletions
+3 -13
View File
@@ -1,16 +1,13 @@
#include "QtHelpButton.h"
#include <QMessageBox>
#include "ResourcePaths.h"
QtHelpButton::QtHelpButton(const QString& helpTitle, const QString& helpText, QWidget* parent)
QtHelpButton::QtHelpButton(const QtHelpButtonInfo& info, QWidget* parent)
: QtIconButton(
ResourcePaths::getGuiPath().concatenate(L"window/help.png"),
ResourcePaths::getGuiPath().concatenate(L"window/help_hover.png"),
parent)
, m_helpTitle(helpTitle)
, m_helpText(helpText)
, m_info(info)
{
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
@@ -27,12 +24,5 @@ QtHelpButton::QtHelpButton(const QString& helpTitle, const QString& helpText, QW
void QtHelpButton::handleHelpPress()
{
QMessageBox msgBox;
msgBox.setWindowTitle(QStringLiteral("Sourcetrail"));
msgBox.setIcon(QMessageBox::Information);
msgBox.setText("<b>" + m_helpTitle + "</b>");
msgBox.setInformativeText(m_helpText);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
m_info.displayMessage();
}
+3 -3
View File
@@ -1,6 +1,7 @@
#ifndef QT_HELP_BUTTON_H
#define QT_HELP_BUTTON_H
#include "QtHelpButtonInfo.h"
#include "QtIconButton.h"
class QtHelpButton: public QtIconButton
@@ -8,14 +9,13 @@ class QtHelpButton: public QtIconButton
Q_OBJECT
public:
QtHelpButton(const QString& helpTitle, const QString& helpText, QWidget* parent = nullptr);
QtHelpButton(const QtHelpButtonInfo& info, QWidget* parent = nullptr);
private slots:
void handleHelpPress();
private:
QString m_helpTitle;
QString m_helpText;
QtHelpButtonInfo m_info;
};
#endif // QT_HELP_BUTTON_H