Esempio n. 1
0
bool ClipboardModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
    if ( index.isValid() && (role == Qt::EditRole || role == contentType::notes) ) {
        int row = index.row();
        ClipboardItem *item = m_clipboardList[row];
        if (role == Qt::EditRole)
            item->setData(value);
        else
            item->setData( mimeItemNotes, value.toString().toUtf8() );
        emit dataChanged(index, index);
        return true;
    }
    return false;
}
Esempio n. 2
0
void ClipboardModel::insertItem(const QVariantMap &data, int row)
{
    ClipboardItem item;
    item.setData(data);

    beginInsertRows(QModelIndex(), row, row);

    m_clipboardList.insert(row, item);

    endInsertRows();
}
Esempio n. 3
0
void ClipboardMonitor::clipboardChanged(QClipboard::Mode, QMimeData *data)
{
    ClipboardItem item;

    item.setData(data);

    // send clipboard item
    QByteArray msg;
    QDataStream out(&msg, QIODevice::WriteOnly);
    out << item;
    writeMessage(m_socket, msg);
}