QGIS API Documentation  2.15.0-Master (af20121)
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 
33 
34 class GUI_EXPORT QgsCptCityColorRampV2Dialog : public QDialog, private Ui::QgsCptCityColorRampV2DialogBase
35 {
36  Q_OBJECT
37 
38  public:
39  QgsCptCityColorRampV2Dialog( QgsCptCityColorRampV2* ramp, QWidget* parent = nullptr );
41 
43  { return mRamp ? QFileInfo( mRamp->schemeName() ).baseName() + mRamp->variantName() : QString(); }
44 
45  bool saveAsGradientRamp() const;
46 
47  public slots:
48  void populateVariants();
49 
50  void on_mTreeView_clicked( const QModelIndex & );
51  void on_mListWidget_itemClicked( QListWidgetItem * item );
52  void on_mListWidget_itemSelectionChanged();
53  void on_tabBar_currentChanged( int index );
54  void on_pbtnLicenseDetails_pressed();
55  void on_cboVariantName_currentIndexChanged( int index );
56  void onFinished();
57  void on_buttonBox_helpRequested();
58  /* void refresh(); */
59 
60  protected:
61 
62  void updatePreview( bool clear = false );
63  void clearCopyingInfo();
64  void updateCopyingInfo( const QMap< QString, QString >& copyingMap );
65  void updateTreeView( QgsCptCityDataItem *item, bool resetRamp = true );
66  void updateListWidget( QgsCptCityDataItem *item );
67  bool eventFilter( QObject *obj, QEvent *event ) override;
68 
72 
73  /* void refreshModel( const QModelIndex& index ); */
74  bool updateRamp();
75  void showAll();
76  void setTreeModel( QgsCptCityBrowserModel* model );
77 
81  TreeFilterProxyModel* mTreeFilter;
83 
84 };
85 
87 
88 class TreeFilterProxyModel : public QSortFilterProxyModel
89 {
90  Q_OBJECT
91 
92  public:
93  TreeFilterProxyModel( QObject *parent, QgsCptCityBrowserModel* model );
94 
95  protected:
96  bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override;
97  // bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
98 
99  private:
100  QgsCptCityBrowserModel* mModel;
101 };
102 
104 
105 
106 #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)