mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Range of plot points can be selected in graph and in table
The user is now able of selecting a range of contiguous points in any of the graphs of the plot, through rectangle selection or click in single point. This selection triggers automatically the selection of the corresponding lines in the browsed table. In this way the user can analyse the plot in detail. Two other minor improvements: spelling error fixed and the dummy column in the plot selection table has now transparent foreground (intends to avoid wondering of the user about what functionality provides this column).
This commit is contained in:
@@ -92,6 +92,9 @@ void MainWindow::init()
|
||||
connect(ui->dataTable->filterHeader(), SIGNAL(filterChanged(int,QString)), this, SLOT(updateFilter(int,QString)));
|
||||
connect(m_browseTableModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(dataTableSelectionChanged(QModelIndex)));
|
||||
|
||||
// Select in table the rows correspoding to the selected points in plot
|
||||
connect(plotDock, SIGNAL(pointsSelected(int,int)), this, SLOT(selectTableLines(int,int)));
|
||||
|
||||
// Set up DB structure tab
|
||||
dbStructureModel = new DbStructureModel(db, this);
|
||||
ui->dbTreeWidget->setModel(dbStructureModel);
|
||||
@@ -676,6 +679,22 @@ void MainWindow::selectTableLine(int lineToSelect)
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void MainWindow::selectTableLines(int firstLine, int count)
|
||||
{
|
||||
int lastLine = firstLine+count-1;
|
||||
// Are there even that many lines?
|
||||
if(lastLine >= m_browseTableModel->totalRowCount())
|
||||
return;
|
||||
|
||||
selectTableLine(firstLine);
|
||||
QItemSelectionModel* selectionModel = ui->dataTable->selectionModel();
|
||||
|
||||
QModelIndex topLeft = ui->dataTable->model()->index(firstLine, 0);
|
||||
QModelIndex bottomRight = ui->dataTable->model()->index(lastLine, ui->dataTable->model()->columnCount()-1);
|
||||
|
||||
ui->dataTable->selectionModel()->select(QItemSelection(topLeft, bottomRight), QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
}
|
||||
|
||||
void MainWindow::navigatePrevious()
|
||||
{
|
||||
int curRow = ui->dataTable->currentIndex().row();
|
||||
|
||||
Reference in New Issue
Block a user