fix -Wextra in FreeCADGui
This commit is contained in:
@@ -79,6 +79,7 @@ void TaskAppearance::changeEvent(QEvent *e)
|
||||
void TaskAppearance::OnChange(Gui::SelectionSingleton::SubjectType &rCaller,
|
||||
Gui::SelectionSingleton::MessageType Reason)
|
||||
{
|
||||
Q_UNUSED(rCaller);
|
||||
if (Reason.Type == SelectionChanges::AddSelection ||
|
||||
Reason.Type == SelectionChanges::RmvSelection ||
|
||||
Reason.Type == SelectionChanges::SetSelection ||
|
||||
@@ -199,53 +200,53 @@ void TaskAppearance::on_spinLineWidth_valueChanged(int linewidth)
|
||||
|
||||
void TaskAppearance::setDisplayModes(const std::vector<Gui::ViewProvider*>& views)
|
||||
{
|
||||
QStringList commonModes, modes;
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("DisplayMode");
|
||||
QStringList commonModes, modes;
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("DisplayMode");
|
||||
if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) {
|
||||
App::PropertyEnumeration* display = static_cast<App::PropertyEnumeration*>(prop);
|
||||
if (!display->getEnums()) return;
|
||||
const std::vector<std::string>& value = display->getEnumVector();
|
||||
if (it == views.begin()) {
|
||||
for (std::vector<std::string>::const_iterator jt = value.begin(); jt != value.end(); ++jt)
|
||||
commonModes << QLatin1String(jt->c_str());
|
||||
}
|
||||
else {
|
||||
for (std::vector<std::string>::const_iterator jt = value.begin(); jt != value.end(); ++jt) {
|
||||
if (commonModes.contains(QLatin1String(jt->c_str())))
|
||||
modes << QLatin1String(jt->c_str());
|
||||
}
|
||||
|
||||
commonModes = modes;
|
||||
modes.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ui->changeMode->clear();
|
||||
ui->changeMode->addItems(commonModes);
|
||||
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) {
|
||||
App::Property* prop = (*it)->getPropertyByName("DisplayMode");
|
||||
App::PropertyEnumeration* display = static_cast<App::PropertyEnumeration*>(prop);
|
||||
if (!display->getEnums()) return;
|
||||
const std::vector<std::string>& value = display->getEnumVector();
|
||||
if (it == views.begin()) {
|
||||
for (std::vector<std::string>::const_iterator jt = value.begin(); jt != value.end(); ++jt)
|
||||
commonModes << QLatin1String(jt->c_str());
|
||||
}
|
||||
else {
|
||||
for (std::vector<std::string>::const_iterator jt = value.begin(); jt != value.end(); ++jt) {
|
||||
if (commonModes.contains(QLatin1String(jt->c_str())))
|
||||
modes << QLatin1String(jt->c_str());
|
||||
}
|
||||
|
||||
commonModes = modes;
|
||||
modes.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ui->changeMode->clear();
|
||||
ui->changeMode->addItems(commonModes);
|
||||
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) {
|
||||
App::Property* prop = (*it)->getPropertyByName("DisplayMode");
|
||||
if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) {
|
||||
App::PropertyEnumeration* display = static_cast<App::PropertyEnumeration*>(prop);
|
||||
App::PropertyEnumeration* display = static_cast<App::PropertyEnumeration*>(prop);
|
||||
QString activeMode = QString::fromLatin1(display->getValueAsString());
|
||||
int index = ui->changeMode->findText(activeMode);
|
||||
if (index != -1) {
|
||||
ui->changeMode->setCurrentIndex(index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
int index = ui->changeMode->findText(activeMode);
|
||||
if (index != -1) {
|
||||
ui->changeMode->setCurrentIndex(index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TaskAppearance::setPointSize(const std::vector<Gui::ViewProvider*>& views)
|
||||
{
|
||||
bool pointSize = false;
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("PointSize");
|
||||
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 = ui->spinPointSize->blockSignals(true);
|
||||
ui->spinPointSize->setValue((int)static_cast<App::PropertyFloat*>(prop)->getValue());
|
||||
@@ -253,16 +254,16 @@ void TaskAppearance::setPointSize(const std::vector<Gui::ViewProvider*>& views)
|
||||
pointSize = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ui->spinPointSize->setEnabled(pointSize);
|
||||
}
|
||||
|
||||
ui->spinPointSize->setEnabled(pointSize);
|
||||
}
|
||||
|
||||
void TaskAppearance::setLineWidth(const std::vector<Gui::ViewProvider*>& views)
|
||||
{
|
||||
bool lineWidth = false;
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("LineWidth");
|
||||
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 = ui->spinLineWidth->blockSignals(true);
|
||||
ui->spinLineWidth->setValue((int)static_cast<App::PropertyFloat*>(prop)->getValue());
|
||||
@@ -270,16 +271,16 @@ void TaskAppearance::setLineWidth(const std::vector<Gui::ViewProvider*>& views)
|
||||
lineWidth = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ui->spinLineWidth->setEnabled(lineWidth);
|
||||
}
|
||||
|
||||
ui->spinLineWidth->setEnabled(lineWidth);
|
||||
}
|
||||
|
||||
void TaskAppearance::setTransparency(const std::vector<Gui::ViewProvider*>& views)
|
||||
{
|
||||
bool transparency = false;
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("Transparency");
|
||||
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 = ui->spinTransparency->blockSignals(true);
|
||||
ui->spinTransparency->setValue(static_cast<App::PropertyInteger*>(prop)->getValue());
|
||||
@@ -287,10 +288,10 @@ void TaskAppearance::setTransparency(const std::vector<Gui::ViewProvider*>& view
|
||||
transparency = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ui->spinTransparency->setEnabled(transparency);
|
||||
ui->horizontalSlider->setEnabled(transparency);
|
||||
}
|
||||
|
||||
ui->spinTransparency->setEnabled(transparency);
|
||||
ui->horizontalSlider->setEnabled(transparency);
|
||||
}
|
||||
|
||||
std::vector<Gui::ViewProvider*> TaskAppearance::getSelection() const
|
||||
|
||||
Reference in New Issue
Block a user