swift
dbcountryselectorcomponent.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_DBCOUNTRYSELECTORCOMPONENT_H
7 #define SWIFT_GUI_DBCOUNTRYSELECTORCOMPONENT_H
8 
9 #include <QFrame>
10 #include <QObject>
11 #include <QScopedPointer>
12 #include <QString>
13 
14 #include "gui/dropbase.h"
15 #include "gui/swiftguiexport.h"
16 #include "misc/country.h"
18 
19 class QCompleter;
20 class QDragEnterEvent;
21 class QDragLeaveEvent;
22 class QDragMoveEvent;
23 class QDropEvent;
24 class QWidget;
25 
26 namespace Ui
27 {
28  class CDbCountrySelectorComponent;
29 }
30 namespace swift::gui::components
31 {
36  {
37  Q_OBJECT
38 
39  public:
41  explicit CDbCountrySelectorComponent(QWidget *parent = nullptr);
42 
44  ~CDbCountrySelectorComponent() override;
45 
47  void setCountry(const swift::misc::CCountry &country);
48 
50  void setCountry(const QString &isoCode);
51 
53  swift::misc::CCountry getCountry() const;
54 
56  void setReadOnly(bool readOnly);
57 
59  bool isSet() const;
60 
62  void clear();
63 
64  signals:
66  void countryChanged(const swift::misc::CCountry &country);
67 
68  protected:
70  virtual void dragEnterEvent(QDragEnterEvent *event) override;
71 
73  virtual void dragMoveEvent(QDragMoveEvent *event) override;
74 
76  virtual void dragLeaveEvent(QDragLeaveEvent *event) override;
77 
79  virtual void dropEvent(QDropEvent *event) override;
80 
81  private:
83  void onCountriesRead(swift::misc::network::CEntityFlags::Entity entity,
85 
87  void onDataChanged();
88 
90  void onCompleterActivated(const QString &countryName);
91 
92  QScopedPointer<Ui::CDbCountrySelectorComponent> ui;
93  QScopedPointer<QCompleter> m_completerCountryNames;
94  swift::misc::CCountry m_currentCountry;
95  };
96 } // namespace swift::gui::components
97 #endif // SWIFT_GUI_DBCOUNTRYSELECTORCOMPONENT_H
Utilities for dropping swift value objects.
Definition: dropbase.h:19
void countryChanged(const swift::misc::CCountry &country)
Country has been changed.
High level reusable GUI components.
Definition: aboutdialog.cpp:13
#define SWIFT_GUI_EXPORT
Export a class or function from the library.