20 #ifndef AXLINSPECTORUTILS_H
21 #define AXLINSPECTORUTILS_H
23 #include "axlGuiExport.h"
26 #define AXL_PROPERTY_COLOR 0
27 #define AXL_PROPERTY_OPACITY 1
28 #define AXL_PROPERTY_SHADER 2
29 #define AXL_PROPERTY_SIZE 3
33 #ifndef addColorButton
34 #define addColorButton(layoutTop, colorButton, slot, init)\
35 colorButton = new dtkColorButton(this);\
36 QHBoxLayout *layoutColorButton = new QHBoxLayout;\
37 layoutColorButton->addWidget(new QLabel("Color",this));\
38 layoutColorButton->addWidget(colorButton);\
39 colorButton->setColor(this->initColorValue());\
40 layoutTop->addLayout(layoutColorButton);\
41 connect(colorButton, SIGNAL(colorChanged(QColor)), this, SLOT(slot (QColor)));
45 #define addSizeSlider(layoutTop, sliderSize, slot, init)\
46 sliderSize = new QSlider(Qt::Horizontal, this);\
47 QHBoxLayout *layoutSize = new QHBoxLayout;\
48 layoutSize->addWidget(new QLabel("Size",this));\
49 layoutSize->addWidget(sliderSize);\
50 sliderSize->setMinimum(-800);\
51 sliderSize->setMaximum(500);\
52 sliderSize->setValue(init);\
53 layoutTop->addLayout(layoutSize);\
54 connect(sliderSize, SIGNAL(valueChanged(int)), this, SLOT(slot (int)));
57 #ifndef addOpacitySlider
58 #define addOpacitySlider(layoutTop, sliderOpacity, slot, init)\
59 sliderOpacity = new QSlider(Qt::Horizontal, this);\
60 sliderOpacity->setMaximum(100);\
61 sliderOpacity->setValue(init);\
62 QHBoxLayout *layoutOpacity = new QHBoxLayout;\
63 layoutOpacity->addWidget(new QLabel("Opacity", this));\
64 layoutOpacity->addWidget(sliderOpacity);\
65 layoutTop->addLayout(layoutOpacity);\
66 connect(sliderOpacity, SIGNAL(valueChanged(int)), this, SLOT(slot (int)));
69 #ifndef addShaderComboBox
70 #define addShaderComboBox(layoutTop, comboBoxShader, checkBoxShader, lineEditShader, buttonShader,\
71 onComboBoxChanged, onCheckBoxChanged, onTextChanged, openShader, init)\
72 comboBoxShader = new QComboBox(this);\
73 comboBoxShader->setInsertPolicy(QComboBox::InsertAlphabetically);\
74 checkBoxShader = new QCheckBox(this);\
75 lineEditShader = new QLineEdit(this);\
76 buttonShader = new QPushButton(this);\
77 buttonShader->setText("open");\
78 lineEditShader->setText(init);\
79 this->initComboBoxShaderValue(comboBoxShader,lineEditShader);\
80 if(lineEditShader->text().isEmpty())\
82 lineEditShader->setEnabled(false);\
83 buttonShader->setEnabled(false);\
84 comboBoxShader->setEnabled(false);\
87 checkBoxShader->setChecked(true);\
89 QVBoxLayout *layoutShader = new QVBoxLayout;\
90 QHBoxLayout *layoutShader1 = new QHBoxLayout;\
92 QLabel *labelShader = new QLabel("Shader",this);\
93 layoutShader1->addWidget(labelShader);\
94 layoutShader1->addWidget(checkBoxShader);\
95 layoutShader1->addWidget(comboBoxShader);\
96 layoutShader1->addWidget(buttonShader);\
98 layoutShader1->setStretchFactor(labelShader, 2);\
99 layoutShader1->setStretchFactor(checkBoxShader, 1);\
100 layoutShader1->setStretchFactor(comboBoxShader, 4);\
101 layoutShader1->setStretchFactor(buttonShader, 3);\
103 layoutShader->addLayout(layoutShader1);\
104 layoutShader->addWidget(lineEditShader);\
105 layoutTop->addLayout(layoutShader);\
106 connect(comboBoxShader, SIGNAL(currentIndexChanged(QString)), this, SLOT(onComboBoxChanged (QString)));\
107 connect(checkBoxShader, SIGNAL(clicked(bool)), this, SLOT(onCheckBoxChanged (bool)));\
108 connect(buttonShader, SIGNAL(clicked()), this, SLOT(openShader ()));\
109 connect(lineEditShader, SIGNAL(textChanged(QString)), this, SLOT(onTextChanged (QString)));
112 #ifndef addPointLayout
113 #define addPointLayout(layoutTop, name, title, coordinatePoint, slot, init)\
114 coordinatePoint##_x = new QDoubleSpinBox(this);\
115 coordinatePoint##_x->setRange(-1000, 1000);\
116 coordinatePoint##_x->setValue(init->x());\
117 coordinatePoint##_x->setSingleStep(0.1);\
119 coordinatePoint##_y = new QDoubleSpinBox(this);\
120 coordinatePoint##_y->setRange(-1000, 1000);\
121 coordinatePoint##_y->setValue(init->y());\
122 coordinatePoint##_y->setSingleStep(0.1);\
124 coordinatePoint##_z = new QDoubleSpinBox(this);\
125 coordinatePoint##_z->setRange(-1000, 1000);\
126 coordinatePoint##_z->setValue(init->z());\
127 coordinatePoint##_z->setSingleStep(0.1);\
129 QHBoxLayout * name##LayoutCoordinate_x = new QHBoxLayout;\
130 name##LayoutCoordinate_x->addWidget(new QLabel("X",this));\
131 name##LayoutCoordinate_x->addWidget(coordinatePoint##_x);\
133 QHBoxLayout *name##LayoutCoordinate_y = new QHBoxLayout;\
134 name##LayoutCoordinate_y->addWidget(new QLabel("Y",this));\
135 name##LayoutCoordinate_y->addWidget(coordinatePoint##_y);\
137 QHBoxLayout *name##LayoutCoordinate_z = new QHBoxLayout;\
138 name##LayoutCoordinate_z->addWidget(new QLabel("Z",this));\
139 name##LayoutCoordinate_z->addWidget(coordinatePoint##_z);\
141 layoutTop->addWidget(new QLabel(title,this));\
142 layoutTop->addLayout(name##LayoutCoordinate_x);\
143 layoutTop->addLayout(name##LayoutCoordinate_y);\
144 layoutTop->addLayout(name##LayoutCoordinate_z);\
146 connect(coordinatePoint##_x, SIGNAL(valueChanged(double)), this, SLOT(slot##_x (double)));\
147 connect(coordinatePoint##_y, SIGNAL(valueChanged(double)), this, SLOT(slot##_y (double)));\
148 connect(coordinatePoint##_z, SIGNAL(valueChanged(double)), this, SLOT(slot##_z (double)));
152 #ifndef addValueLayout
153 #define addValueLayout(layoutTop, name, title, data, slot, init)\
155 data = new QDoubleSpinBox(this);\
156 data->setValue(init);\
157 data->setSingleStep(0.1);\
159 QHBoxLayout* name##Layout = new QHBoxLayout;\
160 name##Layout->addWidget(new QLabel(title,this));\
161 name##Layout->addWidget(data);\
162 data->setValue(init);\
163 layoutTop->addLayout(name##Layout);\
164 connect(data, SIGNAL(valueChanged(double)), this, SLOT(slot (double)));
168 #endif // AXLINSPECTORUTILS_H
bool AXLGUI_EXPORT caseInsensitiveLessThan(const QString &s1, const QString &s2)