swift
dbdistributorselectorcomponent.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_DBDISTRIBUTORSELECTORCOMPONENT_H
7 #define SWIFT_GUI_DBDISTRIBUTORSELECTORCOMPONENT_H
8 
9 #include <QFrame>
10 #include <QMetaObject>
11 #include <QObject>
12 #include <QScopedPointer>
13 #include <QString>
14 
15 #include "gui/dropbase.h"
16 #include "gui/swiftguiexport.h"
19 
20 class QCompleter;
21 class QDragEnterEvent;
22 class QDragLeaveEvent;
23 class QDragMoveEvent;
24 class QDropEvent;
25 class QWidget;
26 
27 namespace Ui
28 {
29  class CDbDistributorSelectorComponent;
30 }
31 namespace swift::gui::components
32 {
37  {
38  Q_OBJECT
39 
40  public:
42  explicit CDbDistributorSelectorComponent(QWidget *parent = nullptr);
43 
45  virtual ~CDbDistributorSelectorComponent() override;
46 
48  void setDistributor(const swift::misc::simulation::CDistributor &distributor);
49 
51  void setDistributor(const QString &distributorKeyOrAlias);
52 
54  swift::misc::simulation::CDistributor getDistributor() const;
55 
57  void setReadOnly(bool readOnly);
58 
60  void withDistributorDescription(bool description);
61 
63  bool isSet() const;
64 
66  void clear();
67 
68  signals:
71 
72  protected:
74  virtual void dragEnterEvent(QDragEnterEvent *event) override;
75 
77  virtual void dragMoveEvent(QDragMoveEvent *event) override;
78 
80  virtual void dragLeaveEvent(QDragLeaveEvent *event) override;
81 
83  virtual void dropEvent(QDropEvent *event) override;
84 
85  private:
87  void onDistributorsRead(swift::misc::network::CEntityFlags::Entity entity,
89 
91  void onDataChanged();
92 
94  void onCompleterActivated(const QString &distributorKeyOrAlias);
95 
96  QScopedPointer<Ui::CDbDistributorSelectorComponent> ui;
97  QScopedPointer<QCompleter> m_completerDistributors;
98  QMetaObject::Connection m_signalConnection;
99  swift::misc::simulation::CDistributor m_currentDistributor;
100  };
101 } // namespace swift::gui::components
102 #endif // SWIFT_GUI_DBDISTRIBUTORSELECTORCOMPONENT_H
Utilities for dropping swift value objects.
Definition: dropbase.h:19
void changedDistributor(const swift::misc::simulation::CDistributor &distributor)
Distributor was changed.
Value object encapsulating information of software distributor.
Definition: distributor.h:33
High level reusable GUI components.
Definition: aboutdialog.cpp:13
#define SWIFT_GUI_EXPORT
Export a class or function from the library.