diff --git a/ApplicationCode/Commands/HoloLensCommands/RicExportToSharingServerScheduler.cpp b/ApplicationCode/Commands/HoloLensCommands/RicExportToSharingServerScheduler.cpp index 74f4cdb38e..ad0ff2d0c0 100644 --- a/ApplicationCode/Commands/HoloLensCommands/RicExportToSharingServerScheduler.cpp +++ b/ApplicationCode/Commands/HoloLensCommands/RicExportToSharingServerScheduler.cpp @@ -19,6 +19,8 @@ #include "RicExportToSharingServerScheduler.h" #include "RicHoloLensAutoExportToSharingServerFeature.h" +#include "RicHoloLensSession.h" +#include "RicHoloLensSessionManager.h" #include "cafCmdFeatureManager.h" #include "cafProgressState.h" @@ -41,7 +43,11 @@ RicExportToSharingServerScheduler* RicExportToSharingServerScheduler::instance() //-------------------------------------------------------------------------------------------------- void RicExportToSharingServerScheduler::scheduleUpdateSession() { - startTimer( 0 ); + RicHoloLensSession* session = RicHoloLensSessionManager::instance()->session(); + if ( session && session->isSessionValid() ) + { + startTimer( 0 ); + } } //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.cpp index 6031c76d05..f5009c9595 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.cpp @@ -68,21 +68,6 @@ caf::PdmUiFormLayoutObjectEditor::~PdmUiFormLayoutObjectEditor() CAF_ASSERT(m_fieldViews.size() == 0); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void caf::PdmUiFormLayoutObjectEditor::slotScrollToSelectedItemsInFieldEditors() const -{ - for (auto fieldView : m_fieldViews) - { - auto listEditor = dynamic_cast(fieldView.second); - if (listEditor) - { - listEditor->scrollToSelectedItem(); - } - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.h index 077a13556a..f02a1d1220 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.h @@ -66,9 +66,6 @@ public: PdmUiFormLayoutObjectEditor(); ~PdmUiFormLayoutObjectEditor() override; -public slots: - void slotScrollToSelectedItemsInFieldEditors() const; - protected: /// When overriding this function, use findOrCreateGroupBox() or findOrCreateFieldEditor() for detailed control /// Use recursivelyConfigureAndUpdateUiItemsInGridLayoutColumn() for automatic layout of group and field widgets diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp index ee8b34d4f7..941ace1a5c 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp @@ -55,6 +55,7 @@ #include #include #include +#include @@ -150,21 +151,6 @@ PdmUiListEditor::~PdmUiListEditor() { } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void PdmUiListEditor::scrollToSelectedItem() const -{ - if (m_isScrollToItemAllowed) - { - QModelIndex mi = m_listView->currentIndex(); - if (mi.isValid()) - { - m_listView->scrollTo(mi); - } - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -294,7 +280,7 @@ void PdmUiListEditor::configureAndUpdateUi(const QString& uiConfigName) m_listView->selectionModel()->blockSignals(false); } - //ensureCurrentItemIsVisible(); + QTimer::singleShot(150, this, SLOT(slotScrollToSelectedItem())); } //-------------------------------------------------------------------------------------------------- @@ -406,6 +392,21 @@ void PdmUiListEditor::slotListItemEdited(const QModelIndex&, const QModelIndex&) trimAndSetValuesToField(uiList); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiListEditor::slotScrollToSelectedItem() const +{ + if (m_isScrollToItemAllowed) + { + QModelIndex mi = m_listView->currentIndex(); + if (mi.isValid()) + { + m_listView->scrollTo(mi); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.h index d2177dfbc8..bdc95617f9 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.h @@ -83,7 +83,6 @@ public: PdmUiListEditor(); ~PdmUiListEditor() override; - void scrollToSelectedItem() const; protected: QWidget* createEditorWidget(QWidget * parent) override; @@ -95,6 +94,7 @@ protected: protected slots: void slotSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ); void slotListItemEdited(const QModelIndex&, const QModelIndex&); + void slotScrollToSelectedItem() const; private: QString contentAsString() const; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp index 0461de05cc..b3bbbac5c9 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp @@ -192,23 +192,10 @@ void PdmUiPropertyView::showProperties( PdmObjectHandle* object) m_defaultObjectEditor->setPdmObject(object); - QObject::connect(m_defaultObjectEditor, SIGNAL(uiUpdated()), this, SLOT(slotScheduleScrollToSelectedItemsInFieldEditors())); - m_defaultObjectEditor->updateUi(m_uiConfigName); m_scrollArea->updateGeometry(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void PdmUiPropertyView::slotScheduleScrollToSelectedItemsInFieldEditors() -{ - if (m_defaultObjectEditor) - { - QTimer::singleShot(150, m_defaultObjectEditor, SLOT(slotScrollToSelectedItemsInFieldEditors())); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.h index a377eb9208..c15065aed1 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.h @@ -85,7 +85,6 @@ public: public slots: void showProperties(caf::PdmObjectHandle* object); // Signal/Slot system needs caf:: prefix in some cases - void slotScheduleScrollToSelectedItemsInFieldEditors(); private: PdmUiDefaultObjectEditor* m_defaultObjectEditor;