Skip to content

Commit

Permalink
+ show message when changing anti-aliasing
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Mar 15, 2015
1 parent e0dab75 commit a0892a9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/Gui/DlgSettings3DViewImp.cpp
Expand Up @@ -25,6 +25,7 @@

#ifndef _PreComp_
# include <QRegExp>
# include <QMessageBox>
# include <memory>
#endif

Expand All @@ -42,6 +43,8 @@ using namespace Gui::Dialog;

/* TRANSLATOR Gui::Dialog::DlgSettings3DViewImp */

bool DlgSettings3DViewImp::showMsg = true;

/**
* Constructs a DlgSettings3DViewImp which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
Expand Down Expand Up @@ -118,6 +121,9 @@ void DlgSettings3DViewImp::loadSettings()
index = hGrp->GetInt("AntiAliasing", int(Gui::View3DInventorViewer::None));
index = Base::clamp(index, 0, comboAliasing->count()-1);
comboAliasing->setCurrentIndex(index);
// connect after setting current item of the combo box
connect(comboAliasing, SIGNAL(currentIndexChanged(int)),
this, SLOT(onAliasingChanged(int)));
}

void DlgSettings3DViewImp::on_mouseButton_clicked()
Expand Down Expand Up @@ -154,12 +160,12 @@ void DlgSettings3DViewImp::changeEvent(QEvent *e)
if (e->type() == QEvent::LanguageChange) {
int navigation = comboNavigationStyle->currentIndex();
int orbit = comboOrbitStyle->currentIndex();
int aliasing = comboAliasing->currentIndex();
int aliasing = comboAliasing->currentIndex();
retranslateUi(this);
retranslate();
comboNavigationStyle->setCurrentIndex(navigation);
comboOrbitStyle->setCurrentIndex(orbit);
comboAliasing->setCurrentIndex(aliasing);
comboAliasing->setCurrentIndex(aliasing);
}
else {
QWidget::changeEvent(e);
Expand All @@ -185,5 +191,20 @@ void DlgSettings3DViewImp::retranslate()
}
}

void DlgSettings3DViewImp::onAliasingChanged(int index)
{
if (index < 0 || !isVisible())
return;
// When user actively changes the setting the widget has the focus
bool active = comboAliasing->hasFocus();
// Show this message only once per application session to reduce
// annoyance when showing it too often.
if (active && showMsg) {
showMsg = false;
QMessageBox::information(this, tr("Anti-aliasing"),
tr("Changing anti-aliasing only takes effect when creating a new viewer."));
}
}

#include "moc_DlgSettings3DViewImp.cpp"

4 changes: 4 additions & 0 deletions src/Gui/DlgSettings3DViewImp.h
Expand Up @@ -48,10 +48,14 @@ class DlgSettings3DViewImp : public PreferencePage, public Ui_DlgSettings3DView

private Q_SLOTS:
void on_mouseButton_clicked();
void onAliasingChanged(int);

protected:
void changeEvent(QEvent *e);
void retranslate();

private:
static bool showMsg;
};

} // namespace Dialog
Expand Down

0 comments on commit a0892a9

Please sign in to comment.