Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #11717 Provide pop up for cmap editor
- Loading branch information
1 parent
0ce2394
commit ca4d3da
Showing
7 changed files
with
215 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...ates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/ColorMapEditorPanel.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#ifndef COLORMAPEDITORPANEL_H | ||
#define COLORMAPEDITORPANEL_H | ||
|
||
#include "ui_ColorMapEditorPanel.h" | ||
#include "MantidVatesSimpleGuiViewWidgets/WidgetDllOption.h" | ||
#include <QWidget> | ||
#include <QDialog> | ||
|
||
namespace Mantid { | ||
namespace Vates { | ||
namespace SimpleGui { | ||
/** | ||
* | ||
This class handles the color map editor. | ||
@date 11/05/2015 | ||
Copyright © 2011 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge | ||
National Laboratory & European Spallation Source | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
File change history is stored at: <https://github.com/mantidproject/mantid> | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
class EXPORT_OPT_MANTIDVATES_SIMPLEGUI_VIEWWIDGETS ColorMapEditorPanel | ||
: public QDialog { | ||
Q_OBJECT | ||
public: | ||
/// Default constructor. | ||
ColorMapEditorPanel(QWidget *parent = 0); | ||
/// Default destructor. | ||
~ColorMapEditorPanel(); | ||
/// Connect the panel to ParaView | ||
void setUpPanel(); | ||
/// Filter events to check for show events. | ||
bool eventFilter(QObject *obj, QEvent *ev); | ||
|
||
signals: | ||
void showPopUpWindow(); | ||
void hidePopUpWindow(); | ||
|
||
public slots: | ||
// Show the window pop up | ||
void onShowPopUpWindow(); | ||
// Hide the pop up window | ||
void onHidePopUpWindow(); | ||
|
||
private: | ||
Ui::ColorMapEditorPanel ui; ///< The dialog's UI form | ||
}; | ||
} | ||
} | ||
} | ||
|
||
#endif // COLORMAPEDITORPANEL_H |
60 changes: 60 additions & 0 deletions
60
...tes/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/ColorMapEditorPanel.ui
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>ColorMapEditorPanel</class> | ||
<widget class="QWidget" name="ColorMapEditorPanel"> | ||
<property name="enabled"> | ||
<bool>true</bool> | ||
</property> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>600</height> | ||
</rect> | ||
</property> | ||
<property name="minimumSize"> | ||
<size> | ||
<width>0</width> | ||
<height>0</height> | ||
</size> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0"> | ||
<property name="spacing"> | ||
<number>0</number> | ||
</property> | ||
<property name="leftMargin"> | ||
<number>1</number> | ||
</property> | ||
<property name="topMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="rightMargin"> | ||
<number>1</number> | ||
</property> | ||
<property name="bottomMargin"> | ||
<number>0</number> | ||
</property> | ||
<item> | ||
<widget class="QDockWidget" name="dockWidget"> | ||
<widget class="pqColorMapEditor" name="ColorMapEditor"/> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<customwidgets> | ||
<customwidget> | ||
<class>pqColorMapEditor</class> | ||
<extends>QWidget</extends> | ||
<header>pqColorMapEditor.h</header> | ||
<container>1</container> | ||
</customwidget> | ||
</customwidgets> | ||
<resources> | ||
<include location="../../icons/ViewWidgetsIcons.qrc"/> | ||
</resources> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/ColorMapEditorPanel.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#include "MantidVatesSimpleGuiViewWidgets/ColorMapEditorPanel.h" | ||
#include <pqApplicationCore.h> | ||
#include <QWidget> | ||
#include <QDialog> | ||
|
||
namespace Mantid { | ||
namespace Vates { | ||
namespace SimpleGui { | ||
|
||
ColorMapEditorPanel::ColorMapEditorPanel(QWidget *parent) : QDialog(parent) {} | ||
|
||
ColorMapEditorPanel::~ColorMapEditorPanel() {} | ||
/** | ||
* Set up the connections for the pop up window | ||
*/ | ||
void ColorMapEditorPanel::setUpPanel() { | ||
this->ui.setupUi(this); | ||
this->hide(); | ||
this->ui.dockWidget->installEventFilter(this); | ||
pqApplicationCore::instance()->registerManager("COLOR_EDITOR_PANEL", | ||
this->ui.dockWidget); | ||
|
||
QObject::connect(this, SIGNAL(showPopUpWindow()), this, | ||
SLOT(onShowPopUpWindow()), Qt::QueuedConnection); | ||
|
||
QObject::connect(this, SIGNAL(hidePopUpWindow()), this, | ||
SLOT(onHidePopUpWindow()), Qt::QueuedConnection); | ||
} | ||
|
||
/** | ||
* Show the pop up window | ||
*/ | ||
void ColorMapEditorPanel::onShowPopUpWindow() { | ||
this->show(); | ||
this->raise(); | ||
|
||
this->ui.dockWidget->show(); | ||
this->ui.dockWidget->raise(); | ||
} | ||
|
||
/** | ||
* Hide the pop up window | ||
*/ | ||
void ColorMapEditorPanel::onHidePopUpWindow() { | ||
this->hide(); | ||
this->ui.dockWidget->hide(); | ||
} | ||
|
||
/** | ||
* This function listens to visibility changes of the ColorMapEditor widget | ||
* and acts on them | ||
* @param obj the subject of the event | ||
* @param ev the actual event | ||
* @return true if the event was handled | ||
*/ | ||
bool ColorMapEditorPanel::eventFilter(QObject *obj, QEvent *ev) { | ||
if (this->ui.dockWidget == obj && ev->type() == QEvent::ShowToParent) { | ||
emit showPopUpWindow(); | ||
return true; | ||
} else if (this->ui.dockWidget == obj && ev->type() == QEvent::Hide) { | ||
// Note that we actively need to hide the dockWidget, or else | ||
// it will not be set visible the next time! | ||
emit hidePopUpWindow(); | ||
return true; | ||
} | ||
return QDialog::eventFilter(obj, ev); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters