QGIS API Documentation 4.3.0-Master (b46232e4f9a)
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 void setDockMode( bool dockMode ) override;
111
122 void setMode( Qgis::MaterialWidgetMode mode );
123
124 public slots:
125
129 void setPreviewVisible( bool visible );
130
131 signals:
132
133 private slots:
134 void materialTypeChanged();
135 void materialWidgetChanged();
136
137 private:
138 void updateMaterialWidget();
139 void rebuildAvailableTypes();
140 bool mPreviewVisible = false;
141 QPointer< QgsVectorLayer > mLayer;
142
143 std::unique_ptr<QgsAbstractMaterialSettings> mCurrentSettings;
144
145 bool mFilterByTechnique = false;
148};
149
150
158class GUI_EXPORT QgsMaterialWidgetDialog : public QDialog
159{
160 Q_OBJECT
161
162 public:
167
180
188 void setFilterByTechnique( bool enabled );
189
193 std::unique_ptr< QgsAbstractMaterialSettings > settings();
194
198 QDialogButtonBox *buttonBox();
199
200 private:
201 QgsMaterialWidget *mWidget = nullptr;
202 QDialogButtonBox *mButtonBox = nullptr;
203};
204
205
206#endif // QGSMATERIALWIDGET_H
MaterialWidgetMode
Modes for material settings widgets.
Definition qgis.h:4471
@ Full
Shows all material settings.
Definition qgis.h:4473
MaterialRenderingTechnique
Material rendering techniques.
Definition qgis.h:4453
@ Triangles
Triangle based rendering (default).
Definition qgis.h:4454
Abstract base class for material settings.
void setFilterByTechnique(bool enabled)
Sets whether available materials should be filtered by technique.
void setTechnique(Qgis::MaterialRenderingTechnique technique)
Sets the required rendering technique which the material must support.
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 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.
virtual void setDockMode(bool dockMode)
Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs.
Represents a vector layer which manages a vector based dataset.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52