Copy QTableWidget cell content to clipboard
-
I built up a context menu that opens with right-click on the cell in a QTableWidget. Could you help me to create a command to copy the contents of that cell to the clipboard? The examples I have found on the web are really bad.
Thanks in advance
-
I don't have any examples for "QClipboard":http://qt-project.org/doc/qt-5/qclipboard.html under my hands so this is my idea
-
get the system clipboard
@
clipboard = QApplication::clipboard();
@ -
connect copy menu item to some slot
-
in the slot put a content of QTableWidget cell into clipboard
@
clipboard->setText(lineEdit->text(), QClipboard::Clipboard);
clipboard->setText(lineEdit->text(), QClipboard::Selection);
@
See "here":http://qt-project.org/doc/qt-5/qtwidgets-widgets-charactermap-example.html#mainwindow-class-implementation for additional details
or if you have installed Qt from qt-project websiate then
@
Qt/Examples/Qt-5.3/widgets/widgets/charactermap/
@ -