QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
qgssourceselectprovider.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssourceselectprovider.h - QgsSourceSelectProvider
3
4 ---------------------
5 begin : 1.9.2017
6 copyright : (C) 2017 by Alessandro Pasotti
7 email : apasotti at boundlessgeo dot com
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16#ifndef QGSSOURCESELECTPROVIDER_H
17#define QGSSOURCESELECTPROVIDER_H
18
19
20#include "qgis_gui.h"
21#include "qgis_sip.h"
22#include "qgsguiutils.h"
23#include "qgsproviderregistry.h"
25
26class QString;
27class QWidget;
28
35{
36 Q_GADGET
37
38 public:
39
42 {
43 OrderLocalProvider = 0,
44 OrderDatabaseProvider = 1000,
45 OrderRemoteProvider = 2000,
46 OrderSearchProvider = 4000,
47 OrderOtherProvider = 5000,
48 };
49
54 enum class Capability : int SIP_ENUM_BASETYPE( IntFlag )
55 {
56 NoCapabilities = 0,
57 ConfigureFromUri = 1
58 };
59 Q_ENUM( Capability )
61 Q_DECLARE_FLAGS( Capabilities, Capability )
62 Q_FLAG( Capabilities )
63
64 virtual ~QgsSourceSelectProvider() = default;
65
67 virtual QString providerKey() const = 0;
68
76 virtual QString name() const { return providerKey(); }
77
79 virtual QString text() const = 0;
80
86 virtual QString toolTip() const { return QString(); }
87
89 virtual QIcon icon() const = 0;
90
95 virtual int ordering( ) const { return OrderOtherProvider; }
96
101 virtual QgsAbstractDataSourceWidget *createDataSourceWidget( QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::Widget, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Embedded ) const = 0 SIP_FACTORY;
102
109 {
110 return Capability::NoCapabilities;
111 }
112
113};
114
116
117#endif // QGSSOURCESELECTPROVIDER_H
Abstract base Data Source Widget to create connections and add layers This class provides common func...
WidgetMode
Different ways a source select dialog can be used.
@ Embedded
Used for the data source manager dialog where the widget is embedded as the main content for a partic...
This is the interface for those who want to add entries to the QgsDataSourceManagerDialog.
virtual int ordering() const
Ordering: the source select provider registry will be able to sort the source selects (ascending) usi...
virtual QgsAbstractDataSourceWidget * createDataSourceWidget(QWidget *parent=nullptr, Qt::WindowFlags fl=Qt::Widget, QgsProviderRegistry::WidgetMode widgetMode=QgsProviderRegistry::WidgetMode::Embedded) const =0
Create a new instance of QgsAbstractDataSourceWidget (or nullptr).
virtual QIcon icon() const =0
Creates a new instance of an QIcon for the menu item entry.
virtual QString text() const =0
Text for the menu item entry, it will be visible to the user so make sure it's translatable.
Capability
The Capability enum describes the capabilities of the source select implementation.
virtual Capabilities capabilities()
Returns the source select provider capabilities.
virtual QString toolTip() const
Text for the tooltip menu item entry, it will be visible to the user so make sure it's translatable.
QFlags< Capability > Capabilities
Ordering
Provider ordering groups.
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:278
#define SIP_FACTORY
Definition qgis_sip.h:76
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)