From b814e27223b7fc1ba7e3c12501172a38174efc4e Mon Sep 17 00:00:00 2001 From: Geoff Hutchison Date: Mon, 26 Jul 2021 15:15:58 -0400 Subject: [PATCH 1/3] Save display settings for wireframe and enable line width Also fixes multi-bond .. scales the line width Signed-off-by: Geoff Hutchison --- avogadro/qtplugins/wireframe/wireframe.cpp | 67 +++++++++++++++------- avogadro/qtplugins/wireframe/wireframe.h | 15 +---- 2 files changed, 50 insertions(+), 32 deletions(-) diff --git a/avogadro/qtplugins/wireframe/wireframe.cpp b/avogadro/qtplugins/wireframe/wireframe.cpp index f34f81c284..ccac9715d9 100644 --- a/avogadro/qtplugins/wireframe/wireframe.cpp +++ b/avogadro/qtplugins/wireframe/wireframe.cpp @@ -1,17 +1,6 @@ /****************************************************************************** - This source file is part of the Avogadro project. - - Copyright 2014 Kitware, Inc. - - This source code is released under the New BSD License, (the "License"). - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - + This source code is released under the 3-Clause BSD License, (see "LICENSE"). ******************************************************************************/ #include "wireframe.h" @@ -22,27 +11,32 @@ #include #include +#include #include -#include #include #include +#include +#include #include #include namespace Avogadro { namespace QtPlugins { +using Core::Array; using Core::Elements; using Core::Molecule; -using Core::Array; using Rendering::GeometryNode; using Rendering::GroupNode; using Rendering::LineStripGeometry; Wireframe::Wireframe(QObject* p) - : ScenePlugin(p), m_enabled(false), m_group(nullptr), m_setupWidget(nullptr), - m_multiBonds(true), m_showHydrogens(true) -{ + : ScenePlugin(p), m_enabled(false), m_group(nullptr), m_setupWidget(nullptr) +{ + QSettings settings; + m_multiBonds = settings.value("wireframe/multiBonds", true).toBool(); + m_showHydrogens = settings.value("wireframe/showHydrogens", true).toBool(); + m_lineWidth = settings.value("wireframe/lineWidth", 1.0).toDouble(); } Wireframe::~Wireframe() @@ -53,7 +47,7 @@ Wireframe::~Wireframe() void Wireframe::process(const Molecule& molecule, Rendering::GroupNode& node) { - // Add a sphere node to contain all of the spheres. + // Add a node to contain all of the lines. m_group = &node; GeometryNode* geometry = new GeometryNode; node.addChild(geometry); @@ -78,7 +72,10 @@ void Wireframe::process(const Molecule& molecule, Rendering::GroupNode& node) points.push_back(pos2); colors.push_back(color1); colors.push_back(color2); - lines->addLineStrip(points, colors, 1.0f); + float lineWidth = m_lineWidth; + if (m_multiBonds) + lineWidth *= bond.order(); + lines->addLineStrip(points, colors, lineWidth); } } @@ -97,14 +94,30 @@ QWidget* Wireframe::setupWidget() if (!m_setupWidget) { m_setupWidget = new QWidget(qobject_cast(parent())); QVBoxLayout* v = new QVBoxLayout; + + // line width + QDoubleSpinBox* spin = new QDoubleSpinBox; + spin->setRange(0.5, 5.0); + spin->setSingleStep(0.25); + spin->setDecimals(2); + spin->setValue(m_lineWidth); + connect(spin, SIGNAL(valueChanged(double)), SLOT(setWidth(double))); + QFormLayout* form = new QFormLayout; + form->addRow(tr("Line width:"), spin); + v->addLayout(form); + + // options QCheckBox* check = new QCheckBox(tr("Show multiple bonds?")); check->setChecked(m_multiBonds); connect(check, SIGNAL(clicked(bool)), SLOT(multiBonds(bool))); v->addWidget(check); + check = new QCheckBox(tr("Show hydrogens?")); check->setChecked(m_showHydrogens); connect(check, SIGNAL(toggled(bool)), SLOT(showHydrogens(bool))); v->addWidget(check); + + v->addStretch(1); m_setupWidget->setLayout(v); } return m_setupWidget; @@ -116,6 +129,8 @@ void Wireframe::multiBonds(bool show) m_multiBonds = show; emit drawablesChanged(); } + QSettings settings; + settings.setValue("wireframe/multiBonds", show); } void Wireframe::showHydrogens(bool show) @@ -124,6 +139,18 @@ void Wireframe::showHydrogens(bool show) m_showHydrogens = show; emit drawablesChanged(); } + QSettings settings; + settings.setValue("wireframe/showHydrogens", show); } + +void Wireframe::setWidth(double width) +{ + m_lineWidth = float(width); + emit drawablesChanged(); + + QSettings settings; + settings.setValue("wireframe/lineWidth", m_lineWidth); } -} + +} // namespace QtPlugins +} // namespace Avogadro diff --git a/avogadro/qtplugins/wireframe/wireframe.h b/avogadro/qtplugins/wireframe/wireframe.h index 547fc0993b..9c3d553ccd 100644 --- a/avogadro/qtplugins/wireframe/wireframe.h +++ b/avogadro/qtplugins/wireframe/wireframe.h @@ -1,17 +1,6 @@ /****************************************************************************** - This source file is part of the Avogadro project. - - Copyright 2012 Kitware, Inc. - - This source code is released under the New BSD License, (the "License"). - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - + This source code is released under the 3-Clause BSD License, (see "LICENSE"). ******************************************************************************/ #ifndef AVOGADRO_QTPLUGINS_WIREFRAME_H @@ -52,6 +41,7 @@ class Wireframe : public QtGui::ScenePlugin private slots: void multiBonds(bool show); void showHydrogens(bool show); + void setWidth(double width); private: bool m_enabled; @@ -61,6 +51,7 @@ private slots: QWidget* m_setupWidget; bool m_multiBonds; bool m_showHydrogens; + float m_lineWidth; }; } // end namespace QtPlugins From a2342a365dd548dbe0664c2f537e81cfa1155872 Mon Sep 17 00:00:00 2001 From: Geoff Hutchison Date: Mon, 26 Jul 2021 19:25:12 -0400 Subject: [PATCH 2/3] Add color and line width settings Signed-off-by: Geoff Hutchison --- avogadro/qtgui/CMakeLists.txt | 2 + avogadro/qtgui/colorbutton.cpp | 90 +++++++++++++++++++++ avogadro/qtgui/colorbutton.h | 86 ++++++++++++++++++++ avogadro/qtplugins/crystal/crystalscene.cpp | 89 +++++++++++++++----- avogadro/qtplugins/crystal/crystalscene.h | 25 +++--- 5 files changed, 261 insertions(+), 31 deletions(-) create mode 100644 avogadro/qtgui/colorbutton.cpp create mode 100644 avogadro/qtgui/colorbutton.h diff --git a/avogadro/qtgui/CMakeLists.txt b/avogadro/qtgui/CMakeLists.txt index 6f3d2e8b61..88b98af8a6 100644 --- a/avogadro/qtgui/CMakeLists.txt +++ b/avogadro/qtgui/CMakeLists.txt @@ -32,6 +32,7 @@ configure_file("${CMAKE_CURRENT_BINARY_DIR}/avogadropython.h.in" set(HEADERS backgroundfileformat.h + colorbutton.h containerwidget.h customelementdialog.h elementtranslator.h @@ -62,6 +63,7 @@ set(HEADERS set(SOURCES backgroundfileformat.cpp + colorbutton.cpp containerwidget.cpp customelementdialog.cpp elementdetail_p.cpp diff --git a/avogadro/qtgui/colorbutton.cpp b/avogadro/qtgui/colorbutton.cpp new file mode 100644 index 0000000000..9d14abc006 --- /dev/null +++ b/avogadro/qtgui/colorbutton.cpp @@ -0,0 +1,90 @@ +/****************************************************************************** + This source file is part of the Avogadro project. + This source code is released under the 3-Clause BSD License, (see "LICENSE"). +******************************************************************************/ + +// Adapted from Avogadro 1.0 by Geoffrey Hutchison +// Contributed to Avogadro 2.0 by Geoffrey Hutchison + +#include "colorbutton.h" + +#include +#include + +namespace Avogadro { +namespace QtGui { + +ColorButton::ColorButton(QWidget* parent) + : QAbstractButton(parent), m_color(Qt::white), m_title("") +{ + setMinimumSize(35, 20); + + connect(this, SIGNAL(clicked()), this, SLOT(changeColor())); +} + +ColorButton::ColorButton(const QColor& initial, QWidget* parent) + : QAbstractButton(parent), m_color(initial) +{ + setMinimumSize(35, 20); + + connect(this, SIGNAL(clicked()), this, SLOT(changeColor())); +} + +void ColorButton::changeColor() +{ + // This could be an ifdef for KColorDialog if KDE is present + if (m_title == "") + m_color = QColorDialog::getColor(m_color, this); + else + m_color = QColorDialog::getColor(m_color, this, m_title); + update(); + + emit colorChanged(m_color); +} + +void ColorButton::setColor(const QColor& color) +{ + m_color = color; + update(); + + emit colorChanged(m_color); +} + +void ColorButton::setDialogTitle(const QString title) +{ + m_title = title; +} + +QColor ColorButton::color() const +{ + return m_color; +} + +void ColorButton::paintEvent(QPaintEvent*) +{ + // TODO: If we go to RGBA colors, we should really show two pieces + // e.g. ----------- + // | /| + // | non / | + // | alpha/ | + // | / | + // | /alpha + // | / | + // ----------- + + QPainter painter(this); + + // outer border + painter.drawRect(0, 0, width(), height()); + // inner color + painter.setBrush(m_color); + painter.drawRect(4, 4, width() - 8, height() - 8); +} + +bool ColorButton::event(QEvent* e) +{ + return QAbstractButton::event(e); +} + +} // namespace QtGui +} // namespace Avogadro \ No newline at end of file diff --git a/avogadro/qtgui/colorbutton.h b/avogadro/qtgui/colorbutton.h new file mode 100644 index 0000000000..ef4ed10015 --- /dev/null +++ b/avogadro/qtgui/colorbutton.h @@ -0,0 +1,86 @@ +/****************************************************************************** + This source file is part of the Avogadro project. + This source code is released under the 3-Clause BSD License, (see "LICENSE"). +******************************************************************************/ + +// Adapted from Avogadro 1.0 by Geoffrey Hutchison +// Contributed to Avogadro 2.0 by Geoffrey Hutchison + +#ifndef AVOGADRO_QTGUI_COLORBUTTON_H +#define AVOGADRO_QTGUI_COLORBUTTON_H + +#include "avogadroqtguiexport.h" + +#include +#include + +namespace Avogadro { +namespace QtGui { + +/** + * @class ColorButton colorbutton.h + * @author Geoffrey Hutchison + * @brief A button to show the current color and bring up the QColorDialog. + * + * This class implements a QAbstractButton to display a colored rectangle. + * When clicked by the user, it brings up a color picker to select a new + * color. + * + * The widget has a default minimium size of 35x20 pixels. + */ + +class AVOGADROQTGUI_EXPORT ColorButton : public QAbstractButton +{ + Q_OBJECT + +public: + ColorButton(QWidget* parent = 0); + explicit ColorButton(const QColor& initial, QWidget* parent = 0); + + /** + * Redraw the widget (i.e., refresh the colored rectange) + */ + void paintEvent(QPaintEvent*); + + /** + * @param color the new color to be used + */ + void setColor(const QColor& color); + + /** + * @param custom title for color choice dialog + */ + void setDialogTitle(const QString title = ""); + + /** + * @return the current color + */ + QColor color() const; + +Q_SIGNALS: + /** + * emit any time the color is changed, either by a user or by setColor() + */ + void colorChanged(const QColor &); + +public Q_SLOTS: + /** + * Call for a change in the current color + */ + void changeColor(); + +protected: + /** + * Generic event handler, currently defaults to calling parent class + * (included for future compatibility) + */ + bool event(QEvent* e); + + QColor m_color; //!< The current color + QString m_title; //!< The current dialog title +}; + +} // namespace QtGui +} // namespace Avogadro + +#endif diff --git a/avogadro/qtplugins/crystal/crystalscene.cpp b/avogadro/qtplugins/crystal/crystalscene.cpp index 1f7a8695d0..20e920f128 100644 --- a/avogadro/qtplugins/crystal/crystalscene.cpp +++ b/avogadro/qtplugins/crystal/crystalscene.cpp @@ -1,17 +1,6 @@ /****************************************************************************** - This source file is part of the Avogadro project. - - Copyright 2013 Kitware, Inc. - - This source code is released under the New BSD License, (the "License"). - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - + This source code is released under the 3-Clause BSD License, (see "LICENSE"). ******************************************************************************/ #include "crystalscene.h" @@ -19,10 +8,16 @@ #include #include #include +#include #include #include #include +#include +#include +#include +#include + namespace Avogadro { namespace QtPlugins { @@ -33,13 +28,19 @@ using Rendering::GeometryNode; using Rendering::GroupNode; using Rendering::LineStripGeometry; -CrystalScene::CrystalScene(QObject* p) : ScenePlugin(p), m_enabled(true) +CrystalScene::CrystalScene(QObject* p) : ScenePlugin(p), m_enabled(true), m_setupWidget(nullptr) { + QSettings settings; + m_lineWidth = settings.value("crystal/lineWidth", 2.0).toDouble(); + + QColor color = + settings.value("crystal/color", QColor(Qt::white)).value(); + m_color[0] = static_cast(color.red()); + m_color[1] = static_cast(color.green()); + m_color[2] = static_cast(color.blue()); } -CrystalScene::~CrystalScene() -{ -} +CrystalScene::~CrystalScene() {} void CrystalScene::process(const Molecule& molecule, GroupNode& node) { @@ -49,9 +50,8 @@ void CrystalScene::process(const Molecule& molecule, GroupNode& node) LineStripGeometry* lines = new LineStripGeometry; geometry->addDrawable(lines); - lines->setColor(Vector3ub(255, 255, 255)); - - float width = 2.0; + lines->setColor(m_color); + float width = m_lineWidth; Vector3f a = cell->aVector().cast(); Vector3f b = cell->bVector().cast(); @@ -102,5 +102,56 @@ void CrystalScene::setEnabled(bool enable) { m_enabled = enable; } + +void CrystalScene::setLineWidth(double width) +{ + m_lineWidth = width; + emit drawablesChanged(); + + QSettings settings; + settings.setValue("crystal/lineWidth", width); +} + +void CrystalScene::setColor(const QColor& color) +{ + m_color[0] = static_cast(color.red()); + m_color[1] = static_cast(color.green()); + m_color[2] = static_cast(color.blue()); + + emit drawablesChanged(); + + QSettings settings; + settings.setValue("crystal/color", color); } + +QWidget* CrystalScene::setupWidget() +{ + if (!m_setupWidget) { + m_setupWidget = new QWidget(qobject_cast(parent())); + QVBoxLayout* v = new QVBoxLayout; + + // line width + QDoubleSpinBox* spin = new QDoubleSpinBox; + spin->setRange(0.5, 5.0); + spin->setSingleStep(0.25); + spin->setDecimals(2); + spin->setValue(m_lineWidth); + connect(spin, SIGNAL(valueChanged(double)), SLOT(setLineWidth(double))); + QFormLayout* form = new QFormLayout; + form->addRow(tr("Line width:"), spin); + + QtGui::ColorButton* color = new QtGui::ColorButton; + connect(color, SIGNAL(colorChanged(const QColor&)), + SLOT(setColor(const QColor&))); + form->addRow(tr("Line color:"), color); + + v->addLayout(form); + + v->addStretch(1); + m_setupWidget->setLayout(v); + } + return m_setupWidget; } + +} // namespace QtPlugins +} // namespace Avogadro diff --git a/avogadro/qtplugins/crystal/crystalscene.h b/avogadro/qtplugins/crystal/crystalscene.h index 3f4e6f4b85..81d82c4121 100644 --- a/avogadro/qtplugins/crystal/crystalscene.h +++ b/avogadro/qtplugins/crystal/crystalscene.h @@ -1,24 +1,15 @@ /****************************************************************************** - This source file is part of the Avogadro project. - - Copyright 2013 Kitware, Inc. - - This source code is released under the New BSD License, (the "License"). - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - + This source code is released under the 3-Clause BSD License, (see "LICENSE"). ******************************************************************************/ #ifndef AVOGADRO_QTPLUGINS_CRYSTALSCENE_H #define AVOGADRO_QTPLUGINS_CRYSTALSCENE_H +#include #include +#include namespace Avogadro { namespace QtPlugins { @@ -47,8 +38,18 @@ class CrystalScene : public QtGui::ScenePlugin void setEnabled(bool enable) override; + QWidget* setupWidget() override; + +private slots: + void setColor(const QColor &color); + void setLineWidth(double width); + private: bool m_enabled; + + QWidget* m_setupWidget; + float m_lineWidth; + Vector3ub m_color; }; } // end namespace QtPlugins From dc6c9325fbd62fcd44315061351489d4e1e5a4ec Mon Sep 17 00:00:00 2001 From: Geoff Hutchison Date: Mon, 26 Jul 2021 19:46:34 -0400 Subject: [PATCH 3/3] Update ball-and-stick and cartoon options Signed-off-by: Geoff Hutchison --- .../qtplugins/ballandstick/ballandstick.cpp | 26 ++++++++---- avogadro/qtplugins/cartoons/cartoons.cpp | 41 +++++++++++++++---- avogadro/qtplugins/wireframe/wireframe.cpp | 4 +- 3 files changed, 54 insertions(+), 17 deletions(-) diff --git a/avogadro/qtplugins/ballandstick/ballandstick.cpp b/avogadro/qtplugins/ballandstick/ballandstick.cpp index 4250293eb8..5133436155 100644 --- a/avogadro/qtplugins/ballandstick/ballandstick.cpp +++ b/avogadro/qtplugins/ballandstick/ballandstick.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -36,15 +37,17 @@ namespace QtPlugins { using Core::Elements; using Core::Molecule; +using Rendering::CylinderGeometry; using Rendering::GeometryNode; using Rendering::GroupNode; using Rendering::SphereGeometry; -using Rendering::CylinderGeometry; BallAndStick::BallAndStick(QObject* p) - : ScenePlugin(p), m_enabled(true), m_group(nullptr), m_setupWidget(nullptr), - m_multiBonds(true), m_showHydrogens(true) + : ScenePlugin(p), m_enabled(true), m_group(nullptr), m_setupWidget(nullptr) { + QSettings settings; + m_multiBonds = settings.value("ballandstick/multiBonds", true).toBool(); + m_showHydrogens = settings.value("ballandstick/showHydrogens", true).toBool(); } BallAndStick::~BallAndStick() @@ -204,14 +207,18 @@ QWidget* BallAndStick::setupWidget() if (!m_setupWidget) { m_setupWidget = new QWidget(qobject_cast(parent())); QVBoxLayout* v = new QVBoxLayout; - QCheckBox* check = new QCheckBox(tr("Show multiple bonds?")); + + QCheckBox* check = new QCheckBox(tr("Show multiple bonds")); check->setChecked(m_multiBonds); connect(check, SIGNAL(clicked(bool)), SLOT(multiBonds(bool))); v->addWidget(check); - check = new QCheckBox(tr("Show hydrogens?")); + + check = new QCheckBox(tr("Show hydrogens")); check->setChecked(m_showHydrogens); connect(check, SIGNAL(toggled(bool)), SLOT(showHydrogens(bool))); v->addWidget(check); + + v->addStretch(1); m_setupWidget->setLayout(v); } return m_setupWidget; @@ -223,6 +230,8 @@ void BallAndStick::multiBonds(bool show) m_multiBonds = show; emit drawablesChanged(); } + QSettings settings; + settings.setValue("BallAndStick/multiBonds", show); } void BallAndStick::showHydrogens(bool show) @@ -231,6 +240,9 @@ void BallAndStick::showHydrogens(bool show) m_showHydrogens = show; emit drawablesChanged(); } + QSettings settings; + settings.setValue("BallAndStick/showHydrogens", show); } -} -} + +} // namespace QtPlugins +} // namespace Avogadro diff --git a/avogadro/qtplugins/cartoons/cartoons.cpp b/avogadro/qtplugins/cartoons/cartoons.cpp index 0a2bf05786..b9023434fa 100644 --- a/avogadro/qtplugins/cartoons/cartoons.cpp +++ b/avogadro/qtplugins/cartoons/cartoons.cpp @@ -5,6 +5,7 @@ #include "cartoons.h" +#include #include #include #include @@ -31,8 +32,8 @@ using Core::Atom; using Core::AtomicNumber; using Core::Elements; using Core::Molecule; -using Rendering::BezierGeometry; using Rendering::BSplineGeometry; +using Rendering::BezierGeometry; using Rendering::Cartoon; using Rendering::CylinderGeometry; using Rendering::GeometryNode; @@ -61,10 +62,16 @@ typedef list AtomsPairList; Cartoons::Cartoons(QObject* parent) : ScenePlugin(parent), m_group(nullptr), m_setupWidget(nullptr), - m_enabled(true), m_showBackbone(true), m_showTrace(false), - m_showTube(false), m_showRibbon(false), m_showRope(false), - m_showCartoon(true) -{} + m_enabled(true) +{ + QSettings settings; + m_showBackbone = settings.value("cartoon/backbone", true).toBool(); + m_showCartoon = settings.value("cartoon/cartoon", true).toBool(); + m_showTrace = settings.value("cartoon/trace", false).toBool(); + m_showTube = settings.value("cartoon/tube", false).toBool(); + m_showRibbon = settings.value("cartoon/ribbon", false).toBool(); + m_showRope = settings.value("cartoon/rope", false).toBool(); +} Cartoons::~Cartoons() { @@ -299,8 +306,12 @@ QWidget* Cartoons::setupWidget() m_setupWidget = new QWidget(qobject_cast(parent())); QVBoxLayout* v = new QVBoxLayout; QStringList boxesText; - boxesText << tr("Backbone") << tr("Trace") << tr("Tube") << tr("Ribbon") - << tr("Cartoon") << tr("Rope"); + boxesText << tr("Backbone", "protein rendering style") + << tr("Trace", "protein rendering style") + << tr("Tube", "protein rendering style") + << tr("Ribbon", "protein rendering style") + << tr("Cartoon", "protein rendering style") + << tr("Rope", "protein rendering style"); vector> boxesBools = { m_showBackbone, m_showTrace, m_showTube, m_showRibbon, m_showCartoon, m_showRope }; @@ -310,13 +321,15 @@ QWidget* Cartoons::setupWidget() m_jumpTable[3] = &Cartoons::showRibbon; m_jumpTable[4] = &Cartoons::showCartoon; m_jumpTable[5] = &Cartoons::showRope; - for (size_t i = 0; i < 6; ++i) { + for (size_t i = 0; i < boxesText.size(); ++i) { QCheckBox* check = new QCheckBox(boxesText[i]); check->setChecked(boxesBools[i]); connect(check, &QCheckBox::clicked, this, m_jumpTable[i]); v->addWidget(check); } + // make sure there's empty space at the bottom,s otherwise the + v->addStretch(1); m_setupWidget->setLayout(v); } return m_setupWidget; @@ -328,6 +341,8 @@ void Cartoons::showBackbone(bool show) m_showBackbone = show; emit drawablesChanged(); } + QSettings settings; + settings.setValue("cartoon/backbone", show); } void Cartoons::showTrace(bool show) @@ -336,6 +351,8 @@ void Cartoons::showTrace(bool show) m_showTrace = show; emit drawablesChanged(); } + QSettings settings; + settings.setValue("cartoon/trace", show); } void Cartoons::showTube(bool show) @@ -344,6 +361,8 @@ void Cartoons::showTube(bool show) m_showTube = show; emit drawablesChanged(); } + QSettings settings; + settings.setValue("cartoon/tube", show); } void Cartoons::showRibbon(bool show) @@ -352,6 +371,8 @@ void Cartoons::showRibbon(bool show) m_showRibbon = show; emit drawablesChanged(); } + QSettings settings; + settings.setValue("cartoon/ribbon", show); } void Cartoons::showCartoon(bool show) @@ -360,6 +381,8 @@ void Cartoons::showCartoon(bool show) m_showCartoon = show; emit drawablesChanged(); } + QSettings settings; + settings.setValue("cartoon/cartoon", show); } void Cartoons::showRope(bool show) @@ -368,6 +391,8 @@ void Cartoons::showRope(bool show) m_showRope = show; emit drawablesChanged(); } + QSettings settings; + settings.setValue("cartoon/rope", show); } } // namespace QtPlugins diff --git a/avogadro/qtplugins/wireframe/wireframe.cpp b/avogadro/qtplugins/wireframe/wireframe.cpp index ccac9715d9..503a692d7a 100644 --- a/avogadro/qtplugins/wireframe/wireframe.cpp +++ b/avogadro/qtplugins/wireframe/wireframe.cpp @@ -107,12 +107,12 @@ QWidget* Wireframe::setupWidget() v->addLayout(form); // options - QCheckBox* check = new QCheckBox(tr("Show multiple bonds?")); + QCheckBox* check = new QCheckBox(tr("Show multiple bonds")); check->setChecked(m_multiBonds); connect(check, SIGNAL(clicked(bool)), SLOT(multiBonds(bool))); v->addWidget(check); - check = new QCheckBox(tr("Show hydrogens?")); + check = new QCheckBox(tr("Show hydrogens")); check->setChecked(m_showHydrogens); connect(check, SIGNAL(toggled(bool)), SLOT(showHydrogens(bool))); v->addWidget(check);