QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgscptcitycolorrampdialog.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscptcitycolorrampdialog.h
3 ---------------------
4 begin : July 2012
5 copyright : (C) 2012 by Etienne Tourigny
6 email : etourigny dot dev at gmail.com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSCPTCITYCOLORRAMPDIALOG_H
17#define QGSCPTCITYCOLORRAMPDIALOG_H
18
19
20#include "ui_qgscptcitycolorrampdialogbase.h"
21#include "qgis_sip.h"
22#include <QDialog>
23
24#include "qgscptcityarchive.h"
25
26#include <QAbstractProxyModel>
27#include <QSortFilterProxyModel>
28#include <QFileInfo>
29#include "qgis_gui.h"
30
32class TreeFilterProxyModel;
33class ListFilterProxyModel;
34class UngroupProxyModel;
35
42class GUI_EXPORT QgsCptCityColorRampDialog : public QDialog, private Ui::QgsCptCityColorRampDialogBase
43{
44 Q_OBJECT
45 Q_PROPERTY( QgsCptCityColorRamp ramp READ ramp WRITE setRamp )
46
47 public:
48
54 QgsCptCityColorRampDialog( const QgsCptCityColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
55
60 QgsCptCityColorRamp ramp() const { return mRamp; }
61
67 void setRamp( const QgsCptCityColorRamp &ramp );
68
72 QString selectedName() const
73 {
74 return QFileInfo( mRamp.schemeName() ).baseName() + mRamp.variantName();
75 }
76
80 bool saveAsGradientRamp() const;
81
86 QDialogButtonBox *buttonBox() const;
87
88 bool eventFilter( QObject *obj, QEvent *event ) override;
89
90 signals:
91
93 void changed();
94
95 private slots:
96 void populateVariants();
97
98 void mTreeView_clicked( const QModelIndex & );
99 void mListWidget_itemClicked( QListWidgetItem *item );
100 void mListWidget_itemSelectionChanged();
101 void tabBar_currentChanged( int index );
102 void pbtnLicenseDetails_pressed();
103 void cboVariantName_currentIndexChanged( int index );
104 void onFinished();
105 void showHelp();
106 /* void refresh(); */
107
108 private:
109
110 void updateUi();
111 void updatePreview( bool clear = false );
112 void clearCopyingInfo();
113 void updateCopyingInfo( const QMap< QString, QString > &copyingMap );
114 void updateTreeView( QgsCptCityDataItem *item, bool resetRamp = true );
115 void updateListWidget( QgsCptCityDataItem *item );
116
118 QgsCptCityArchive *mArchive = nullptr;
119 QgsCptCityBrowserModel::ViewType mArchiveViewType;
120
121 /* void refreshModel( const QModelIndex& index ); */
122 bool updateRamp();
123 void showAll();
124 void setTreeModel( QgsCptCityBrowserModel *model );
125
126 QgsCptCityBrowserModel *mModel = nullptr;
127 QgsCptCityBrowserModel *mAuthorsModel = nullptr;
128 QgsCptCityBrowserModel *mSelectionsModel = nullptr;
129 TreeFilterProxyModel *mTreeFilter = nullptr;
130 QVector<QgsCptCityColorRampItem *> mListRamps;
131
132};
133
134#ifndef SIP_RUN
136
141class TreeFilterProxyModel : public QSortFilterProxyModel
142{
143 Q_OBJECT
144
145 public:
146 TreeFilterProxyModel( QObject *parent, QgsCptCityBrowserModel *model );
147
148 protected:
149 bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override;
150 // bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
151
152 private:
153 QgsCptCityBrowserModel *mModel = nullptr;
154};
155
157#endif
158
159#endif
A dialog which allows users to modify the properties of a QgsCptCityColorRamp.
QgsCptCityColorRamp ramp() const
Returns a color ramp representing the current settings from the dialog.
void changed()
Emitted when the dialog settings change.
QString selectedName() const
Returns the name of the ramp currently selected in the dialog.
Base class for all items in the model.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53