本文整理汇总了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();
}
}
示例2: copyTextToClipboard
void Util::copyTextToClipboard(QString str)
{
QClipboard *cb = QGuiApplication::clipboard();
cb->clear();
cb->setText(str);
}
示例3: copy_selected
void VoxelEditor::copy_selected()
{
QClipboard * clipboard = QApplication::clipboard();
clipboard->clear();
copied_list = selected_list;
window->set_status("Copied voxels");
}
示例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();
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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
}
示例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;
}
示例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);
}
示例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()));
}
示例13: clearClipboard
/**
* @brief MainWindow::clearClipboard
*/
void MainWindow::clearClipboard()
{
QClipboard *clipboard = QApplication::clipboard();
clipboard->clear();
ui->statusBar->showMessage(tr("Clipboard cleared"), 3000);
}
示例14: on_action_ClearClipboard_triggered
void MainWindow::on_action_ClearClipboard_triggered()
{
QClipboard *clipboard = QApplication::clipboard();
clipboard->clear();
}