QGIS API Documentation 3.41.0-Master (57ec4277f5e)
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
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:
52 QgsCptCityColorRampDialog( const QgsCptCityColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
53
58 QgsCptCityColorRamp ramp() const { return mRamp; }
59
65 void setRamp( const QgsCptCityColorRamp &ramp );
66
70 QString selectedName() const
71 {
72 return QFileInfo( mRamp.schemeName() ).baseName() + mRamp.variantName();
73 }
74
78 bool saveAsGradientRamp() const;
79
84 QDialogButtonBox *buttonBox() const;
85
86 bool eventFilter( QObject *obj, QEvent *event ) override;
87
88 signals:
89
91 void changed();
92
93 private slots:
94 void populateVariants();
95
96 void mTreeView_clicked( const QModelIndex & );
97 void mListWidget_itemClicked( QListWidgetItem *item );
98 void mListWidget_itemSelectionChanged();
99 void tabBar_currentChanged( int index );
100 void pbtnLicenseDetails_pressed();
101 void cboVariantName_currentIndexChanged( int index );
102 void onFinished();
103 void showHelp();
104 /* void refresh(); */
105
106 private:
107 void updateUi();
108 void updatePreview( bool clear = false );
109 void clearCopyingInfo();
110 void updateCopyingInfo( const QMap<QString, QString> &copyingMap );
111 void updateTreeView( QgsCptCityDataItem *item, bool resetRamp = true );
112 void updateListWidget( QgsCptCityDataItem *item );
113
115 QgsCptCityArchive *mArchive = nullptr;
116 QgsCptCityBrowserModel::ViewType mArchiveViewType;
117
118 /* void refreshModel( const QModelIndex& index ); */
119 bool updateRamp();
120 void showAll();
121 void setTreeModel( QgsCptCityBrowserModel *model );
122
123 QgsCptCityBrowserModel *mModel = nullptr;
124 QgsCptCityBrowserModel *mAuthorsModel = nullptr;
125 QgsCptCityBrowserModel *mSelectionsModel = nullptr;
126 TreeFilterProxyModel *mTreeFilter = nullptr;
127 QVector<QgsCptCityColorRampItem *> mListRamps;
128};
129
130#ifndef SIP_RUN
132
137class TreeFilterProxyModel : public QSortFilterProxyModel
138{
139 Q_OBJECT
140
141 public:
142 TreeFilterProxyModel( QObject *parent, QgsCptCityBrowserModel *model );
143
144 protected:
145 bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override;
146 // bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
147
148 private:
149 QgsCptCityBrowserModel *mModel = nullptr;
150};
151
153#endif
154
155#endif
Represents a CPT City color scheme.
A custom item model for display of CPT City color palettes.
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.
A color ramp from the CPT City collection.
Base class for all items in the model.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53