QGIS API Documentation 4.1.0-Master (3b8ef1f72a3)
Loading...
Searching...
No Matches
qgsmaterialwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmaterialwidget.h
3 --------------------------------------
4 Date : July 2020
5 Copyright : (C) 2020 by Nyall Dawson
6 Email : nyall dot dawson at gmail dot 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 QGSMATERIALWIDGET_H
17#define QGSMATERIALWIDGET_H
18
19#include "ui_materialwidget.h"
20
21#include <memory>
22
23#include "qgis.h"
24#include "qgis_gui.h"
25
26#include <QDialog>
27#include <QPointer>
28#include <QWidget>
29
30#define SIP_NO_FILE
31
33class QgsVectorLayer;
34class QDialogButtonBox;
35
45class GUI_EXPORT QgsMaterialWidget : public QgsPanelWidget, private Ui::MaterialWidgetBase
46{
47 Q_OBJECT
48 public:
52 explicit QgsMaterialWidget( QWidget *parent = nullptr );
54
66
77 Qgis::MaterialRenderingTechnique technique() const { return mTechnique; }
78
85 void setFilterByTechnique( bool enabled );
86
93 bool filterByTechnique() const { return mFilterByTechnique; }
94
98 void setSettings( const QgsAbstractMaterialSettings *settings, QgsVectorLayer *layer );
99
103 std::unique_ptr< QgsAbstractMaterialSettings > settings();
104
108 void setType( const QString &type );
109
110 public slots:
111
115 void setPreviewVisible( bool visible );
116
117 signals:
118
122 void changed();
123
124 private slots:
125 void materialTypeChanged();
126 void materialWidgetChanged();
127
128 private:
129 void updateMaterialWidget();
130 void rebuildAvailableTypes();
131 bool mPreviewVisible = false;
132 QPointer< QgsVectorLayer > mLayer;
133
134 std::unique_ptr<QgsAbstractMaterialSettings> mCurrentSettings;
135
136 bool mFilterByTechnique = false;
138};
139
140
148class GUI_EXPORT QgsMaterialWidgetDialog : public QDialog
149{
150 Q_OBJECT
151
152 public:
157
161 std::unique_ptr< QgsAbstractMaterialSettings > settings();
162
166 QDialogButtonBox *buttonBox();
167
168 private:
169 QgsMaterialWidget *mWidget = nullptr;
170 QDialogButtonBox *mButtonBox = nullptr;
171};
172
173
174#endif // QGSMATERIALWIDGET_H
MaterialRenderingTechnique
Material rendering techniques.
Definition qgis.h:4327
@ Triangles
Triangle based rendering (default).
Definition qgis.h:4328
Abstract base class for material settings.
std::unique_ptr< QgsAbstractMaterialSettings > settings()
Returns the current settings defined by the dialog.
QDialogButtonBox * buttonBox()
Returns the dialog's button box.
QgsMaterialWidgetDialog(const QgsAbstractMaterialSettings *settings, QWidget *parent=nullptr)
Constructor for QgsMaterialWidgetDialog, initially showing the specified material settings.
A widget allowing users to customize a 3d material.
bool filterByTechnique() const
Returns whether available materials are filtered by technique.
QgsMaterialWidget(QWidget *parent=nullptr)
Constructor for QgsMaterialWidget.
void changed()
Emitted when the material defined by the widget is changed.
void setTechnique(Qgis::MaterialRenderingTechnique technique)
Sets the required rendering technique which the material must support.
Qgis::MaterialRenderingTechnique technique() const
Returns the required rendering technique which the material must support.
~QgsMaterialWidget() override
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an inline panel.
Represents a vector layer which manages a vector based dataset.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52