标签:qstring 技术分享 http void clip pre 拖拽 for 存在
void MainWindow::on_pushButton_clicked()
{
ui->label->clear();
const QClipboard *clipboard = QApplication::clipboard(); //获取剪切版内容
//为数据提供一个容器,用来记录关于MIME类型数据的信息
//常用来描述保存在剪切板里信息,或者拖拽原理
const QMimeData *mimeData = clipboard->mimeData();
if (mimeData->hasHtml())
{
QString html = mimeData->html();
html.replace(QString("\\"),QString("/"));
html.remove("file:///");
ui->label->setText(html);
// qDebug() <<"html: " << html;
ui->label->setTextFormat(Qt::RichText); //文本字符串被解释为富文本字符串。
}
// thread()->sleep(5);
// ui->label->clear();
}
标签:qstring 技术分享 http void clip pre 拖拽 for 存在
原文地址:https://www.cnblogs.com/xiaoming520/p/9689708.html