mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3048 AppFwk : Remove custom context menu functions
This commit is contained in:
parent
18a0a9aa9a
commit
ab556d786b
@ -686,7 +686,6 @@ void MainWindow::createDockPanels()
|
|||||||
|
|
||||||
m_pdmUiTableView = new caf::PdmUiTableView(dockWidget);
|
m_pdmUiTableView = new caf::PdmUiTableView(dockWidget);
|
||||||
m_pdmUiTableView->setSelectionRole(caf::SelectionManager::CURRENT);
|
m_pdmUiTableView->setSelectionRole(caf::SelectionManager::CURRENT);
|
||||||
m_pdmUiTableView->enableDefaultContextMenu(true);
|
|
||||||
|
|
||||||
dockWidget->setWidget(m_pdmUiTableView);
|
dockWidget->setWidget(m_pdmUiTableView);
|
||||||
|
|
||||||
|
@ -126,14 +126,6 @@ QTableView* PdmUiTableView::tableView()
|
|||||||
return m_listViewEditor->tableView();
|
return m_listViewEditor->tableView();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void PdmUiTableView::enableDefaultContextMenu(bool enable)
|
|
||||||
{
|
|
||||||
m_listViewEditor->enableDefaultContextMenu(enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -72,7 +72,6 @@ public:
|
|||||||
|
|
||||||
void setChildArrayField(PdmChildArrayFieldHandle* childArrayField);
|
void setChildArrayField(PdmChildArrayFieldHandle* childArrayField);
|
||||||
|
|
||||||
void enableDefaultContextMenu(bool enable);
|
|
||||||
void enableHeaderText(bool enable);
|
void enableHeaderText(bool enable);
|
||||||
void setSelectionRole(SelectionManager::SelectionRole role);
|
void setSelectionRole(SelectionManager::SelectionRole role);
|
||||||
|
|
||||||
|
@ -134,8 +134,6 @@ QWidget* PdmUiTableViewEditor::createEditorWidget(QWidget* parent)
|
|||||||
FocusEventHandler* tableViewWidgetFocusEventHandler = new FocusEventHandler(this);
|
FocusEventHandler* tableViewWidgetFocusEventHandler = new FocusEventHandler(this);
|
||||||
m_tableView->installEventFilter(tableViewWidgetFocusEventHandler);
|
m_tableView->installEventFilter(tableViewWidgetFocusEventHandler);
|
||||||
|
|
||||||
updateContextMenuSignals();
|
|
||||||
|
|
||||||
return m_tableView;
|
return m_tableView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,28 +221,6 @@ void PdmUiTableViewEditor::selectedUiItems(const QModelIndexList& modelIndexList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void PdmUiTableViewEditor::customMenuRequested(QPoint pos)
|
|
||||||
{
|
|
||||||
// This is function is required to execute before populating the menu
|
|
||||||
// Several commands rely on the activeChildArrayFieldHandle in the selection manager
|
|
||||||
auto childArrayFH = childArrayFieldHandle();
|
|
||||||
SelectionManager::instance()->setActiveChildArrayFieldHandle(childArrayFH);
|
|
||||||
|
|
||||||
QMenu menu;
|
|
||||||
caf::PdmUiCommandSystemProxy::instance()->populateMenuWithDefaultCommands("PdmUiTreeViewEditor", &menu);
|
|
||||||
|
|
||||||
if (!menu.actions().empty())
|
|
||||||
{
|
|
||||||
// Qt doc: QAbstractScrollArea and its subclasses that map the context menu event to coordinates of the viewport().
|
|
||||||
QPoint globalPos = m_tableView->viewport()->mapToGlobal(pos);
|
|
||||||
|
|
||||||
menu.exec(globalPos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -253,16 +229,6 @@ QTableView* PdmUiTableViewEditor::tableView()
|
|||||||
return m_tableView;
|
return m_tableView;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void PdmUiTableViewEditor::enableDefaultContextMenu(bool enable)
|
|
||||||
{
|
|
||||||
m_useDefaultContextMenu = enable;
|
|
||||||
|
|
||||||
updateContextMenuSignals();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -272,25 +238,6 @@ void PdmUiTableViewEditor::enableHeaderText(bool enable)
|
|||||||
m_tableHeadingIcon->setVisible(enable);
|
m_tableHeadingIcon->setVisible(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void PdmUiTableViewEditor::updateContextMenuSignals()
|
|
||||||
{
|
|
||||||
if (!m_tableView) return;
|
|
||||||
|
|
||||||
if (m_useDefaultContextMenu)
|
|
||||||
{
|
|
||||||
m_tableView->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
||||||
connect(m_tableView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(customMenuRequested(QPoint)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_tableView->setContextMenuPolicy(Qt::DefaultContextMenu);
|
|
||||||
disconnect(m_tableView, nullptr, this, nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -89,7 +89,6 @@ public:
|
|||||||
PdmUiTableViewEditor();
|
PdmUiTableViewEditor();
|
||||||
~PdmUiTableViewEditor();
|
~PdmUiTableViewEditor();
|
||||||
|
|
||||||
void enableDefaultContextMenu(bool enable);
|
|
||||||
void enableHeaderText(bool enable);
|
void enableHeaderText(bool enable);
|
||||||
void setSelectionRole(SelectionManager::SelectionRole role);
|
void setSelectionRole(SelectionManager::SelectionRole role);
|
||||||
|
|
||||||
@ -107,10 +106,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual void configureAndUpdateUi(const QString& uiConfigName) override;
|
virtual void configureAndUpdateUi(const QString& uiConfigName) override;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateContextMenuSignals();
|
|
||||||
void selectedUiItems(const QModelIndexList& modelIndexList, std::vector<PdmUiItem*>& objects);
|
void selectedUiItems(const QModelIndexList& modelIndexList, std::vector<PdmUiItem*>& objects);
|
||||||
bool isSelectionRoleDefined() const;
|
bool isSelectionRoleDefined() const;
|
||||||
void tableViewWidgetFocusChanged(QEvent* focusEvent);
|
void tableViewWidgetFocusChanged(QEvent* focusEvent);
|
||||||
@ -119,7 +115,6 @@ private:
|
|||||||
PdmChildArrayFieldHandle* childArrayFieldHandle();
|
PdmChildArrayFieldHandle* childArrayFieldHandle();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void customMenuRequested(QPoint pos);
|
|
||||||
void slotCurrentChanged(const QModelIndex & current, const QModelIndex & previous);
|
void slotCurrentChanged(const QModelIndex & current, const QModelIndex & previous);
|
||||||
void slotSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected);
|
void slotSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user