Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Common/LtsWidgets/lts_progress_dialog_helper.h
T
torstenandCopilot d890b11c5f Qt6 Migration: LtsWidgets, BUILD_RTI Guards, externe Dependencies dokumentiert
- LtsWidgets Verzeichnis vollständig migriert (Qt5→Qt6)
- BUILD_RTI Guards für RTI-spezifische Module hinzugefügt
- Externe Dependencies in EXTERNAL_DEPS.md dokumentiert
- Qt6 API-Änderungen: QRegExp→QRegularExpression, enterEvent(QEnterEvent*)
- AutoUic-Fehler bei ui_requirement behoben (SKIP_AUTOUIC)
- Include-Pfade korrigiert (LtsElevation, LtsMultiMonitor, LtsUtilsCore)
- MOC-Fehler behoben (Q_INTERFACES entfernt wo nicht benötigt)
- CMakeLists.txt Anpassungen für Qt6 (PUBLIC statt INTERFACE)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-21 10:29:34 +02:00

83 lines
2.4 KiB
C++

/**
* @RDE_HEADER@
* Helper Class, which manages a progress Dialog with two states.
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2016-06-20
*/
#pragma once
#include "lts_widgets_export.h"
#include <QObject>
#include <QPointer>
class QLabel;
class QWidget;
namespace LtsWidgets
{
class LtsFramelessDialog;
/**
* @brief The LtsProgressDialogHelper class is a helper class, which can be used to easily
* show a Dialog with eather a wait state (indefinite progress bar), or a default message,
* adjusted to the result type (see ReplyResult)
*/
class LTSWIDGETS_EXPORT LtsProgressDialogHelper : public QObject
{
Q_OBJECT
public:
/**
* @brief The ReplyResult enum describes the behaviour of the slotSopWaitForReplyWindow method.
*/
enum class ReplyResult
{
Close = 0, // say nothing, just close automatically
Success, // dialog with success message, has to be receipted
Failure, // dialog with failure message plus reply string, has to be receipted
TimeOut, // dialog with timeout message, has to be receipted
};
explicit LtsProgressDialogHelper(QWidget *parent = nullptr);
~LtsProgressDialogHelper();
bool isShown() const { return !!m_waitDlg; }
void setCustomText(const QString &customText = QString());
void setParentWidget(QWidget *newParent);
public slots:
/**
* @brief slotShowWaitForReplyWindow shows a centered wait dialog which does not allow the user to interact with the application and cannot be canceled.
*/
void slotShowWaitForReplyWindow(/*const QString &textToShow*/);
/**
* @brief slotStopWaitForReplyWindow closes the wait dialog. Nothing happens when there was no show wait dialog called before.
* @param replyResult The wait dialog is closed on ReplyResult::Close. A new centered, modal dialog is shown on ReplyResult::Failure/Success/Timeout with an error message in it.
* @param replyString An explanatory string shown on ReplyResult::Failure to tell the user what went wrong on.
*/
void slotStopWaitForReplyWindow(const LtsWidgets::LtsProgressDialogHelper::ReplyResult &replyResult = ReplyResult::Close /* say nothing, just close */,
const QString &replyString = QString());
private:
QPointer<LtsFramelessDialog> m_waitDlg;
QWidget *m_parentWidget;
QPointer<QLabel> m_textLabel;
signals:
/**
* @brief accepted is emitted when accept() was called (e.g. by clicking okay)
*/
void accepted();
private slots:
void accept();
};
}