swift
validationindicator.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_GUI_EDITOR_VALIDATIONINDICATOR_H
7 #define SWIFT_GUI_EDITOR_VALIDATIONINDICATOR_H
8 
9 #include <QFrame>
10 #include <QObject>
11 #include <QScopedPointer>
12 #include <QString>
13 #include <QTimer>
14 
15 #include "gui/swiftguiexport.h"
16 #include "misc/statusmessagelist.h"
17 
18 class QPaintEvent;
19 class QWidget;
20 
21 namespace Ui
22 {
23  class CValidationIndicator;
24 }
25 
26 namespace swift::gui::editors
27 {
31  class SWIFT_GUI_EXPORT CValidationIndicator : public QFrame
32  {
33  Q_OBJECT
34 
35  public:
37  explicit CValidationIndicator(QWidget *parent = nullptr);
38 
40  ~CValidationIndicator() override;
41 
43  void passed();
44 
46  void warnings();
47 
49  void failed();
50 
52  void setState(bool ok);
53 
55  void setState(const swift::misc::CStatusMessageList &msgs);
56 
57  public slots:
59  void clear();
60 
61  protected:
63  virtual void paintEvent(QPaintEvent *paintEvent) override;
64 
65  private:
66  const int ResetInterval = 5000;
67  QScopedPointer<Ui::CValidationIndicator> ui;
68 
70  void setBackgroundColor(const QString &colorName);
71 
72  QTimer m_resetTimer;
73  QString m_originalStyleSheet;
74  };
75 } // namespace swift::gui::editors
76 
77 #endif // SWIFT_GUI_EDITOR_VALIDATIONINDICATOR_H
Status messages, e.g. from Core -> GUI.
#define SWIFT_GUI_EXPORT
Export a class or function from the library.