QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
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
22#include "qgis_gui.h"
23#include "qgis_sip.h"
24#include "qgscptcityarchive.h"
25
26#include <QAbstractProxyModel>
27#include <QDialog>
28#include <QFileInfo>
29#include <QSortFilterProxyModel>
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 { return QFileInfo( mRamp.schemeName() ).baseName() + mRamp.variantName(); }
71
75 bool saveAsGradientRamp() const;
76
81 QDialogButtonBox *buttonBox() const;
82
83 bool eventFilter( QObject *obj, QEvent *event ) override;
84
85 signals:
86
88 void changed();
89
90 private slots:
91 void populateVariants();
92
93 void mTreeView_clicked( const QModelIndex & );
94 void mListWidget_itemClicked( QListWidgetItem *item );
95 void mListWidget_itemSelectionChanged();
96 void tabBar_currentChanged( int index );
97 void pbtnLicenseDetails_pressed();
98 void cboVariantName_currentIndexChanged( int index );
99 void onFinished();
100 void showHelp();
101 /* void refresh(); */
102
103 private:
104 void updateUi();
105 void updatePreview( bool clear = false );
106 void clearCopyingInfo();
107 void updateCopyingInfo( const QMap<QString, QString> &copyingMap );
108 void updateTreeView( QgsCptCityDataItem *item, bool resetRamp = true );
109 void updateListWidget( QgsCptCityDataItem *item );
110
112 QgsCptCityArchive *mArchive = nullptr;
114
115 /* void refreshModel( const QModelIndex& index ); */
116 bool updateRamp();
117 void showAll();
118 void setTreeModel( QgsCptCityBrowserModel *model );
119
120 QgsCptCityBrowserModel *mModel = nullptr;
121 QgsCptCityBrowserModel *mAuthorsModel = nullptr;
122 QgsCptCityBrowserModel *mSelectionsModel = nullptr;
123 TreeFilterProxyModel *mTreeFilter = nullptr;
124 QVector<QgsCptCityColorRampItem *> mListRamps;
125};
126
127#ifndef SIP_RUN
129
134class TreeFilterProxyModel : public QSortFilterProxyModel
135{
136 Q_OBJECT
137
138 public:
139 TreeFilterProxyModel( QObject *parent, QgsCptCityBrowserModel *model );
140
141 protected:
142 bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override;
143 // bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
144
145 private:
146 QgsCptCityBrowserModel *mModel = nullptr;
147};
148
150#endif
151
152#endif
Represents a CPT City color scheme.
A custom item model for display of CPT City color palettes.
QgsCptCityColorRampDialog(const QgsCptCityColorRamp &ramp, QWidget *parent=nullptr)
Constructor for QgsCptCityColorRampDialog.
QgsCptCityColorRamp ramp() const
Returns a color ramp representing the current settings from the dialog.
void setRamp(const QgsCptCityColorRamp &ramp)
Sets the color ramp to show in 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 a QgsCptCityBrowserModel model.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52