Skip to content

Commit c0e85e5

Browse files
committed
Qt: Add some missing data update notifications in Vfs Manager and Input Manager.
1 parent 7abe403 commit c0e85e5

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

Source/ui_qt/ControllerConfig/controllerconfigdialog.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,16 @@ void ControllerConfigDialog::bindingsViewDoubleClicked(const QModelIndex& index)
170170
uint32 padIndex = ui->tabWidget->currentIndex();
171171
assert(padIndex < CInputBindingManager::MAX_PADS);
172172
OpenBindConfigDialog(padIndex, index.row());
173+
auto& bindingsView = m_padUiElements[padIndex].bindingsView;
174+
static_cast<CInputBindingModel*>(bindingsView->model())->RefreshRow(index);
173175
}
174176

175177
void ControllerConfigDialog::bindingsViewDeleteItem()
176178
{
177179
uint32 padIndex = ui->tabWidget->currentIndex();
178180
assert(padIndex < CInputBindingManager::MAX_PADS);
179-
QItemSelectionModel* selModel = m_padUiElements[padIndex].bindingsView->selectionModel();
181+
auto& bindingsView = m_padUiElements[padIndex].bindingsView;
182+
QItemSelectionModel* selModel = bindingsView->selectionModel();
180183
auto selRows = selModel->selectedRows();
181184
if(selRows.empty())
182185
{
@@ -189,6 +192,7 @@ void ControllerConfigDialog::bindingsViewDeleteItem()
189192
for(const auto& selRow : selRows)
190193
{
191194
m_inputManager->ResetBinding(padIndex, static_cast<PS2::CControllerInfo::BUTTON>(selRow.row()));
195+
static_cast<CInputBindingModel*>(bindingsView->model())->RefreshRow(selRow);
192196
}
193197
}
194198
}

Source/ui_qt/ControllerConfig/inputbindingmodel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,8 @@ void CInputBindingModel::Refresh()
7878
{
7979
QAbstractTableModel::layoutChanged();
8080
}
81+
82+
void CInputBindingModel::RefreshRow(const QModelIndex& modelIndex)
83+
{
84+
emit QAbstractTableModel::dataChanged(index(modelIndex.row(), 0), index(modelIndex.row(), columnCount()));
85+
}

Source/ui_qt/ControllerConfig/inputbindingmodel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class CInputBindingModel : public QAbstractTableModel
1717
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
1818
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
1919
void Refresh();
20+
void RefreshRow(const QModelIndex&);
2021

2122
protected:
2223
QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE;

Source/ui_qt/vfsmodel.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,11 @@ QVariant VFSModel::headerData(int section, Qt::Orientation orientation, int role
7979
return QAbstractTableModel::headerData(section, orientation, role);
8080
}
8181

82-
void VFSModel::DoubleClicked(const QModelIndex& index, QWidget* parent)
82+
void VFSModel::DoubleClicked(const QModelIndex& modelIndex, QWidget* parent)
8383
{
84-
CDevice* m_device = m_devices.at(index.row());
85-
m_device->RequestModification(parent);
84+
const auto& device = m_devices.at(modelIndex.row());
85+
device->RequestModification(parent);
86+
emit QAbstractTableModel::dataChanged(index(modelIndex.row(), 0), index(modelIndex.row(), columnCount()));
8687
}
8788

8889
void VFSModel::Save()

0 commit comments

Comments
 (0)