CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Loading...
Searching...
No Matches
ctkMaterialPropertyWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Library: CTK
4
5 Copyright (c) Kitware Inc.
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0.txt
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18
19=========================================================================*/
20
21#ifndef __ctkMaterialPropertyWidget_h
22#define __ctkMaterialPropertyWidget_h
23
24// Qt includes
25#include <QWidget>
26
27// CTK includes
28#include "ctkWidgetsExport.h"
29
30class ctkMaterialPropertyWidgetPrivate;
31class QListWidgetItem;
32
39class CTK_WIDGETS_EXPORT ctkMaterialPropertyWidget : public QWidget
40{
41 Q_OBJECT
43 Q_PROPERTY(QColor color READ color WRITE setColor);
45 Q_PROPERTY(double opacity READ opacity WRITE setOpacity);
51 Q_PROPERTY(double ambient READ ambient WRITE setAmbient);
55 Q_PROPERTY(double diffuse READ diffuse WRITE setDiffuse);
59 Q_PROPERTY(double specular READ specular WRITE setSpecular);
62 Q_PROPERTY(double specularPower READ specularPower WRITE setSpecularPower);
64 Q_PROPERTY(bool backfaceCulling READ backfaceCulling WRITE setBackfaceCulling);
66 Q_PROPERTY(bool colorVisible READ isColorVisible WRITE setColorVisible);
68 Q_PROPERTY(bool opacityVisible READ isOpacityVisible WRITE setOpacityVisible);
70 Q_PROPERTY(bool backfaceCullingVisible READ isBackfaceCullingVisible WRITE setBackfaceCullingVisible);
71
72public:
74 typedef QWidget Superclass;
75
77 explicit ctkMaterialPropertyWidget(QWidget* parent = 0);
78
81
82 QColor color()const;
83 double opacity()const;
84
85 double ambient()const;
86 double diffuse()const;
87 double specular()const;
88 double specularPower()const;
89
90 bool backfaceCulling()const;
91
98 void addPreset(const QColor& color, double opacity,
99 double ambient, double diffuse,
100 double specular, double power,
101 const QString& label);
102
103 bool isColorVisible()const;
104 void setColorVisible(bool show);
105 bool isOpacityVisible()const;
106 void setOpacityVisible(bool show);
109
110public Q_SLOTS:
111 void setColor(const QColor& newColor);
112 void setOpacity(double newOpacity);
113
114 void setAmbient(double newAmbient);
115 void setDiffuse(double newDiffuse);
116 void setSpecular(double newSpecular);
117 void setSpecularPower(double newSpecularPower);
118
119 void setBackfaceCulling(bool enable);
120
121Q_SIGNALS:
122 void colorChanged(QColor newColor);
123 void opacityChanged(double newOpacity);
124
125 void ambientChanged(double newAmbient);
126 void diffuseChanged(double newDiffuse);
127 void specularChanged(double newSpecular);
128 void specularPowerChanged(double newSpecularPower);
129
130 void backfaceCullingChanged(bool newBackfaceCulling);
131protected Q_SLOTS:
132 virtual void onColorChanged(const QColor& newColor);
133 virtual void onOpacityChanged(double newOpacity);
134
135 virtual void onAmbientChanged(double newAmbient);
136 virtual void onDiffuseChanged(double newDiffuse);
137 virtual void onSpecularChanged(double newSpecular);
138 virtual void onSpecularPowerChanged(double newSpecularPower);
139
140 virtual void onBackfaceCullingChanged(bool newBackFaceCulling);
141
142 void selectPreset(QListWidgetItem*);
143
144protected:
145 QScopedPointer<ctkMaterialPropertyWidgetPrivate> d_ptr;
146
147 virtual void resizeEvent(QResizeEvent* resize);
148private:
149 Q_DECLARE_PRIVATE(ctkMaterialPropertyWidget);
150 Q_DISABLE_COPY(ctkMaterialPropertyWidget);
151};
152
153#endif
double specularPower() const
void specularChanged(double newSpecular)
void setSpecular(double newSpecular)
void setAmbient(double newAmbient)
void setColor(const QColor &newColor)
QScopedPointer< ctkMaterialPropertyWidgetPrivate > d_ptr
virtual ~ctkMaterialPropertyWidget()
Destructor.
virtual void onAmbientChanged(double newAmbient)
void ambientChanged(double newAmbient)
void setOpacity(double newOpacity)
virtual void onSpecularChanged(double newSpecular)
QWidget Superclass
Superclass typedef.
void setBackfaceCulling(bool enable)
virtual void onColorChanged(const QColor &newColor)
virtual void onOpacityChanged(double newOpacity)
void selectPreset(QListWidgetItem *)
void colorChanged(QColor newColor)
virtual void onSpecularPowerChanged(double newSpecularPower)
void setOpacityVisible(bool show)
void setBackfaceCullingVisible(bool show)
bool isBackfaceCullingVisible() const
bool isOpacityVisible() const
void backfaceCullingChanged(bool newBackfaceCulling)
virtual void onDiffuseChanged(double newDiffuse)
virtual void resizeEvent(QResizeEvent *resize)
void setSpecularPower(double newSpecularPower)
void addPreset(const QColor &color, double opacity, double ambient, double diffuse, double specular, double power, const QString &label)
bool backfaceCulling() const
void setColorVisible(bool show)
void specularPowerChanged(double newSpecularPower)
void diffuseChanged(double newDiffuse)
void setDiffuse(double newDiffuse)
virtual void onBackfaceCullingChanged(bool newBackFaceCulling)
ctkMaterialPropertyWidget(QWidget *parent=0)
Constructor.
void opacityChanged(double newOpacity)