QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
41class GUI_EXPORT QgsCptCityColorRampDialog : public QDialog, private Ui::QgsCptCityColorRampDialogBase
42{
43 Q_OBJECT
44 Q_PROPERTY( QgsCptCityColorRamp ramp READ ramp WRITE setRamp )
45
46 public:
47
53 QgsCptCityColorRampDialog( const QgsCptCityColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
54
59 QgsCptCityColorRamp ramp() const { return mRamp; }
60
66 void setRamp( const QgsCptCityColorRamp &ramp );
67
71 QString selectedName() const
72 {
73 return QFileInfo( mRamp.schemeName() ).baseName() + mRamp.variantName();
74 }
75
79 bool saveAsGradientRamp() const;
80
85 QDialogButtonBox *buttonBox() const;
86
87 bool eventFilter( QObject *obj, QEvent *event ) override;
88
89 signals:
90
92 void changed();
93
94 private slots:
95 void populateVariants();
96
97 void mTreeView_clicked( const QModelIndex & );
98 void mListWidget_itemClicked( QListWidgetItem *item );
99 void mListWidget_itemSelectionChanged();
100 void tabBar_currentChanged( int index );
101 void pbtnLicenseDetails_pressed();
102 void cboVariantName_currentIndexChanged( int index );
103 void onFinished();
104 void showHelp();
105 /* void refresh(); */
106
107 private:
108
109 void updateUi();
110 void updatePreview( bool clear = false );
111 void clearCopyingInfo();
112 void updateCopyingInfo( const QMap< QString, QString > &copyingMap );
113 void updateTreeView( QgsCptCityDataItem *item, bool resetRamp = true );
114 void updateListWidget( QgsCptCityDataItem *item );
115
117 QgsCptCityArchive *mArchive = nullptr;
118 QgsCptCityBrowserModel::ViewType mArchiveViewType;
119
120 /* void refreshModel( const QModelIndex& index ); */
121 bool updateRamp();
122 void showAll();
123 void setTreeModel( QgsCptCityBrowserModel *model );
124
125 QgsCptCityBrowserModel *mModel = nullptr;
126 QgsCptCityBrowserModel *mAuthorsModel = nullptr;
127 QgsCptCityBrowserModel *mSelectionsModel = nullptr;
128 TreeFilterProxyModel *mTreeFilter = nullptr;
129 QVector<QgsCptCityColorRampItem *> mListRamps;
130
131};
132
133#ifndef SIP_RUN
135
140class TreeFilterProxyModel : public QSortFilterProxyModel
141{
142 Q_OBJECT
143
144 public:
145 TreeFilterProxyModel( QObject *parent, QgsCptCityBrowserModel *model );
146
147 protected:
148 bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override;
149 // bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
150
151 private:
152 QgsCptCityBrowserModel *mModel = nullptr;
153};
154
156#endif
157
158#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