当前位置: 首页>>代码示例>>C++>>正文


C++ QClipboard::clear方法代码示例

本文整理汇总了C++中QClipboard::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ QClipboard::clear方法的具体用法?C++ QClipboard::clear怎么用?C++ QClipboard::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QClipboard的用法示例。


在下文中一共展示了QClipboard::clear方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pasteFromClipboard

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();
    }
}
开发者ID:komh,项目名称:kfw,代码行数:35,代码来源:dirtreeview.cpp

示例2: copyTextToClipboard

void Util::copyTextToClipboard(QString str)
{
    QClipboard *cb = QGuiApplication::clipboard();

    cb->clear();
    cb->setText(str);
}
开发者ID:Herrie82,项目名称:fingerterm,代码行数:7,代码来源:util.cpp

示例3: copy_selected

void VoxelEditor::copy_selected()
{
    QClipboard * clipboard = QApplication::clipboard();
    clipboard->clear();
    copied_list = selected_list;
    window->set_status("Copied voxels");
}
开发者ID:Dakror,项目名称:voxie,代码行数:7,代码来源:voxeditor.cpp

示例4: pasteDirectoriesFromClipboard

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();
}
开发者ID:vscanf,项目名称:vnote,代码行数:27,代码来源:vdirectorytree.cpp

示例5: wdclipwrite

// ---------------------------------------------------------------------
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;
}
开发者ID:0branch,项目名称:qtide,代码行数:9,代码来源:clipboard.cpp

示例6: clearClipboard

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();
}
开发者ID:sebastianhaas,项目名称:keepassx,代码行数:20,代码来源:Clipboard.cpp

示例7: wdclipwriteimage

// ---------------------------------------------------------------------
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;
}
开发者ID:0branch,项目名称:qtide,代码行数:13,代码来源:clipboard.cpp

示例8: wdclipwriteimagedata

// ---------------------------------------------------------------------
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;
}
开发者ID:0branch,项目名称:qtide,代码行数:14,代码来源:clipboard.cpp

示例9: clearClipboard

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
}
开发者ID:DD-L,项目名称:MySecrect,代码行数:14,代码来源:webchannelobject.cpp

示例10: instance

/**
 * @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;
}
开发者ID:hpsaturn,项目名称:tupi,代码行数:23,代码来源:tupmainwindow.cpp

示例11: on_btn_kopiraj_clicked

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);

}
开发者ID:SpelaOman,项目名称:BubiRacun,代码行数:43,代码来源:wid_stranke.cpp

示例12: signalUpdated

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()));
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qboard,代码行数:20,代码来源:S11nClipboard.cpp

示例13: clearClipboard

/**
 * @brief MainWindow::clearClipboard
 */
void MainWindow::clearClipboard()
{
    QClipboard *clipboard = QApplication::clipboard();
    clipboard->clear();
    ui->statusBar->showMessage(tr("Clipboard cleared"), 3000);
}
开发者ID:mwfc,项目名称:qtpass,代码行数:9,代码来源:mainwindow.cpp

示例14: on_action_ClearClipboard_triggered

void MainWindow::on_action_ClearClipboard_triggered()
{
    QClipboard *clipboard = QApplication::clipboard();
    clipboard->clear();
}
开发者ID:rayfung,项目名称:easypass,代码行数:5,代码来源:mainwindow.cpp


注:本文中的QClipboard::clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。