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


C++ QMimeData::setText方法代码示例

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


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

示例1: QMimeData

	QMimeData * DraggableListWidget::mimeData ( const QList<QListWidgetItem *> items ) const
	{
		QString texts;
		foreach (QListWidgetItem *item, items)
		{
			texts += item->text();
		}

		QMimeData *mimeData = new QMimeData();
		mimeData->setText(texts);
		return mimeData;
	}
开发者ID:aseba-community,项目名称:aseba,代码行数:12,代码来源:CustomWidgets.cpp

示例2: drag

void QLineEditPrivate::drag()
{
    Q_Q(QLineEdit);
    dndTimer.stop();
    QMimeData *data = new QMimeData;
    data->setText(control->selectedText());
    QDrag *drag = new QDrag(q);
    drag->setMimeData(data);
    Qt::DropAction action = drag->start();
    if (action == Qt::MoveAction && !control->isReadOnly() && drag->target() != q)
        control->removeSelection();
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:12,代码来源:qlineedit_p.cpp

示例3: insertFromMimeData

 /*!
  * \author Anders Fernström
  * \date 2006-01-23
  *
  * \brief If the mimedata that should be insertet contain text,
  * create a new mimedata object that only contains text, otherwise
  * text format is insertet also - don't want that for inputcells.
  */
 void MyTextEdit::insertFromMimeData(const QMimeData *source)
 {
   if( source->hasText() )
   {
     QMimeData *newSource = new QMimeData();
     newSource->setText( source->text() );
     QTextBrowser::insertFromMimeData( newSource );
     delete newSource;
   }
   else
     QTextBrowser::insertFromMimeData( source );
 }
开发者ID:hkiel,项目名称:OMNotebook,代码行数:20,代码来源:inputcell.cpp

示例4: mouseMoveEvent

void ExtendedTableWidget::mouseMoveEvent(QMouseEvent * event)
{
    QTableWidgetItem *item = itemAt(event->pos());
    if (item) {
        QDrag *drag = new QDrag(this);
        QMimeData *mimeData = new QMimeData;
        mimeData->setText(item->text());
        mimeData->setData(NUMBER_MIMETYPE, "");
        drag->setMimeData(mimeData);
        drag->start(Qt::CopyAction | Qt::MoveAction);
    }
}
开发者ID:namjae,项目名称:xivo-client-qt,代码行数:12,代码来源:extendedtablewidget.cpp

示例5: writePlainText

void Pasteboard::writePlainText(const String& text, SmartReplaceOption smartReplaceOption)
{
#ifndef QT_NO_CLIPBOARD
    QMimeData* md = new QMimeData;
    QString qtext = text;
    qtext.replace(QChar(0xa0), QLatin1Char(' '));
    md->setText(qtext);
    if (smartReplaceOption == CanSmartReplace)
        md->setData(QLatin1String("application/vnd.qtwebkit.smartpaste"), QByteArray());
    QGuiApplication::clipboard()->setMimeData(md, m_selectionMode ? QClipboard::Selection : QClipboard::Clipboard);
#endif
}
开发者ID:harlanlewis,项目名称:webkit,代码行数:12,代码来源:PasteboardQt.cpp

示例6: copy

void WorksheetPrivate::copy()
{
    QTextCursor cr = ws->textCursor();
    if (cr.hasSelection())
    {
        QString text = cr.selectedText();
        text.replace(QChar(QChar::ParagraphSeparator), "\n");
        QMimeData *data = new QMimeData;
        data->setText(text);
        QApplication::clipboard()->setMimeData(data);
    }
}
开发者ID:BackupTheBerlios,项目名称:ggap,代码行数:12,代码来源:worksheet-input.cpp

示例7: mouseMoveEvent

void ExperimentGraphBlockItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
	if (QLineF(event->screenPos(), event->buttonDownScreenPos(Qt::LeftButton)).length() < 5) //QApplication::startDragDistance())//not enough dragged?
		return;

	QDrag *drag = new QDrag(event->widget());
	QMimeData *mime = new QMimeData;
	mime->setText("Test123");
	drag->setMimeData(mime);
	drag->exec();
	//setCursor(Qt::OpenHandCursor);
}
开发者ID:svengijsen,项目名称:BrainStim,代码行数:12,代码来源:experimentgraphblockitem.cpp

示例8: writeURL

