Skip to content

Commit

Permalink
allow copying of multiple cells
Browse files Browse the repository at this point in the history
  • Loading branch information
sunderme committed Apr 27, 2024
1 parent a87527a commit 7d371d2
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,23 @@ void MainWindow::copyCell()
{
auto items=tableWidget->selectedItems();
if(!items.isEmpty()){
QString txt=items[0]->text();
QString txt;
int row=-1;
for(auto item:items){
if(txt.isEmpty()){
txt=item->text();
}else{
if(row!=item->row()){
txt.append("\n");
txt.append(item->text());
}else{
txt.append("\t");
txt.append(item->text());
}
}
row=item->row();
}

QClipboard *clipboard = QGuiApplication::clipboard();
clipboard->setText(txt);
}
Expand Down

0 comments on commit 7d371d2

Please sign in to comment.