QGIS API Documentation 4.2.0-Belém do Pará (ec9a7f91d0f)
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
112 public slots:
113
117 void setPreviewVisible( bool visible );
118
119 signals:
120
124 void changed();
125
126 private slots:
127 void materialTypeChanged();
128 void materialWidgetChanged();
129
130 private:
131 void updateMaterialWidget();
132 void rebuildAvailableTypes();
133 bool mPreviewVisible = false;
134 QPointer< QgsVectorLayer > mLayer;
135
136 std::unique_ptr<QgsAbstractMaterialSettings> mCurrentSettings;
137
138 bool mFilterByTechnique = false;
140};
141
142
150class GUI_EXPORT QgsMaterialWidgetDialog : public QDialog
151{
152 Q_OBJECT
153
154 public:
159
163 std::unique_ptr< QgsAbstractMaterialSettings > settings();
164
168 QDialogButtonBox *buttonBox();
169
170 private:
171 QgsMaterialWidget *mWidget = nullptr;
172 QDialogButtonBox *mButtonBox = nullptr;
173};
174
175
176#endif // QGSMATERIALWIDGET_H
MaterialRenderingTechnique
Material rendering techniques.
Definition qgis.h:4375
@ Triangles
Triangle based rendering (default).
Definition qgis.h:4376
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.
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