Gui: [skip ci] DlgDisplayPropertiesImp doesn't inherit from its UI class any more
This commit is contained in:
@@ -29,12 +29,14 @@
|
||||
# include <Inventor/events/SoMouseButtonEvent.h>
|
||||
# include <Inventor/nodes/SoOrthographicCamera.h>
|
||||
# include <Inventor/nodes/SoPerspectiveCamera.h>
|
||||
# include <QDialog>
|
||||
# include <QFile>
|
||||
# include <QFileInfo>
|
||||
# include <QFont>
|
||||
# include <QFontMetrics>
|
||||
# include <QMessageBox>
|
||||
# include <QPainter>
|
||||
# include <QPointer>
|
||||
# include <QTextStream>
|
||||
# include <boost/bind.hpp>
|
||||
#endif
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
#ifndef _PreComp_
|
||||
# include <algorithm>
|
||||
# include <boost/bind.hpp>
|
||||
# include <boost/signals2.hpp>
|
||||
# include <QDockWidget>
|
||||
#endif
|
||||
|
||||
#include "DlgDisplayPropertiesImp.h"
|
||||
#include "ui_DlgDisplayProperties.h"
|
||||
#include "DlgMaterialPropertiesImp.h"
|
||||
#include "DockWindowManager.h"
|
||||
#include "View3DInventorViewer.h"
|
||||
@@ -57,6 +59,14 @@ using namespace std;
|
||||
qApp->translate("QDockWidget", "Display properties");
|
||||
#endif
|
||||
|
||||
class DlgDisplayPropertiesImp::Private
|
||||
{
|
||||
typedef boost::signals2::connection DlgDisplayPropertiesImp_Connection;
|
||||
public:
|
||||
Ui::DlgDisplayProperties ui;
|
||||
DlgDisplayPropertiesImp_Connection connectChangedObject;
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a DlgDisplayPropertiesImp which is a child of 'parent', with the
|
||||
* name 'name' and widget flags set to 'f'
|
||||
@@ -64,14 +74,15 @@ using namespace std;
|
||||
* The dialog will by default be modeless, unless you set 'modal' to
|
||||
* true to construct a modal dialog.
|
||||
*/
|
||||
DlgDisplayPropertiesImp::DlgDisplayPropertiesImp( QWidget* parent, Qt::WindowFlags fl )
|
||||
DlgDisplayPropertiesImp::DlgDisplayPropertiesImp(QWidget* parent, Qt::WindowFlags fl)
|
||||
: QDialog( parent, fl )
|
||||
, d(new Private)
|
||||
{
|
||||
this->setupUi(this);
|
||||
textLabel1_3->hide();
|
||||
changePlot->hide();
|
||||
buttonLineColor->setModal(false);
|
||||
buttonColor->setModal(false);
|
||||
d->ui.setupUi(this);
|
||||
d->ui.textLabel1_3->hide();
|
||||
d->ui.changePlot->hide();
|
||||
d->ui.buttonLineColor->setModal(false);
|
||||
d->ui.buttonColor->setModal(false);
|
||||
|
||||
std::vector<Gui::ViewProvider*> views = getSelection();
|
||||
setDisplayModes(views);
|
||||
@@ -94,7 +105,7 @@ DlgDisplayPropertiesImp::DlgDisplayPropertiesImp( QWidget* parent, Qt::WindowFla
|
||||
|
||||
Gui::Selection().Attach(this);
|
||||
|
||||
this->connectChangedObject =
|
||||
d->connectChangedObject =
|
||||
Gui::Application::Instance->signalChangedObject.connect(boost::bind
|
||||
(&DlgDisplayPropertiesImp::slotChangedObject, this, _1, _2));
|
||||
}
|
||||
@@ -105,14 +116,14 @@ DlgDisplayPropertiesImp::DlgDisplayPropertiesImp( QWidget* parent, Qt::WindowFla
|
||||
DlgDisplayPropertiesImp::~DlgDisplayPropertiesImp()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
this->connectChangedObject.disconnect();
|
||||
d->connectChangedObject.disconnect();
|
||||
Gui::Selection().Detach(this);
|
||||
}
|
||||
|
||||
void DlgDisplayPropertiesImp::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
this->retranslateUi(this);
|
||||
d->ui.retranslateUi(this);
|
||||
}
|
||||
QDialog::changeEvent(e);
|
||||
}
|
||||
@@ -159,50 +170,50 @@ void DlgDisplayPropertiesImp::slotChangedObject(const Gui::ViewProvider& obj,
|
||||
if (prop.getTypeId() == App::PropertyColor::getClassTypeId()) {
|
||||
App::Color value = static_cast<const App::PropertyColor&>(prop).getValue();
|
||||
if (prop_name == "ShapeColor") {
|
||||
bool blocked = buttonColor->blockSignals(true);
|
||||
buttonColor->setColor(QColor((int)(255.0f*value.r),
|
||||
(int)(255.0f*value.g),
|
||||
(int)(255.0f*value.b)));
|
||||
buttonColor->blockSignals(blocked);
|
||||
bool blocked = d->ui.buttonColor->blockSignals(true);
|
||||
d->ui.buttonColor->setColor(QColor((int)(255.0f*value.r),
|
||||
(int)(255.0f*value.g),
|
||||
(int)(255.0f*value.b)));
|
||||
d->ui.buttonColor->blockSignals(blocked);
|
||||
}
|
||||
else if (prop_name == "LineColor") {
|
||||
bool blocked = buttonLineColor->blockSignals(true);
|
||||
buttonLineColor->setColor(QColor((int)(255.0f*value.r),
|
||||
(int)(255.0f*value.g),
|
||||
(int)(255.0f*value.b)));
|
||||
buttonLineColor->blockSignals(blocked);
|
||||
bool blocked = d->ui.buttonLineColor->blockSignals(true);
|
||||
d->ui.buttonLineColor->setColor(QColor((int)(255.0f*value.r),
|
||||
(int)(255.0f*value.g),
|
||||
(int)(255.0f*value.b)));
|
||||
d->ui.buttonLineColor->blockSignals(blocked);
|
||||
}
|
||||
}
|
||||
else if (prop.getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
|
||||
long value = static_cast<const App::PropertyInteger&>(prop).getValue();
|
||||
if (prop_name == "Transparency") {
|
||||
bool blocked = spinTransparency->blockSignals(true);
|
||||
spinTransparency->setValue(value);
|
||||
spinTransparency->blockSignals(blocked);
|
||||
blocked = horizontalSlider->blockSignals(true);
|
||||
horizontalSlider->setValue(value);
|
||||
horizontalSlider->blockSignals(blocked);
|
||||
bool blocked = d->ui.spinTransparency->blockSignals(true);
|
||||
d->ui.spinTransparency->setValue(value);
|
||||
d->ui.spinTransparency->blockSignals(blocked);
|
||||
blocked = d->ui.horizontalSlider->blockSignals(true);
|
||||
d->ui.horizontalSlider->setValue(value);
|
||||
d->ui.horizontalSlider->blockSignals(blocked);
|
||||
}
|
||||
else if (prop_name == "LineTransparency") {
|
||||
bool blocked = spinLineTransparency->blockSignals(true);
|
||||
spinLineTransparency->setValue(value);
|
||||
spinLineTransparency->blockSignals(blocked);
|
||||
blocked = sliderLineTransparency->blockSignals(true);
|
||||
sliderLineTransparency->setValue(value);
|
||||
sliderLineTransparency->blockSignals(blocked);
|
||||
bool blocked = d->ui.spinLineTransparency->blockSignals(true);
|
||||
d->ui.spinLineTransparency->setValue(value);
|
||||
d->ui.spinLineTransparency->blockSignals(blocked);
|
||||
blocked = d->ui.sliderLineTransparency->blockSignals(true);
|
||||
d->ui.sliderLineTransparency->setValue(value);
|
||||
d->ui.sliderLineTransparency->blockSignals(blocked);
|
||||
}
|
||||
}
|
||||
else if (prop.getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
||||
double value = static_cast<const App::PropertyFloat&>(prop).getValue();
|
||||
if (prop_name == "PointSize") {
|
||||
bool blocked = spinPointSize->blockSignals(true);
|
||||
spinPointSize->setValue((int)value);
|
||||
spinPointSize->blockSignals(blocked);
|
||||
bool blocked = d->ui.spinPointSize->blockSignals(true);
|
||||
d->ui.spinPointSize->setValue((int)value);
|
||||
d->ui.spinPointSize->blockSignals(blocked);
|
||||
}
|
||||
else if (prop_name == "LineWidth") {
|
||||
bool blocked = spinLineWidth->blockSignals(true);
|
||||
spinLineWidth->setValue((int)value);
|
||||
spinLineWidth->blockSignals(blocked);
|
||||
bool blocked = d->ui.spinLineWidth->blockSignals(true);
|
||||
d->ui.spinLineWidth->setValue((int)value);
|
||||
d->ui.spinLineWidth->blockSignals(blocked);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,7 +240,7 @@ void DlgDisplayPropertiesImp::on_buttonUserDefinedMaterial_clicked()
|
||||
dlg.setViewProviders(Provider);
|
||||
dlg.exec();
|
||||
|
||||
buttonColor->setColor(dlg.diffuseColor->color());
|
||||
d->ui.buttonColor->setColor(dlg.diffuseColor->color());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -253,10 +264,12 @@ void DlgDisplayPropertiesImp::on_buttonColorPlot_clicked()
|
||||
void DlgDisplayPropertiesImp::on_changeMaterial_activated(int index)
|
||||
{
|
||||
std::vector<Gui::ViewProvider*> Provider = getSelection();
|
||||
App::Material::MaterialType matType = static_cast<App::Material::MaterialType>(changeMaterial->itemData(index).toInt());
|
||||
App::Material::MaterialType matType = static_cast<App::Material::MaterialType>(d->ui.changeMaterial->itemData(index).toInt());
|
||||
App::Material mat(matType);
|
||||
App::Color diffuseColor = mat.diffuseColor;
|
||||
buttonColor->setColor(QColor((int)(diffuseColor.r*255.0f), (int)(diffuseColor.g*255.0f), (int)(diffuseColor.b*255.0f)));
|
||||
d->ui.buttonColor->setColor(QColor((int)(diffuseColor.r*255.0f),
|
||||
(int)(diffuseColor.g*255.0f),
|
||||
(int)(diffuseColor.b*255.0f)));
|
||||
|
||||
for (std::vector<Gui::ViewProvider*>::iterator It= Provider.begin();It!=Provider.end();++It) {
|
||||
App::Property* prop = (*It)->getPropertyByName("ShapeMaterial");
|
||||
@@ -294,7 +307,7 @@ void DlgDisplayPropertiesImp::on_changePlot_activated(const QString&s)
|
||||
void DlgDisplayPropertiesImp::on_buttonColor_changed()
|
||||
{
|
||||
std::vector<Gui::ViewProvider*> Provider = getSelection();
|
||||
QColor s = buttonColor->color();
|
||||
QColor s = d->ui.buttonColor->color();
|
||||
App::Color c(s.red()/255.0,s.green()/255.0,s.blue()/255.0);
|
||||
for (std::vector<Gui::ViewProvider*>::iterator It= Provider.begin();It!=Provider.end();++It) {
|
||||
App::Property* prop = (*It)->getPropertyByName("ShapeColor");
|
||||
@@ -353,7 +366,7 @@ void DlgDisplayPropertiesImp::on_spinLineWidth_valueChanged(int linewidth)
|
||||
void DlgDisplayPropertiesImp::on_buttonLineColor_changed()
|
||||
{
|
||||
std::vector<Gui::ViewProvider*> Provider = getSelection();
|
||||
QColor s = buttonLineColor->color();
|
||||
QColor s = d->ui.buttonLineColor->color();
|
||||
App::Color c(s.red()/255.0,s.green()/255.0,s.blue()/255.0);
|
||||
for (std::vector<Gui::ViewProvider*>::iterator It= Provider.begin();It!=Provider.end();++It) {
|
||||
App::Property* prop = (*It)->getPropertyByName("LineColor");
|
||||
@@ -401,9 +414,9 @@ void DlgDisplayPropertiesImp::setDisplayModes(const std::vector<Gui::ViewProvide
|
||||
}
|
||||
}
|
||||
|
||||
changeMode->clear();
|
||||
changeMode->addItems(commonModes);
|
||||
changeMode->setDisabled(commonModes.isEmpty());
|
||||
d->ui.changeMode->clear();
|
||||
d->ui.changeMode->addItems(commonModes);
|
||||
d->ui.changeMode->setDisabled(commonModes.isEmpty());
|
||||
|
||||
// find the display mode to activate
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
@@ -411,9 +424,9 @@ void DlgDisplayPropertiesImp::setDisplayModes(const std::vector<Gui::ViewProvide
|
||||
if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) {
|
||||
App::PropertyEnumeration* display = static_cast<App::PropertyEnumeration*>(prop);
|
||||
QString activeMode = QString::fromLatin1(display->getValueAsString());
|
||||
int index = changeMode->findText(activeMode);
|
||||
int index = d->ui.changeMode->findText(activeMode);
|
||||
if (index != -1) {
|
||||
changeMode->setCurrentIndex(index);
|
||||
d->ui.changeMode->setCurrentIndex(index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -433,12 +446,12 @@ void DlgDisplayPropertiesImp::setMaterial(const std::vector<Gui::ViewProvider*>&
|
||||
}
|
||||
}
|
||||
|
||||
int index = changeMaterial->findData(matType);
|
||||
int index = d->ui.changeMaterial->findData(matType);
|
||||
if (index >= 0) {
|
||||
changeMaterial->setCurrentIndex(index);
|
||||
d->ui.changeMaterial->setCurrentIndex(index);
|
||||
}
|
||||
changeMaterial->setEnabled(material);
|
||||
buttonUserDefinedMaterial->setEnabled(material);
|
||||
d->ui.changeMaterial->setEnabled(material);
|
||||
d->ui.buttonUserDefinedMaterial->setEnabled(material);
|
||||
}
|
||||
|
||||
void DlgDisplayPropertiesImp::setColorPlot(const std::vector<Gui::ViewProvider*>& views)
|
||||
@@ -452,33 +465,33 @@ void DlgDisplayPropertiesImp::setColorPlot(const std::vector<Gui::ViewProvider*>
|
||||
}
|
||||
}
|
||||
|
||||
buttonColorPlot->setEnabled(material);
|
||||
d->ui.buttonColorPlot->setEnabled(material);
|
||||
}
|
||||
|
||||
void DlgDisplayPropertiesImp::fillupMaterials()
|
||||
{
|
||||
changeMaterial->addItem(tr("Default"), App::Material::DEFAULT);
|
||||
changeMaterial->addItem(tr("Aluminium"), App::Material::ALUMINIUM);
|
||||
changeMaterial->addItem(tr("Brass"), App::Material::BRASS);
|
||||
changeMaterial->addItem(tr("Bronze"), App::Material::BRONZE);
|
||||
changeMaterial->addItem(tr("Copper"), App::Material::COPPER);
|
||||
changeMaterial->addItem(tr("Chrome"), App::Material::CHROME);
|
||||
changeMaterial->addItem(tr("Emerald"), App::Material::EMERALD);
|
||||
changeMaterial->addItem(tr("Gold"), App::Material::GOLD);
|
||||
changeMaterial->addItem(tr("Jade"), App::Material::JADE);
|
||||
changeMaterial->addItem(tr("Metalized"), App::Material::METALIZED);
|
||||
changeMaterial->addItem(tr("Neon GNC"), App::Material::NEON_GNC);
|
||||
changeMaterial->addItem(tr("Neon PHC"), App::Material::NEON_PHC);
|
||||
changeMaterial->addItem(tr("Obsidian"), App::Material::OBSIDIAN);
|
||||
changeMaterial->addItem(tr("Pewter"), App::Material::PEWTER);
|
||||
changeMaterial->addItem(tr("Plaster"), App::Material::PLASTER);
|
||||
changeMaterial->addItem(tr("Plastic"), App::Material::PLASTIC);
|
||||
changeMaterial->addItem(tr("Ruby"), App::Material::RUBY);
|
||||
changeMaterial->addItem(tr("Satin"), App::Material::SATIN);
|
||||
changeMaterial->addItem(tr("Shiny plastic"), App::Material::SHINY_PLASTIC);
|
||||
changeMaterial->addItem(tr("Silver"), App::Material::SILVER);
|
||||
changeMaterial->addItem(tr("Steel"), App::Material::STEEL);
|
||||
changeMaterial->addItem(tr("Stone"), App::Material::STONE);
|
||||
d->ui.changeMaterial->addItem(tr("Default"), App::Material::DEFAULT);
|
||||
d->ui.changeMaterial->addItem(tr("Aluminium"), App::Material::ALUMINIUM);
|
||||
d->ui.changeMaterial->addItem(tr("Brass"), App::Material::BRASS);
|
||||
d->ui.changeMaterial->addItem(tr("Bronze"), App::Material::BRONZE);
|
||||
d->ui.changeMaterial->addItem(tr("Copper"), App::Material::COPPER);
|
||||
d->ui.changeMaterial->addItem(tr("Chrome"), App::Material::CHROME);
|
||||
d->ui.changeMaterial->addItem(tr("Emerald"), App::Material::EMERALD);
|
||||
d->ui.changeMaterial->addItem(tr("Gold"), App::Material::GOLD);
|
||||
d->ui.changeMaterial->addItem(tr("Jade"), App::Material::JADE);
|
||||
d->ui.changeMaterial->addItem(tr("Metalized"), App::Material::METALIZED);
|
||||
d->ui.changeMaterial->addItem(tr("Neon GNC"), App::Material::NEON_GNC);
|
||||
d->ui.changeMaterial->addItem(tr("Neon PHC"), App::Material::NEON_PHC);
|
||||
d->ui.changeMaterial->addItem(tr("Obsidian"), App::Material::OBSIDIAN);
|
||||
d->ui.changeMaterial->addItem(tr("Pewter"), App::Material::PEWTER);
|
||||
d->ui.changeMaterial->addItem(tr("Plaster"), App::Material::PLASTER);
|
||||
d->ui.changeMaterial->addItem(tr("Plastic"), App::Material::PLASTIC);
|
||||
d->ui.changeMaterial->addItem(tr("Ruby"), App::Material::RUBY);
|
||||
d->ui.changeMaterial->addItem(tr("Satin"), App::Material::SATIN);
|
||||
d->ui.changeMaterial->addItem(tr("Shiny plastic"), App::Material::SHINY_PLASTIC);
|
||||
d->ui.changeMaterial->addItem(tr("Silver"), App::Material::SILVER);
|
||||
d->ui.changeMaterial->addItem(tr("Steel"), App::Material::STEEL);
|
||||
d->ui.changeMaterial->addItem(tr("Stone"), App::Material::STONE);
|
||||
}
|
||||
|
||||
void DlgDisplayPropertiesImp::setShapeColor(const std::vector<Gui::ViewProvider*>& views)
|
||||
@@ -490,15 +503,15 @@ void DlgDisplayPropertiesImp::setShapeColor(const std::vector<Gui::ViewProvider*
|
||||
App::Color c = static_cast<App::PropertyColor*>(prop)->getValue();
|
||||
QColor shape;
|
||||
shape.setRgb((int)(c.r*255.0f), (int)(c.g*255.0f),(int)(c.b*255.0f));
|
||||
bool blocked = buttonColor->blockSignals(true);
|
||||
buttonColor->setColor(shape);
|
||||
buttonColor->blockSignals(blocked);
|
||||
bool blocked = d->ui.buttonColor->blockSignals(true);
|
||||
d->ui.buttonColor->setColor(shape);
|
||||
d->ui.buttonColor->blockSignals(blocked);
|
||||
shapeColor = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
buttonColor->setEnabled(shapeColor);
|
||||
d->ui.buttonColor->setEnabled(shapeColor);
|
||||
}
|
||||
|
||||
void DlgDisplayPropertiesImp::setLineColor(const std::vector<Gui::ViewProvider*>& views)
|
||||
@@ -510,15 +523,15 @@ void DlgDisplayPropertiesImp::setLineColor(const std::vector<Gui::ViewProvider*>
|
||||
App::Color c = static_cast<App::PropertyColor*>(prop)->getValue();
|
||||
QColor shape;
|
||||
shape.setRgb((int)(c.r*255.0f), (int)(c.g*255.0f),(int)(c.b*255.0f));
|
||||
bool blocked = buttonLineColor->blockSignals(true);
|
||||
buttonLineColor->setColor(shape);
|
||||
buttonLineColor->blockSignals(blocked);
|
||||
bool blocked = d->ui.buttonLineColor->blockSignals(true);
|
||||
d->ui.buttonLineColor->setColor(shape);
|
||||
d->ui.buttonLineColor->blockSignals(blocked);
|
||||
shapeColor = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
buttonLineColor->setEnabled(shapeColor);
|
||||
d->ui.buttonLineColor->setEnabled(shapeColor);
|
||||
}
|
||||
|
||||
void DlgDisplayPropertiesImp::setPointSize(const std::vector<Gui::ViewProvider*>& views)
|
||||
@@ -527,15 +540,15 @@ void DlgDisplayPropertiesImp::setPointSize(const std::vector<Gui::ViewProvider*>
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("PointSize");
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
||||
bool blocked = spinPointSize->blockSignals(true);
|
||||
spinPointSize->setValue((int)static_cast<App::PropertyFloat*>(prop)->getValue());
|
||||
spinPointSize->blockSignals(blocked);
|
||||
bool blocked = d->ui.spinPointSize->blockSignals(true);
|
||||
d->ui.spinPointSize->setValue((int)static_cast<App::PropertyFloat*>(prop)->getValue());
|
||||
d->ui.spinPointSize->blockSignals(blocked);
|
||||
pointSize = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
spinPointSize->setEnabled(pointSize);
|
||||
d->ui.spinPointSize->setEnabled(pointSize);
|
||||
}
|
||||
|
||||
void DlgDisplayPropertiesImp::setLineWidth(const std::vector<Gui::ViewProvider*>& views)
|
||||
@@ -544,15 +557,15 @@ void DlgDisplayPropertiesImp::setLineWidth(const std::vector<Gui::ViewProvider*>
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("LineWidth");
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
||||
bool blocked = spinLineWidth->blockSignals(true);
|
||||
spinLineWidth->setValue((int)static_cast<App::PropertyFloat*>(prop)->getValue());
|
||||
spinLineWidth->blockSignals(blocked);
|
||||
bool blocked = d->ui.spinLineWidth->blockSignals(true);
|
||||
d->ui.spinLineWidth->setValue((int)static_cast<App::PropertyFloat*>(prop)->getValue());
|
||||
d->ui.spinLineWidth->blockSignals(blocked);
|
||||
lineWidth = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
spinLineWidth->setEnabled(lineWidth);
|
||||
d->ui.spinLineWidth->setEnabled(lineWidth);
|
||||
}
|
||||
|
||||
void DlgDisplayPropertiesImp::setTransparency(const std::vector<Gui::ViewProvider*>& views)
|
||||
@@ -561,20 +574,20 @@ void DlgDisplayPropertiesImp::setTransparency(const std::vector<Gui::ViewProvide
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("Transparency");
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
|
||||
bool blocked = spinTransparency->blockSignals(true);
|
||||
spinTransparency->setValue(static_cast<App::PropertyInteger*>(prop)->getValue());
|
||||
spinTransparency->blockSignals(blocked);
|
||||
bool blocked = d->ui.spinTransparency->blockSignals(true);
|
||||
d->ui.spinTransparency->setValue(static_cast<App::PropertyInteger*>(prop)->getValue());
|
||||
d->ui.spinTransparency->blockSignals(blocked);
|
||||
|
||||
blocked = horizontalSlider->blockSignals(true);
|
||||
horizontalSlider->setValue(static_cast<App::PropertyInteger*>(prop)->getValue());
|
||||
horizontalSlider->blockSignals(blocked);
|
||||
blocked = d->ui.horizontalSlider->blockSignals(true);
|
||||
d->ui.horizontalSlider->setValue(static_cast<App::PropertyInteger*>(prop)->getValue());
|
||||
d->ui.horizontalSlider->blockSignals(blocked);
|
||||
transparency = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
spinTransparency->setEnabled(transparency);
|
||||
horizontalSlider->setEnabled(transparency);
|
||||
d->ui.spinTransparency->setEnabled(transparency);
|
||||
d->ui.horizontalSlider->setEnabled(transparency);
|
||||
}
|
||||
|
||||
void DlgDisplayPropertiesImp::setLineTransparency(const std::vector<Gui::ViewProvider*>& views)
|
||||
@@ -583,20 +596,20 @@ void DlgDisplayPropertiesImp::setLineTransparency(const std::vector<Gui::ViewPro
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("LineTransparency");
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
|
||||
bool blocked = spinLineTransparency->blockSignals(true);
|
||||
spinLineTransparency->setValue(static_cast<App::PropertyInteger*>(prop)->getValue());
|
||||
spinLineTransparency->blockSignals(blocked);
|
||||
bool blocked = d->ui.spinLineTransparency->blockSignals(true);
|
||||
d->ui.spinLineTransparency->setValue(static_cast<App::PropertyInteger*>(prop)->getValue());
|
||||
d->ui.spinLineTransparency->blockSignals(blocked);
|
||||
|
||||
blocked = sliderLineTransparency->blockSignals(true);
|
||||
sliderLineTransparency->setValue(static_cast<App::PropertyInteger*>(prop)->getValue());
|
||||
sliderLineTransparency->blockSignals(blocked);
|
||||
blocked = d->ui.sliderLineTransparency->blockSignals(true);
|
||||
d->ui.sliderLineTransparency->setValue(static_cast<App::PropertyInteger*>(prop)->getValue());
|
||||
d->ui.sliderLineTransparency->blockSignals(blocked);
|
||||
transparency = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
spinLineTransparency->setEnabled(transparency);
|
||||
sliderLineTransparency->setEnabled(transparency);
|
||||
d->ui.spinLineTransparency->setEnabled(transparency);
|
||||
d->ui.sliderLineTransparency->setEnabled(transparency);
|
||||
}
|
||||
|
||||
std::vector<Gui::ViewProvider*> DlgDisplayPropertiesImp::getSelection() const
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
#ifndef GUI_DIALOG_DLGDISPLAYPROPERTIES_IMP_H
|
||||
#define GUI_DIALOG_DLGDISPLAYPROPERTIES_IMP_H
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <boost/signals2.hpp>
|
||||
#include <QDialog>
|
||||
|
||||
#include "ui_DlgDisplayProperties.h"
|
||||
#include "Selection.h"
|
||||
#include <App/Material.h>
|
||||
|
||||
@@ -42,20 +42,19 @@ namespace Gui {
|
||||
class Command;
|
||||
|
||||
namespace Dialog {
|
||||
typedef boost::signals2::connection DlgDisplayPropertiesImp_Connection;
|
||||
|
||||
/**
|
||||
* The DlgDisplayPropertiesImp class implements a dialog containing all available document
|
||||
* templates to create a new document.
|
||||
* \author Jürgen Riegel
|
||||
*/
|
||||
class DlgDisplayPropertiesImp : public QDialog, public Ui_DlgDisplayProperties,
|
||||
class DlgDisplayPropertiesImp : public QDialog,
|
||||
public Gui::SelectionSingleton::ObserverType
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DlgDisplayPropertiesImp( QWidget* parent = 0, Qt::WindowFlags fl = 0 );
|
||||
DlgDisplayPropertiesImp(QWidget* parent = nullptr, Qt::WindowFlags fl = 0);
|
||||
~DlgDisplayPropertiesImp();
|
||||
/// Observer message from the Selection
|
||||
void OnChange(Gui::SelectionSingleton::SubjectType &rCaller,
|
||||
@@ -92,7 +91,9 @@ private:
|
||||
void setLineTransparency(const std::vector<ViewProvider*>&);
|
||||
std::vector<ViewProvider*> getSelection() const;
|
||||
|
||||
DlgDisplayPropertiesImp_Connection connectChangedObject;
|
||||
private:
|
||||
class Private;
|
||||
std::unique_ptr<Private> d;
|
||||
};
|
||||
|
||||
} // namespace Dialog
|
||||
|
||||
Reference in New Issue
Block a user