Wat copy paste code en csvwriter alvast toegevoegd maar nog uitgeschakeld.

This commit is contained in:
Eelke Klein 2017-01-13 19:09:58 +01:00
parent cc5bbab0f5
commit be1892ac52
6 changed files with 90 additions and 4 deletions

View file

@ -435,3 +435,34 @@ void MainWindow::on_actionAbout_triggered()
{
//
}
#if false
void Copy( )
{
QString selected_text;
// You need a pair of indexes to find the row changes
QModelIndex previous = indexes.first();
indexes.removeFirst();
foreach(current, indexes)
{
QVariant data = model->data(current);
QString text = data.toString();
// At this point `text` contains the text in one cell
selected_text.append(text);
// If you are at the start of the row the row number of the previous index
// isn't the same. Text is followed by a row separator, which is a newline.
if (current.row() != previous.row())
{
selected_text.append('\n');
}
// Otherwise it's the same row, so append a column separator, which is a tab.
else
{
selected_text.append('\t');
}
previous = current;
}
QApplication.clipboard().setText(selected_text);
}
#endif