File: qgssubsetstringeditorprovider.h

package info (click to toggle)
qgis 3.34.7%2Bdfsg-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 1,087,388 kB
  • sloc: cpp: 1,440,033; python: 234,418; xml: 23,096; perl: 3,499; sh: 3,364; ansic: 2,219; sql: 2,130; yacc: 1,063; lex: 577; javascript: 540; lisp: 411; makefile: 155
file content (78 lines) | stat: -rw-r--r-- 3,146 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/***************************************************************************
    qgssubsetstringeditorprovider.h
     --------------------------------------
    Date                 : 15-Nov-2020
    Copyright            : (C) 2020 by Even Rouault
    Email                : even.rouault at spatials.com
****************************************************************************/
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef QGSSUBSETSTRINGEDITORPROVIDER_H
#define QGSSUBSETSTRINGEDITORPROVIDER_H

#include "qgis.h"
#include "qgis_gui.h"
#include "qgis_sip.h"
#include "qgsguiutils.h"

class QWidget;
class QgsVectorLayer;
class QgsSubsetStringEditorInterface;

/**
 * \ingroup gui
 * \class QgsSubsetStringEditorProvider
 * \brief This is the interface for those who want to provide a dialog to edit a
 * subset string.
 *
 * \since QGIS 3.18
 */
class GUI_EXPORT QgsSubsetStringEditorProvider
{
  public:
    //! Destructor.
    virtual ~QgsSubsetStringEditorProvider();

    //! Provider key
    virtual QString providerKey() const = 0;

    /**
     * Subset string editor provider name, this is useful to retrieve
     * a particular subset string editor in case the provider has more
     * than one, it should be unique among all providers.
     *
     * The default implementation returns the providerKey()
     */
    virtual QString name() const { return providerKey(); }

    //! Returns true if the provider can handle the layer
    virtual bool canHandleLayer( QgsVectorLayer *layer ) const = 0;

    /**
     * Returns true if the provider can handle specifically the
     * layer->provider()->storageType()
     * This method will only be called if canHandleLayer() returned true.
     * Typically a generic SQL provider for the OGR provider will return false,
     * whereas a dedicated plugin with a specific behavior for a OGR driver
     * will return true.
     */
    virtual bool canHandleLayerStorageType( QgsVectorLayer *layer ) const { Q_UNUSED( layer ); return false; }

    /**
     * Creates a new dialog to edit the subset string of the provided \a layer.
     * It may return nullptr if it cannot handle the layer.
     * The returned object must be destroyed by the caller.
     * On successful accept(), the QgsSubsetStringEditorInterface implementation
     * is responsible for setting the updated string on layer.
     */
    virtual QgsSubsetStringEditorInterface *createDialog( QgsVectorLayer *layer, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags ) = 0 SIP_FACTORY;
};

#endif