(table)
return mime
Copy the current selection in a QTableView to the clipboard.
Copy the current selection in a QTableView to the clipboard.
Copy the current selection in a QTableView to the clipboard .
def table_selection_to_mime_data(table):
    """Copy the current selection in a QTableView to the clipboard.
    """
    lines = table_selection_to_list(table)

    as_csv = lines_to_csv_string(lines, dialect="excel").encode("utf-8")
    as_tsv = lines_to_csv_string(lines, dialect="excel-tab").encode("utf-8")

    mime = QMimeData()
    mime.setData("text/csv", QByteArray(as_csv))
    mime.setData("text/tab-separated-values", QByteArray(as_tsv))
    mime.setData("text/plain", QByteArray(as_tsv))
    return mime
def table_selection_to_mime_data ( table ) : lines = table_selection_to_list ( table ) as_csv = lines_to_csv_string ( lines , dialect = "excel" ) . encode ( "utf-8" ) as_tsv = lines_to_csv_string ( lines , dialect = "excel-tab" ) . encode ( "utf-8" ) mime = QMimeData ( ) mime . setData ( "text/csv" , QByteArray ( as_csv ) ) mime . setData ( "text/tab-separated-values" , QByteArray ( as_tsv ) ) mime . setData ( "text/plain" , QByteArray ( as_tsv ) ) return mime