Commit cec68b85 authored by David Thompson's avatar David Thompson Committed by Kitware Robot

Merge topic 'global-shortcuts'

cc491637 Changes required in SMTK to match ParaView update.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: T.J. Corona's avatarT.J. Corona <tj.corona@kitware.com>
Merge-request: !2254
parents c34bb5b7 cc491637
+ A change in ParaView's pqPointPickingHelper has removed the
setShortcutEnabled method. If you were previously connecting
this method to a pqInteractivePropertyWidget subclass (like
the cone widget in SMTK), replace that signal connection
with an instantiation of pqPointPickingVisibilityHelper.
See `smtk/extension/paraview/widgets/plugin/pqConePropertyWidget.cxx`
for an example of its usage.
set(headers
pqSMTKAttributeItemWidgetP.h)
pqPointPickingVisibilityHelper.h
pqSMTKAttributeItemWidgetP.h
)
set(classes
Registrar
......
......@@ -9,6 +9,7 @@
//=========================================================================
#include "smtk/extension/paraview/widgets/plugin/pqConePropertyWidget.h"
#include "smtk/extension/paraview/widgets/plugin/ui_pqConePropertyWidget.h"
#include "smtk/extension/paraview/widgets/pqPointPickingVisibilityHelper.h"
#include "pqCoreUtilities.h"
#include "pqPointPickingHelper.h"
......@@ -123,42 +124,42 @@ pqConePropertyWidget::pqConePropertyWidget(
pqPointPickingHelper* pickHelper = new pqPointPickingHelper(QKeySequence(tr("P")), false, this);
pickHelper->connect(this, SIGNAL(viewChanged(pqView*)), SLOT(setView(pqView*)));
pickHelper->connect(this, SIGNAL(widgetVisibilityUpdated(bool)), SLOT(setShortcutEnabled(bool)));
this->connect(
pickHelper, SIGNAL(pick(double, double, double)), SLOT(pick(double, double, double)));
pqPointPickingVisibilityHelper<pqPointPickingHelper>{ *this, *pickHelper };
pqPointPickingHelper* pickHelper2 =
new pqPointPickingHelper(QKeySequence(tr("Ctrl+P")), true, this);
pickHelper2->connect(this, SIGNAL(viewChanged(pqView*)), SLOT(setView(pqView*)));
pickHelper2->connect(this, SIGNAL(widgetVisibilityUpdated(bool)), SLOT(setShortcutEnabled(bool)));
this->connect(
pickHelper2, SIGNAL(pick(double, double, double)), SLOT(pick(double, double, double)));
pqPointPickingVisibilityHelper<pqPointPickingHelper>{ *this, *pickHelper2 };
pqPointPickingHelper* pickHelper3 = new pqPointPickingHelper(QKeySequence(tr("1")), false, this);
pickHelper3->connect(this, SIGNAL(viewChanged(pqView*)), SLOT(setView(pqView*)));
pickHelper3->connect(this, SIGNAL(widgetVisibilityUpdated(bool)), SLOT(setShortcutEnabled(bool)));
this->connect(
pickHelper3, SIGNAL(pick(double, double, double)), SLOT(pickPoint1(double, double, double)));
pqPointPickingVisibilityHelper<pqPointPickingHelper>{ *this, *pickHelper3 };
pqPointPickingHelper* pickHelper4 =
new pqPointPickingHelper(QKeySequence(tr("Ctrl+1")), true, this);
pickHelper4->connect(this, SIGNAL(viewChanged(pqView*)), SLOT(setView(pqView*)));
pickHelper4->connect(this, SIGNAL(widgetVisibilityUpdated(bool)), SLOT(setShortcutEnabled(bool)));
this->connect(
pickHelper4, SIGNAL(pick(double, double, double)), SLOT(pickPoint1(double, double, double)));
pqPointPickingVisibilityHelper<pqPointPickingHelper>{ *this, *pickHelper4 };
pqPointPickingHelper* pickHelper5 = new pqPointPickingHelper(QKeySequence(tr("2")), false, this);
pickHelper5->connect(this, SIGNAL(viewChanged(pqView*)), SLOT(setView(pqView*)));
pickHelper5->connect(this, SIGNAL(widgetVisibilityUpdated(bool)), SLOT(setShortcutEnabled(bool)));
this->connect(
pickHelper5, SIGNAL(pick(double, double, double)), SLOT(pickPoint2(double, double, double)));
pqPointPickingVisibilityHelper<pqPointPickingHelper>{ *this, *pickHelper5 };
pqPointPickingHelper* pickHelper6 =
new pqPointPickingHelper(QKeySequence(tr("Ctrl+2")), true, this);
pickHelper6->connect(this, SIGNAL(viewChanged(pqView*)), SLOT(setView(pqView*)));
pickHelper6->connect(this, SIGNAL(widgetVisibilityUpdated(bool)), SLOT(setShortcutEnabled(bool)));
this->connect(
pickHelper6, SIGNAL(pick(double, double, double)), SLOT(pickPoint2(double, double, double)));
pqPointPickingVisibilityHelper<pqPointPickingHelper>{ *this, *pickHelper6 };
pqCoreUtilities::connect(
this->widgetProxy(), vtkCommand::PropertyModifiedEvent, this, SLOT(updateInformationLabels()));
......
......@@ -43,6 +43,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqPointPropertyWidget.h"
#include "ui_pqPointPropertyWidget.h"
#include "smtk/extension/paraview/widgets/pqPointPickingVisibilityHelper.h"
#include "pqActiveObjects.h"
#include "pqPointPickingHelper.h"
......@@ -143,10 +145,9 @@ void pqPointPropertyWidget::setControlState(const std::string& data)
{
m_surfacePickHelper = new pqPointPickingHelper(QKeySequence(tr("P")), false, this);
m_surfacePickHelper->connect(this, SIGNAL(viewChanged(pqView*)), SLOT(setView(pqView*)));
m_surfacePickHelper->connect(
this, SIGNAL(widgetVisibilityUpdated(bool)), SLOT(setShortcutEnabled(bool)));
this->connect(m_surfacePickHelper, SIGNAL(pick(double, double, double)),
SLOT(setWorldPosition(double, double, double)));
pqPointPickingVisibilityHelper<pqPointPickingHelper>{ *this, *m_surfacePickHelper };
m_surfacePickHelper->setView(currView);
}
......@@ -154,10 +155,9 @@ void pqPointPropertyWidget::setControlState(const std::string& data)
{
m_pointPickHelper = new pqPointPickingHelper(QKeySequence(tr("Ctrl+P")), true, this);
m_pointPickHelper->connect(this, SIGNAL(viewChanged(pqView*)), SLOT(setView(pqView*)));
m_pointPickHelper->connect(
this, SIGNAL(widgetVisibilityUpdated(bool)), SLOT(setShortcutEnabled(bool)));
this->connect(m_pointPickHelper, SIGNAL(pick(double, double, double)),
SLOT(setWorldPosition(double, double, double)));
pqPointPickingVisibilityHelper<pqPointPickingHelper>{ *this, *m_pointPickHelper };
m_pointPickHelper->setView(currView);
}
}
......
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//=========================================================================
#ifndef smtk_extension_paraview_widgets_pqPointPickingVisibilityHelper_h
#define smtk_extension_paraview_widgets_pqPointPickingVisibilityHelper_h
#include "pqInteractivePropertyWidget.h"
#include "smtk/extension/paraview/widgets/smtkPQWidgetsExtModule.h"
/// A utility to adapt PV point-picking helpers across an API change.
template <typename PickHelper>
struct pqPointPickingVisibilityHelper
{
// pqPointPickingHelper::setShortcutEnabled is no longer available.
template <typename Test>
static void test(pqInteractivePropertyWidget&, Test&, ...)
{
// Do nothing
}
// Older ParaView requires pqPointPickingHelper::setShortcutEnabled be connected.
template <typename Test>
static void test(pqInteractivePropertyWidget& w, Test& obj, decltype(&Test::setShortcutEnabled))
{
QObject::connect(
&w, &pqInteractivePropertyWidget::widgetVisibilityUpdated, &obj, &Test::setShortcutEnabled);
}
pqPointPickingVisibilityHelper(pqInteractivePropertyWidget& w, PickHelper& obj)
{
pqPointPickingVisibilityHelper::test<PickHelper>(w, obj);
}
};
#endif // smtk_extension_paraview_widgets_pqPointPickingVisibilityHelper_h
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment