mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
AppFwk : Remove unused code and several minor cleanup changes
This commit is contained in:
parent
14cf6470f0
commit
d52c7b4119
@ -92,8 +92,8 @@ public:
|
||||
|
||||
QTableView* tableView();
|
||||
|
||||
virtual void handleModelNotification(caf::PdmObjectHandle* itemThatChanged);
|
||||
virtual void handleModelSelectionChange();
|
||||
void handleModelNotification(caf::PdmObjectHandle* itemThatChanged) override;
|
||||
void handleModelSelectionChange() override;
|
||||
|
||||
private:
|
||||
PdmUiTableViewEditor* m_listViewEditor;
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event)
|
||||
bool eventFilter(QObject *obj, QEvent *event) override
|
||||
{
|
||||
if (event->type() == QEvent::FocusIn ||
|
||||
event->type() == QEvent::FocusOut)
|
||||
@ -221,9 +221,8 @@ void PdmUiTableViewEditor::setListField(PdmChildArrayFieldHandle* pdmListField)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTableViewEditor::selectedUiItems(const QModelIndexList& modelIndexList, std::vector<PdmUiItem*>& objects)
|
||||
{
|
||||
for (int i = 0; i < modelIndexList.size(); i++)
|
||||
for (const QModelIndex& mi : modelIndexList)
|
||||
{
|
||||
QModelIndex mi = modelIndexList[i];
|
||||
int row = mi.row();
|
||||
|
||||
caf::PdmUiObjectHandle* uiObject = uiObj(m_tableModelPdm->pdmObjectForRow(row));
|
||||
@ -246,7 +245,7 @@ void PdmUiTableViewEditor::customMenuRequested(QPoint pos)
|
||||
QMenu menu;
|
||||
caf::PdmUiCommandSystemProxy::instance()->populateMenuWithDefaultCommands("PdmUiTreeViewEditor", &menu);
|
||||
|
||||
if (menu.actions().size() > 0)
|
||||
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);
|
||||
@ -340,7 +339,7 @@ void PdmUiTableViewEditor::handleModelSelectionChange()
|
||||
{
|
||||
PdmObject* pdmObj = dynamic_cast<PdmObject*>(items[0]);
|
||||
QItemSelection itemSelection = m_tableModelPdm->modelIndexFromPdmObject(pdmObj);
|
||||
if (itemSelection.size() > 0)
|
||||
if (!itemSelection.empty())
|
||||
{
|
||||
m_tableView->selectionModel()->select(itemSelection, QItemSelectionModel::SelectCurrent);
|
||||
}
|
||||
@ -415,9 +414,8 @@ void PdmUiTableViewEditor::updateSelectionManagerFromTableSelection()
|
||||
std::vector<PdmUiItem*> items;
|
||||
|
||||
QModelIndexList modelIndexList = m_tableView->selectionModel()->selectedIndexes();
|
||||
for (int i = 0; i < modelIndexList.size(); i++)
|
||||
for (const QModelIndex& mi : modelIndexList)
|
||||
{
|
||||
QModelIndex mi = modelIndexList[i];
|
||||
PdmFieldHandle* pdmFieldHandle = m_tableModelPdm->getField(mi);
|
||||
|
||||
if (pdmFieldHandle && pdmFieldHandle->uiCapability())
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
void enableHeaderText(bool enable);
|
||||
void setSelectionRole(SelectionManager::SelectionRole role);
|
||||
|
||||
PdmObjectHandle* pdmObjectFromModelIndex(const QModelIndex& mi);
|
||||
PdmObjectHandle* pdmObjectFromModelIndex(const QModelIndex& mi);
|
||||
|
||||
void setListField(PdmChildArrayFieldHandle* pdmListField);
|
||||
QWidget* createWidget(QWidget* parent);
|
||||
@ -85,10 +85,9 @@ public:
|
||||
QTableView* tableView();
|
||||
|
||||
void handleModelSelectionChange();
|
||||
void updatePersistentEditors() const;
|
||||
|
||||
protected:
|
||||
virtual void configureAndUpdateUi(const QString& uiConfigName);
|
||||
virtual void configureAndUpdateUi(const QString& uiConfigName) override;
|
||||
|
||||
private:
|
||||
void updateContextMenuSignals();
|
||||
@ -105,8 +104,6 @@ private slots:
|
||||
private:
|
||||
friend class FocusEventHandler;
|
||||
|
||||
std::map<QString, PdmUiFieldEditorHandle*> m_fieldViews;
|
||||
|
||||
QPointer<QWidget> m_mainWidget;
|
||||
QLayout* m_layout;
|
||||
QLabel* m_tableHeading;
|
||||
|
@ -220,14 +220,14 @@ QVariant PdmUiTableViewModel::data(const QModelIndex &index, int role /*= Qt::Di
|
||||
QString displayText;
|
||||
QList<QVariant> valuesSelectedInField = fieldValue.toList();
|
||||
|
||||
if (valuesSelectedInField.size() > 0)
|
||||
if (!valuesSelectedInField.empty())
|
||||
{
|
||||
QList<PdmOptionItemInfo> options;
|
||||
bool useOptionsOnly = true;
|
||||
options = uiFieldHandle->valueOptions(&useOptionsOnly);
|
||||
CAF_ASSERT(useOptionsOnly); // Not supported
|
||||
|
||||
for (QVariant v : valuesSelectedInField)
|
||||
for (const QVariant& v : valuesSelectedInField)
|
||||
{
|
||||
int index = v.toInt();
|
||||
if (index != -1)
|
||||
@ -336,7 +336,7 @@ void PdmUiTableViewModel::setPdmData(PdmChildArrayFieldHandle* listField, const
|
||||
|
||||
PdmUiOrdering configForFirstObject;
|
||||
|
||||
if (m_pdmList && m_pdmList->size() > 0)
|
||||
if (m_pdmList && !m_pdmList->empty())
|
||||
{
|
||||
PdmObjectHandle* pdmObjHandle = m_pdmList->at(0);
|
||||
PdmUiObjectHandle* uiObject = pdmObjHandle->uiCapability();
|
||||
@ -358,14 +358,14 @@ void PdmUiTableViewModel::setPdmData(PdmChildArrayFieldHandle* listField, const
|
||||
|
||||
m_modelColumnIndexToFieldIndex.clear();
|
||||
|
||||
for (size_t i = 0; i < uiItems.size(); ++i)
|
||||
for (auto uiItem : uiItems)
|
||||
{
|
||||
if (uiItems[i]->isUiHidden(configName)) continue;
|
||||
if (uiItem->isUiHidden(configName)) continue;
|
||||
|
||||
if (uiItems[i]->isUiGroup()) continue;
|
||||
if (uiItem->isUiGroup()) continue;
|
||||
|
||||
{
|
||||
PdmUiFieldHandle* field = dynamic_cast<PdmUiFieldHandle*>(uiItems[i]);
|
||||
PdmUiFieldHandle* field = dynamic_cast<PdmUiFieldHandle*>(uiItem);
|
||||
PdmUiFieldEditorHandle* fieldEditor = nullptr;
|
||||
|
||||
// Find or create FieldEditor
|
||||
@ -415,9 +415,9 @@ void PdmUiTableViewModel::setPdmData(PdmChildArrayFieldHandle* listField, const
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < fvhToRemoveFromMap.size(); ++i)
|
||||
for (const auto& fieldEditorName : fvhToRemoveFromMap)
|
||||
{
|
||||
m_fieldEditors.erase(fvhToRemoveFromMap[i]);
|
||||
m_fieldEditors.erase(fieldEditorName);
|
||||
}
|
||||
|
||||
recreateTableItemEditors();
|
||||
@ -519,9 +519,9 @@ void PdmUiTableViewModel::notifyDataChanged(const QModelIndex& topLeft, const QM
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTableViewModel::recreateTableItemEditors()
|
||||
{
|
||||
for (size_t i = 0; i < m_tableItemEditors.size(); i++)
|
||||
for (auto tableItemEditor : m_tableItemEditors)
|
||||
{
|
||||
delete m_tableItemEditors[i];
|
||||
delete tableItemEditor;
|
||||
}
|
||||
m_tableItemEditors.clear();
|
||||
|
||||
@ -634,7 +634,7 @@ QItemSelection PdmUiTableViewModel::modelIndexFromPdmObject(PdmObjectHandle* pdm
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int PdmUiTableViewModel::getFieldIndex(PdmFieldHandle* field) const
|
||||
{
|
||||
if (m_pdmList && m_pdmList->size() > 0)
|
||||
if (m_pdmList && !m_pdmList->empty())
|
||||
{
|
||||
PdmObjectHandle* pdmObject = m_pdmList->at(0);
|
||||
if (pdmObject)
|
||||
|
@ -90,13 +90,13 @@ public:
|
||||
PdmObjectHandle* pdmObjectForRow(int row) const;
|
||||
|
||||
// Qt overrides
|
||||
virtual int rowCount( const QModelIndex &parent = QModelIndex( ) ) const;
|
||||
virtual int columnCount( const QModelIndex &parent = QModelIndex( ) ) const;
|
||||
virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
|
||||
virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
|
||||
int rowCount( const QModelIndex &parent = QModelIndex( ) ) const override;
|
||||
int columnCount( const QModelIndex &parent = QModelIndex( ) ) const override;
|
||||
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
|
||||
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
|
||||
|
||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
|
||||
void notifyDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user