feat: 添加识别结果展示接口
添加识别结果展示接口 Log: 识别展示接口方面 Change-Id: I8ae47b70b404e69d79a36f9ada9c4e476316cfdc
This commit is contained in:
parent
29e6a5f253
commit
d6b3771524
|
@ -24,7 +24,6 @@ MainWidget::MainWidget(QWidget *parent) :
|
||||||
setIcons(themeType);
|
setIcons(themeType);
|
||||||
|
|
||||||
setupConnect();
|
setupConnect();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWidget::~MainWidget()
|
MainWidget::~MainWidget()
|
||||||
|
@ -234,23 +233,50 @@ void MainWidget::openImage(const QImage &img)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWidget::loadHtml(const QString &html)
|
||||||
|
{
|
||||||
|
if (!html.isEmpty()) {
|
||||||
|
m_plainTextEdit->appendHtml(html);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWidget::loadString(const QString &string)
|
||||||
|
{
|
||||||
|
if (!string.isEmpty()) {
|
||||||
|
QStringList templist = string.split("\r\n", QString::KeepEmptyParts);
|
||||||
|
for (int i = 0; i < templist.size(); i++) {
|
||||||
|
m_plainTextEdit->appendPlainText(templist.at(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWidget::resizeEvent(QResizeEvent *event)
|
void MainWidget::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
loadingUi();
|
loadingUi();
|
||||||
|
m_pwidget->setFixedSize(this->width(), this->height() - 48);
|
||||||
|
m_pwidget->move(0, 0);
|
||||||
return DWidget::resizeEvent(event);
|
return DWidget::resizeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWidget::slotCopy()
|
void MainWidget::slotCopy()
|
||||||
{
|
{
|
||||||
|
//复制所有内容
|
||||||
|
QTextDocument *document = m_plainTextEdit->document();
|
||||||
|
DPlainTextEdit *tempTextEdit = new DPlainTextEdit(this);
|
||||||
|
tempTextEdit->setDocument(document);
|
||||||
|
tempTextEdit->selectAll();
|
||||||
|
tempTextEdit->copy();
|
||||||
|
|
||||||
QIcon icon(":/assets/icon_toast_sucess_new.svg");
|
QIcon icon(":/assets/icon_toast_sucess_new.svg");
|
||||||
DFloatingMessage *pDFloatingMessage = new DFloatingMessage(DFloatingMessage::MessageType::TransientType, this);
|
DFloatingMessage *pDFloatingMessage = new DFloatingMessage(DFloatingMessage::MessageType::TransientType, m_pwidget);
|
||||||
pDFloatingMessage->setBlurBackgroundEnabled(true);
|
pDFloatingMessage->setBlurBackgroundEnabled(true);
|
||||||
pDFloatingMessage->setMessage(tr("Copied"));
|
pDFloatingMessage->setMessage(tr("Copied"));
|
||||||
pDFloatingMessage->setIcon(icon);
|
pDFloatingMessage->setIcon(icon);
|
||||||
pDFloatingMessage->raise();
|
pDFloatingMessage->raise();
|
||||||
DMessageManager::instance()->sendMessage(this, pDFloatingMessage);
|
DMessageManager::instance()->sendMessage(m_pwidget, pDFloatingMessage);
|
||||||
m_plainTextEdit->copy();
|
tempTextEdit->deleteLater();
|
||||||
|
tempTextEdit = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::slotExport()
|
void MainWidget::slotExport()
|
||||||
|
|
|
@ -34,6 +34,10 @@ public:
|
||||||
|
|
||||||
void openImage(const QString &path);
|
void openImage(const QString &path);
|
||||||
void openImage(const QImage &img);
|
void openImage(const QImage &img);
|
||||||
|
|
||||||
|
void loadHtml(const QString &html);
|
||||||
|
void loadString(const QString &string);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event);
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
@ -35,6 +35,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
m_mainWidget = new MainWidget(this);
|
m_mainWidget = new MainWidget(this);
|
||||||
}
|
}
|
||||||
this->setCentralWidget(m_mainWidget);
|
this->setCentralWidget(m_mainWidget);
|
||||||
|
this->resize(840, 550);
|
||||||
|
this->setMinimumSize(840, 550);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user