示例#1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicPasteFeatureImpl::clearClipboard()
{
    QClipboard* clipboard = QApplication::clipboard();
    if (!clipboard) return;
    
    clipboard->clear();
}
示例#2
0
文件: dirtreeview.cpp 项目: komh/kfw
void DirTreeView::pasteFromClipboard()
{
    qDebug() << "pasteFromClipboard()";

    FileSystemSortFilterProxyModel* proxyModel =
            qobject_cast<FileSystemSortFilterProxyModel*>(model());
    QFileSystemModel* dirModel =
            qobject_cast<QFileSystemModel*>(proxyModel->sourceModel());

    QString to(dirModel->filePath(proxyModel->mapToSource(currentIndex())));

    QClipboard* clipboard = QApplication::clipboard();
    const QMimeData* mime = clipboard->mimeData();
    if (mime->hasFormat(UrlListMimeData::format(UrlListMimeData::CopyAction)))
    {
        qDebug() << "pasteFromClipboard()"
                 << "Copy list" << UrlListMimeData::listFrom(mime);

        emit paste(UrlListMimeData::listFrom(mime), to);
    }
    else
    if (mime->hasFormat(UrlListMimeData::format(UrlListMimeData::CutAction)))
    {
        qDebug() << "pasteFromClipboard()"
                 << "Cut list"
                 << UrlListMimeData::listFrom(mime,
                                              UrlListMimeData::CutAction);

        emit paste(UrlListMimeData::listFrom(mime,
                                             UrlListMimeData::CutAction),
                   to, false);

        clipboard->clear();
    }
}
示例#3
0
void Util::copyTextToClipboard(QString str)
{
    QClipboard *cb = QGuiApplication::clipboard();

    cb->clear();
    cb->setText(str);
}
示例#4
0
void VoxelEditor::copy_selected()
{
    QClipboard * clipboard = QApplication::clipboard();
    clipboard->clear();
    copied_list = selected_list;
    window->set_status("Copied voxels");
}
示例#5
0
void VDirectoryTree::pasteDirectoriesFromClipboard()
{
    if (!pasteAvailable()) {
        return;
    }

    QJsonObject obj = VUtils::clipboardToJson();
    QJsonArray dirs = obj[ClipboardConfig::c_dirs].toArray();
    bool isCut = obj[ClipboardConfig::c_isCut].toBool();
    QVector<QString> dirsToPaste(dirs.size());
    for (int i = 0; i < dirs.size(); ++i) {
        dirsToPaste[i] = dirs[i].toString();
    }

    VDirectory *destDir;
    QTreeWidgetItem *item = currentItem();
    if (item) {
        destDir = getVDirectory(item);
    } else {
        destDir = m_notebook->getRootDir();
    }

    pasteDirectories(destDir, dirsToPaste, isCut);

    QClipboard *clipboard = QApplication::clipboard();
    clipboard->clear();
}
示例#6
0
// ---------------------------------------------------------------------
int wdclipwrite(char *s)
{
  QClipboard *clipboard = app->clipboard();
  if (!clipboard) return 1;
  if (!s || !strlen(s)) clipboard->clear();
  else clipboard->setText(QString::fromUtf8(s));
  return 0;
}
示例#7
0
void Clipboard::clearClipboard()
{
    QClipboard* clipboard = QApplication::clipboard();

    if (!clipboard) {
        qWarning("Unable to access the clipboard.");
        return;
    }

    if (clipboard->text(QClipboard::Clipboard) == m_lastCopied) {
        clipboard->clear(QClipboard::Clipboard);
    }

    if (clipboard->supportsSelection()
            && (clipboard->text(QClipboard::Selection) == m_lastCopied)) {
        clipboard->clear(QClipboard::Selection);
    }

    m_lastCopied.clear();
}
示例#8
0
// ---------------------------------------------------------------------
int wdclipwriteimage(char *s)
{
  QClipboard *clipboard = app->clipboard();
  if (!clipboard) return 1;
  if (!s || !strlen(s)) clipboard->clear();
  else {
    QImage image(s2q(s));
    if (image.isNull()) return 1;
    clipboard->setImage(image);
  }
  return 0;
}
示例#9
0
// ---------------------------------------------------------------------
int wdclipwriteimagedata(const uchar *data,int len)
{
  QClipboard *clipboard = app->clipboard();
  if (!clipboard) return 1;
  if (!data || len<=0) clipboard->clear();
  else {
    QImage image=QImage();
    if (image.loadFromData(data, len) && !image.isNull()) {
      clipboard->setImage(image);
    } else return 1;
  }
  return 0;
}
示例#10
0
void CommunObject::clearClipboard() {
    QClipboard* clipboard = QGuiApplication::clipboard();

    clipboard->clear();
    /*
     * Qt bug:          'Android: QClipboard::clear() not implemented'
     * Bug description: 'This is done by calling setMimeData() with a null pointer,
     *                   but when that happens in the Android plugin we just return
     *                   without doing anything.'
     */
#if defined(Q_OS_ANDROID)
    clipboard->setMimeData(nullptr);
#endif
}
示例#11
0
/**
 * @if english
 * This is the destructor method for this class.
 * @endif
 * @if spanish
 * Este es el metodo destructor para esta clase.
 * @endif
*/
TupMainWindow::~TupMainWindow()
{
    #ifdef K_DEBUG
           TEND;
    #endif

    QClipboard *clipboard = QApplication::clipboard();
    clipboard->clear(QClipboard::Clipboard);

    delete TupPluginManager::instance();
    delete TOsd::self();
 
    delete m_projectManager;
    delete penView;
}
示例#12
0
void wid_stranke::on_btn_kopiraj_clicked() {

	QClipboard *odlozisce = QApplication::clipboard();

	QModelIndexList selectedList = ui->tbl_stranke->selectionModel()->selectedRows();

	QString html_besedilo = "<table>";
	html_besedilo += "<tr>";
	html_besedilo += "<th>ID</th>";
	html_besedilo += "<th>Ime/Naziv</th>";
	html_besedilo += "<th>Priimek/Polni naziv</th>";
	html_besedilo += "<th>Telefon</th>";
	html_besedilo += "<th>GSM</th>";
	html_besedilo += "<th>Elektronski naslov</th>";
	html_besedilo += "<th>Izobrazevalna ustanova</th>";
	html_besedilo += "<th>Tip stranke</th>";
	html_besedilo += "</tr>";

	for( int i = 0; i < selectedList.count(); i++) {
		html_besedilo += "<tr>";
		for ( int a = 0; a < 8; a++ ) {
			html_besedilo += "<td>";
			html_besedilo += ui->tbl_stranke->item(selectedList.at(i).row(), a)->text();
			html_besedilo += "</td>";

		}
		html_besedilo += "</tr>";
	}

	html_besedilo += "</table>";

	QTextEdit *textedit = new QTextEdit;

	textedit->setHtml(html_besedilo);
	html_besedilo = textedit->toHtml();

	odlozisce->clear();

	QMimeData *mimeData = new QMimeData();
	mimeData->setData("text/html", html_besedilo.toUtf8());
	odlozisce->setMimeData(mimeData, QClipboard::Clipboard);

}
示例#13
0
void S11nClipboard::syncToQt()
{
    disconnect(QApplication::clipboard(),SIGNAL(dataChanged()),this,SLOT(syncFromQt()));
    QClipboard * cb = QApplication::clipboard();
    // cb->clear(); doh! Ends up nuking m_node via signal to syncFromQt()!
    if( this->m_node )
    {
	std::ostringstream os;
	if( s11nlite::save( *m_node, os ) )
	{
	    cb->setText( os.str().c_str() );
	}
    }
    else
    {
	cb->clear();
    }
    Q_EMIT signalUpdated();
    connect(QApplication::clipboard(),SIGNAL(dataChanged()),this,SLOT(syncFromQt()));
}
示例#14
0
/**
 * @brief MainWindow::clearClipboard
 */
void MainWindow::clearClipboard()
{
    QClipboard *clipboard = QApplication::clipboard();
    clipboard->clear();
    ui->statusBar->showMessage(tr("Clipboard cleared"), 3000);
}
示例#15
0
void MainWindow::on_action_ClearClipboard_triggered()
{
    QClipboard *clipboard = QApplication::clipboard();
    clipboard->clear();
}