QGIS API Documentation  2.17.0-Master (0497e4a)
qgscptcitycolorrampv2dialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscptcitycolorrampv2dialog.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 QGSCPTCITYCOLORRAMPV2DIALOG_H
17 #define QGSCPTCITYCOLORRAMPV2DIALOG_H
18 
19 
20 #include "ui_qgscptcitycolorrampv2dialogbase.h"
21 #include <QDialog>
22 
23 #include "qgscptcityarchive.h"
24 
25 #include <QAbstractProxyModel>
26 #include <QSortFilterProxyModel>
27 
29 class TreeFilterProxyModel;
30 class ListFilterProxyModel;
31 class UngroupProxyModel;
32 
36 class GUI_EXPORT QgsCptCityColorRampV2Dialog : public QDialog, private Ui::QgsCptCityColorRampV2DialogBase
37 {
38  Q_OBJECT
39 
40  public:
41  QgsCptCityColorRampV2Dialog( QgsCptCityColorRampV2* ramp, QWidget* parent = nullptr );
43 
45  { return mRamp ? QFileInfo( mRamp->schemeName() ).baseName() + mRamp->variantName() : QString(); }
46 
47  bool saveAsGradientRamp() const;
48 
49  public slots:
50  void populateVariants();
51 
52  void on_mTreeView_clicked( const QModelIndex & );
53  void on_mListWidget_itemClicked( QListWidgetItem * item );
54  void on_mListWidget_itemSelectionChanged();
55  void on_tabBar_currentChanged( int index );
56  void on_pbtnLicenseDetails_pressed();
57  void on_cboVariantName_currentIndexChanged( int index );
58  void onFinished();
59  void on_buttonBox_helpRequested();
60  /* void refresh(); */
61 
62  protected:
63 
64  void updatePreview( bool clear = false );
65  void clearCopyingInfo();
66  void updateCopyingInfo( const QMap< QString, QString >& copyingMap );
67  void updateTreeView( QgsCptCityDataItem *item, bool resetRamp = true );
68  void updateListWidget( QgsCptCityDataItem *item );
69  bool eventFilter( QObject *obj, QEvent *event ) override;
70 
74 
75  /* void refreshModel( const QModelIndex& index ); */
76  bool updateRamp();
77  void showAll();
78  void setTreeModel( QgsCptCityBrowserModel* model );
79 
83  TreeFilterProxyModel* mTreeFilter;
85 
86 };
87 
89 
93 class TreeFilterProxyModel : public QSortFilterProxyModel
94 {
95  Q_OBJECT
96 
97  public:
98  TreeFilterProxyModel( QObject *parent, QgsCptCityBrowserModel* model );
99 
100  protected:
101  bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override;
102  // bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
103 
104  private:
105  QgsCptCityBrowserModel* mModel;
106 };
107 
109 
110 
111 #endif
static unsigned index
QgsCptCityBrowserModel * mSelectionsModel
QVector< QgsCptCityColorRampItem * > mListRamps
QgsCptCityBrowserModel * mAuthorsModel
QgsCptCityBrowserModel::ViewType mArchiveViewType
Base class for all items in the model.
virtual bool eventFilter(QObject *o, QEvent *e)