1
0
Fork 0

Merge pull request #3277 from ZehMatt/optimize-pagerights

Optimize Page Rights UI
This commit is contained in:
Duncan Ogilvie 2023-11-26 17:12:35 +01:00 committed by GitHub
commit 03c6f3b6a5
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 13 deletions

View File

@ -55,24 +55,27 @@ void PageMemoryRights::RunAddrSize(duint addrin, duint sizein, QString pagetypei
void PageMemoryRights::on_btnSelectall_clicked()
{
for(int i = 0; i < ui->pagetableWidget->rowCount(); i++)
{
for(int j = 0; j < ui->pagetableWidget->columnCount(); j++)
{
QModelIndex idx = (ui->pagetableWidget->model()->index(i, j));
ui->pagetableWidget->selectionModel()->select(idx, QItemSelectionModel::Select);
}
}
const auto rowCount = ui->pagetableWidget->rowCount();
const auto columnCount = ui->pagetableWidget->columnCount();
QModelIndex topLeft = ui->pagetableWidget->model()->index(0, 0);
QModelIndex bottomRight = ui->pagetableWidget->model()->index(rowCount - 1, columnCount - 1);
QItemSelection selection(topLeft, bottomRight);
ui->pagetableWidget->selectionModel()->select(selection, QItemSelectionModel::Select);
}
void PageMemoryRights::on_btnDeselectall_clicked()
{
QModelIndexList indexList = ui->pagetableWidget->selectionModel()->selectedIndexes();
foreach(QModelIndex index, indexList)
{
ui->pagetableWidget->selectionModel()->select(index, QItemSelectionModel::Deselect);
QModelIndexList selectedIndexes = ui->pagetableWidget->selectionModel()->selectedIndexes();
if(selectedIndexes.isEmpty())
return;
}
QModelIndex topLeft = selectedIndexes.first();
QModelIndex bottomRight = selectedIndexes.last();
QItemSelection selection(topLeft, bottomRight);
ui->pagetableWidget->selectionModel()->select(selection, QItemSelectionModel::Deselect);
}
void PageMemoryRights::on_btnSetrights_clicked()