Merge pull request #3277 from ZehMatt/optimize-pagerights
Optimize Page Rights UI
This commit is contained in:
commit
03c6f3b6a5
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue