Generic highlighter: Add convenience buttons to download dialog interface.

Buttons Select All/Clear Selection/Invert Selection.
This commit is contained in:
Leandro Melo
2010-09-17 17:14:13 +02:00
parent 662e744351
commit bdfadd3512
3 changed files with 70 additions and 5 deletions

View File

@@ -64,6 +64,9 @@ ManageDefinitionsDialog::ManageDefinitionsDialog(
populateDefinitionsWidget();
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(downloadDefinitions()));
connect(ui.allButton, SIGNAL(clicked()), this, SLOT(selectAll()));
connect(ui.clearButton, SIGNAL(clicked()), this, SLOT(clearSelection()));
connect(ui.invertButton, SIGNAL(clicked()), this, SLOT(invertSelection()));
}
void ManageDefinitionsDialog::populateDefinitionsWidget()
@@ -117,6 +120,28 @@ void ManageDefinitionsDialog::downloadDefinitions()
accept();
}
void ManageDefinitionsDialog::selectAll()
{
ui.definitionsTable->selectAll();
ui.definitionsTable->setFocus();
}
void ManageDefinitionsDialog::clearSelection()
{
ui.definitionsTable->clearSelection();
}
void ManageDefinitionsDialog::invertSelection()
{
const QModelIndex &topLeft = ui.definitionsTable->model()->index(0, 0);
const QModelIndex &bottomRight =
ui.definitionsTable->model()->index(ui.definitionsTable->rowCount() - 1,
ui.definitionsTable->columnCount() - 1);
QItemSelection itemSelection(topLeft, bottomRight);
ui.definitionsTable->selectionModel()->select(itemSelection, QItemSelectionModel::Toggle);
ui.definitionsTable->setFocus();
}
void ManageDefinitionsDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);