void Pasteboard::writeURL(const KURL& url, const String&, Frame*)
{
    ASSERT(!url.isEmpty());

#ifndef QT_NO_CLIPBOARD
    QMimeData* md = new QMimeData;
    QString urlString = url.string();
    md->setText(urlString);
    md->setUrls(QList<QUrl>() << url);
    QGuiApplication::clipboard()->setMimeData(md, m_selectionMode ? QClipboard::Selection : QClipboard::Clipboard);
#endif
}
开发者ID:harlanlewis,项目名称:webkit,代码行数:12,代码来源:PasteboardQt.cpp

示例9: makeDrag

void ImageWIdget::makeDrag()
{
    QDrag *dr = new QDrag(this);
    // The data to be transferred by the drag and drop operation is contained in a QMimeData object
    QMimeData *data = new QMimeData;
    data->setText(myS.img.image_file);

    // Assign ownership of the QMimeData object to the QDrag object.
    dr->setMimeData(data);
    // Start the drag and drop operation
    dr->start();

}
开发者ID:mtparet,项目名称:PecsQt,代码行数:13,代码来源:imagewidget.cpp

示例10: mouseMoveEvent

// ************************************************************
void SymbolWidget::mouseMoveEvent(QMouseEvent*)
{

  QDrag *drag = new QDrag(this);
  QMimeData *mimeData = new QMimeData;

  mimeData->setText("QucsComponent:"+theModel());
  drag->setMimeData(mimeData);
  drag->setPixmap( QPixmap(empty_xpm));
  drag->setHotSpot(QPoint(drag->pixmap().width()/2,drag->pixmap().height()));
  drag->exec();

}
开发者ID:FoxMarts,项目名称:qucs,代码行数:14,代码来源:symbolwidget.cpp

示例11: mousePressEvent

void NowPlayingListWidget::mousePressEvent(QMouseEvent *event)
{
    //after checking if we are in presence of a drag operation, we can then encapsulate
    //the data to be sent and let start the drag operation
    if (event->button() == Qt::LeftButton && itemAt(event->pos())) {
        QDrag *drag = new QDrag(this);
        QMimeData *mimeData = new QMimeData();

        mimeData->setText(itemAt(event->pos())->text()); //who receives expects plain text data
        drag->setMimeData(mimeData);
        drag->exec();
    }
}
开发者ID:KDE,项目名称:ktp-kded-module,代码行数:13,代码来源:nowplaying-listwidget.cpp

示例12: performDrag

void BlockNavigationTreeWidget::performDrag()
{
	QTreeWidgetItem *item = currentItem();
	if(item)
	{
		QMimeData *mimeData = new QMimeData;
		QString text = item->text(0);
		mimeData->setText(item->text(0));
		QDrag* drag = new QDrag(this);
		drag->setMimeData(mimeData);
		m_DropAction = drag->exec( Qt::CopyAction );
	}
}
开发者ID:pholz,项目名称:UberCode,代码行数:13,代码来源:BlockNavigationTreeWidget.cpp

示例13: cursor

/**
 * This is overridden in order to properly convert Icons back
 * to their original text.
 */
QMimeData *PsiTextView::createMimeDataFromSelection() const
{
	QTextDocument *doc = new QTextDocument();
	QTextCursor cursor(doc);
	cursor.insertFragment(textCursor().selection());
	QString text = PsiRichText::convertToPlainText(doc);
	delete doc;

	QMimeData *data = new QMimeData;
	data->setText(text);
	data->setHtml(Qt::convertFromPlainText(text));
	return data;
}
开发者ID:diger,项目名称:psi-plus-snapshots,代码行数:17,代码来源:psitextview.cpp

示例14: QMimeData

QMimeData *WindowModelBase::mimeData(const QModelIndexList &indexes) const
{
  if (indexes.isEmpty ()) {
    return nullptr;
  }

  QMimeData *data = new QMimeData ();

  data->setHtml (selectionAsHtml ());
  data->setText (selectionAsText (m_delimiter));

  return data;
}
开发者ID:markummitchell,项目名称:engauge-digitizer,代码行数:13,代码来源:WindowModelBase.cpp

示例15: pushToClipboard

void ResultsJsInterface::pushToClipboard(const QString &mimeType, const QString &data, const QString &html)
{
	QMimeData *mimeData = new QMimeData();

	if (mimeType == "text/plain")
		mimeData->setText(data);

	if ( ! html.isEmpty())
		mimeData->setHtml(html);

	QClipboard *clipboard = QApplication::clipboard();
	clipboard->setMimeData(mimeData, QClipboard::Clipboard);

}
开发者ID:akashrajkn,项目名称:jasp-desktop,代码行数:14,代码来源:resultsjsinterface.cpp


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