mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge remote-tracking branch 'origin/dev' into summary-text-edit-in-toolbar
This commit is contained in:
@@ -46,7 +46,9 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <QComboBox>
|
||||
#include <QDebug>
|
||||
#include <QLabel>
|
||||
#include <QListView>
|
||||
#include <QWheelEvent>
|
||||
|
||||
|
||||
@@ -198,11 +200,18 @@ void PdmUiComboBoxEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
|
||||
m_comboBox->blockSignals(true);
|
||||
m_comboBox->clear();
|
||||
QListView* listView = dynamic_cast<QListView*>(m_comboBox->view());
|
||||
if (listView)
|
||||
{
|
||||
listView->setSpacing(2);
|
||||
}
|
||||
|
||||
if (!options.isEmpty())
|
||||
{
|
||||
for (int i = 0; i < options.size(); i++)
|
||||
for (const auto& option : options)
|
||||
{
|
||||
m_comboBox->addItem(options[i].icon(), options[i].optionUiText());
|
||||
m_comboBox->addItem(option.icon(), option.optionUiText());
|
||||
m_comboBox->setIconSize(m_attributes.iconSize);
|
||||
}
|
||||
m_comboBox->setCurrentIndex(uiField()->uiValue().toInt());
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ public:
|
||||
minimumContentsLength = 8;
|
||||
enableEditableContent = false;
|
||||
minimumWidth = -1;
|
||||
iconSize = QSize(14, 14);
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -75,6 +76,8 @@ public:
|
||||
int minimumWidth;
|
||||
QString nextButtonText;
|
||||
QString prevButtonText;
|
||||
|
||||
QSize iconSize;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -171,6 +171,14 @@ void PdmUiTreeView::selectAsCurrentItem(const PdmUiItem* uiItem)
|
||||
m_treeViewEditor->selectAsCurrentItem(uiItem);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTreeView::selectItems(const std::vector<const PdmUiItem*>& uiItems)
|
||||
{
|
||||
m_treeViewEditor->selectItems(uiItems);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -76,6 +76,7 @@ public:
|
||||
|
||||
void selectedUiItems(std::vector<PdmUiItem*>& objects); // TODO: rename
|
||||
void selectAsCurrentItem(const PdmUiItem* uiItem);
|
||||
void selectItems(const std::vector<const PdmUiItem*>& uiItems);
|
||||
void setExpanded(const PdmUiItem* uiItem, bool doExpand) const ;
|
||||
|
||||
// QModelIndex access
|
||||
|
||||
@@ -316,9 +316,36 @@ PdmChildArrayFieldHandle* PdmUiTreeViewEditor::currentChildArrayFieldHandle()
|
||||
void PdmUiTreeViewEditor::selectAsCurrentItem(const PdmUiItem* uiItem)
|
||||
{
|
||||
QModelIndex index = m_treeViewModel->findModelIndex(uiItem);
|
||||
QModelIndex currentIndex = m_treeView->currentIndex();
|
||||
|
||||
m_treeView->clearSelection();
|
||||
|
||||
m_treeView->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTreeViewEditor::selectItems(std::vector<const PdmUiItem*> uiItems)
|
||||
{
|
||||
m_treeView->clearSelection();
|
||||
|
||||
if (uiItems.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QModelIndex index = findModelIndex(uiItems.back());
|
||||
m_treeView->setCurrentIndex(index);
|
||||
|
||||
for (const PdmUiItem* uiItem : uiItems)
|
||||
{
|
||||
QModelIndex itemIndex = findModelIndex(uiItem);
|
||||
m_treeView->selectionModel()->select(itemIndex, QItemSelectionModel::Select);
|
||||
}
|
||||
m_treeView->setFocus(Qt::MouseFocusReason);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -391,7 +418,6 @@ void PdmUiTreeViewEditor::updateSelectionManager()
|
||||
{
|
||||
std::vector<PdmUiItem*> items;
|
||||
this->selectedUiItems(items);
|
||||
|
||||
SelectionManager::instance()->setSelectedItems(items);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ public:
|
||||
bool isTreeItemEditWidgetActive() const;
|
||||
|
||||
void selectAsCurrentItem(const PdmUiItem* uiItem);
|
||||
void selectItems(std::vector<const PdmUiItem*> uiItems);
|
||||
void selectedUiItems(std::vector<PdmUiItem*>& objects);
|
||||
void setExpanded(const PdmUiItem* uiItem, bool doExpand) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user