Skip to content

Commit

Permalink
strip unused headers, change from QWidget.setIcon to QAbsButn.setIcon
Browse files Browse the repository at this point in the history
QWidget->setIcon does not actually set the icon!

re #12324
  • Loading branch information
NickDraper committed Jun 30, 2015
1 parent ef4def8 commit d7cc671
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
Expand Up @@ -10,7 +10,6 @@
#include "MantidGeometry/MDGeometry/MDHistoDimension.h"
#include "MantidKernel/Logger.h"
#include "MantidKernel/VMD.h"
#include "MantidQtAPI/MantidColorMap.h"
#include "MantidQtAPI/MdSettings.h"
#include "MantidQtMantidWidgets/SafeQwtPlot.h"
#include "MantidQtAPI/SyncedCheckboxes.h"
Expand All @@ -19,16 +18,10 @@
#include "MantidQtSliceViewer/ZoomablePeaksView.h"
#include "MantidQtAPI/QwtRasterDataMD.h"
#include "ui_SliceViewer.h"
#include <QtCore/QtCore>
#include <QtGui/qdialog.h>
#include <QtGui/QWidget>
#include <qwt_color_map.h>
#include <qwt_plot_spectrogram.h>
#include <qwt_plot.h>
#include <qwt_raster_data.h>
#include <qwt_scale_widget.h>
#include <vector>
#include "MantidAPI/Algorithm.h"
#include "MantidQtAPI/AlgorithmRunner.h"
#include <boost/shared_ptr.hpp>

Expand Down Expand Up @@ -211,7 +204,7 @@ public slots:
void saveSettings();
void setIconFromString(QAction* action, const std::string& iconName,
QIcon::Mode mode, QIcon::State state);
void setIconFromString(QWidget* btn, const std::string& iconName,
void setIconFromString(QAbstractButton* btn, const std::string& iconName,
QIcon::Mode mode, QIcon::State state);
void initMenus();
void initZoomer();
Expand Down
15 changes: 5 additions & 10 deletions Code/Mantid/MantidQt/SliceViewer/src/SliceViewer.cpp
Expand Up @@ -14,7 +14,6 @@
#include "MantidGeometry/Crystal/PeakTransformQSample.h"
#include "MantidGeometry/Crystal/PeakTransformQLab.h"
#include "MantidAPI/IPeaksWorkspace.h"
#include "MantidAPI/IMDHistoWorkspace.h"
#include "MantidAPI/IMDEventWorkspace.h"
#include "MantidAPI/AlgorithmManager.h"
#include "MantidGeometry/MDGeometry/IMDDimension.h"
Expand All @@ -37,12 +36,10 @@
#include "MantidQtSliceViewer/ProxyCompositePeaksPresenter.h"
#include "MantidQtSliceViewer/PeakOverlayMultiCrossFactory.h"
#include "MantidQtSliceViewer/PeakOverlayMultiSphereFactory.h"
#include "MantidQtSliceViewer/FirstExperimentInfoQuery.h"
#include "MantidQtSliceViewer/PeakBoundingBox.h"
#include "MantidQtSliceViewer/PeaksViewerOverlayDialog.h"
#include "MantidQtSliceViewer/PeakOverlayViewFactorySelector.h"
#include "MantidQtMantidWidgets/SelectWorkspacesDialog.h"
#include "MantidQtMantidWidgets/InputController.h"

#include <qwt_plot_panner.h>
#include <Poco/AutoPtr.h>
Expand Down Expand Up @@ -238,12 +235,12 @@ void SliceViewer::saveSettings() {
* @param mode the mode of the icon
* @param state on or off state of the icon
*/
void SliceViewer::setIconFromString(QWidget* btn, const std::string& iconName,
void SliceViewer::setIconFromString(QAbstractButton* btn, const std::string& iconName,
QIcon::Mode mode = QIcon::Mode::Normal, QIcon::State state = QIcon::State::Off)
{
QIcon icon;
icon.addFile(QString::fromStdString(iconName), QSize(), mode,state);
btn->setIcon(icon.pixmap());
btn->setIcon(icon);
}
/** set an icon given the control and a string.
* @param action the menu action to give the new icon
Expand Down Expand Up @@ -303,9 +300,7 @@ void SliceViewer::initMenus() {
m_menuView = new QMenu("&View", this);
action = new QAction(QPixmap(), "&Reset Zoom", this);
connect(action, SIGNAL(triggered()), this, SLOT(resetZoom()));
{
setIconFromString(action,g_iconViewFull);
}
setIconFromString(action,g_iconViewFull);
m_menuView->addAction(action);

action = new QAction(QPixmap(), "&Set X/Y View Size", this);
Expand Down Expand Up @@ -941,7 +936,7 @@ void SliceViewer::LineMode_toggled(bool checked) {
m_lineOverlay->setShown(checked);

if (checked) {
setIconFromString(ui.btnDoLine,g_iconCutOn,QIcon::Mode::Normal,QIcon::State::On);
setIconFromString(ui.btnDoLine,g_iconCutOn,QIcon::Mode::Normal,QIcon::State::Off);
QString text;
if (m_lineOverlay->getCreationMode())
text = "Click and drag to draw an cut line.\n"
Expand All @@ -953,7 +948,7 @@ void SliceViewer::LineMode_toggled(bool checked) {
if (!checked) {
// clear the old line
clearLine();
setIconFromString(ui.btnDoLine,g_iconCut);
setIconFromString(ui.btnDoLine,g_iconCut,QIcon::Mode::Normal,QIcon::State::On);
}
emit showLineViewer(checked);
}
Expand Down

0 comments on commit d7cc671

Please sign in to comment.