From a0892a9c5637d843b72decf0ece8a01209ae5cb6 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 15 Mar 2015 20:02:21 +0100 Subject: [PATCH] + show message when changing anti-aliasing --- src/Gui/DlgSettings3DViewImp.cpp | 25 +++++++++++++++++++++++-- src/Gui/DlgSettings3DViewImp.h | 4 ++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/Gui/DlgSettings3DViewImp.cpp b/src/Gui/DlgSettings3DViewImp.cpp index e20794ca5..8e0cb6446 100644 --- a/src/Gui/DlgSettings3DViewImp.cpp +++ b/src/Gui/DlgSettings3DViewImp.cpp @@ -25,6 +25,7 @@ #ifndef _PreComp_ # include +# include # include #endif @@ -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' @@ -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() @@ -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); @@ -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" diff --git a/src/Gui/DlgSettings3DViewImp.h b/src/Gui/DlgSettings3DViewImp.h index 4c4494728..a49f21864 100644 --- a/src/Gui/DlgSettings3DViewImp.h +++ b/src/Gui/DlgSettings3DViewImp.h @@ -48,10 +48,14 @@ public: private Q_SLOTS: void on_mouseButton_clicked(); + void onAliasingChanged(int); protected: void changeEvent(QEvent *e); void retranslate(); + +private: + static bool showMsg; }; } // namespace Dialog