979 lines
40 KiB
C++
979 lines
40 KiB
C++
#include "SceneEditOption.h"
|
||
#include "pictextitem.h"
|
||
#include "ui_sceneEditOption.h"
|
||
#include <QDir>
|
||
#include <QStringListModel>
|
||
#include <SysPara.h>
|
||
#include <QAbstractItemView>
|
||
#include <QFile>
|
||
#include <QTextStream>
|
||
#include <QMessageBox>
|
||
#include <Public.h>
|
||
#include <unistd.h>
|
||
#include <QTextCodec>
|
||
#include <QByteArray>
|
||
#include <QDebug>
|
||
#include <QXmlStreamWriter>
|
||
#include <QLabel>
|
||
|
||
#include "myview.h"
|
||
#include "LogInfo.h"
|
||
#include <QTextBlockFormat>
|
||
#include <QTextBlock>
|
||
#include <QPalette>
|
||
|
||
#include<iostream>
|
||
#include<string>
|
||
|
||
MoveInput* moveInput;
|
||
SceneEditOption::SceneEditOption(QWidget *parent) :
|
||
QWidget(parent),
|
||
ui(new Ui::SceneEditOption),newScene(0)
|
||
{
|
||
ui->setupUi(this);
|
||
editMode = SCENE;
|
||
xmlfileName = "";
|
||
dialogFileOperation = new DialogFileOperation(0);
|
||
#ifdef MYSAVEFILEDLG
|
||
dialogSaveFile =new DialogSaveFile(0);
|
||
//connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)));
|
||
#endif
|
||
m_CreateImageFlag = false;
|
||
m_pSavePicScene = new QGraphicsScene();
|
||
m_pSavePicScene->setSceneRect(QRectF(0, 0, 3200, MAX_PRINT_ROW_NUM)); //生成图片的场景
|
||
moveInput = new MoveInput(parent);
|
||
|
||
pPicScene2 = new PicScene(this); //Scene Test
|
||
auto items = pPicScene2->items();
|
||
int a =0;
|
||
}
|
||
|
||
SceneEditOption::~SceneEditOption()
|
||
{
|
||
if(m_pSavePicScene)
|
||
{
|
||
delete m_pSavePicScene;
|
||
}
|
||
if(moveInput)
|
||
{
|
||
delete moveInput;
|
||
}
|
||
}
|
||
|
||
void SceneEditOption::bindStackWidget(QStackedWidget *stackedWidgetOption,QStackedWidget *stackedWidgetText){
|
||
this->stackedWidgetOption = stackedWidgetOption;// stackedWidgetOption
|
||
this->stackedWidgetText = stackedWidgetText;
|
||
connect(this->stackedWidgetOption,SIGNAL(currentChanged(int)),this,SLOT(onStackedWidgetOptionCurrentChanged(int)));
|
||
}
|
||
|
||
void SceneEditOption::bindSysPara(SysPara *sysPara){
|
||
this->sysPara = sysPara;
|
||
}
|
||
void SceneEditOption::enableButtonSave(){
|
||
if(!ui->saveButton->isEnabled())
|
||
ui->saveButton->setEnabled(true);
|
||
}
|
||
void SceneEditOption::onStackedWidgetOptionCurrentChanged(int index)
|
||
{
|
||
const QString objectName=this->stackedWidgetOption->currentWidget()->objectName();
|
||
// const QString objectName=this->stackedWidgetOption->widget(index)->objectName();
|
||
qDebug()<<"index="<<index<<", objectName="<<objectName;
|
||
if(newScene)
|
||
{
|
||
if("senceEditOption"==objectName && SCENE==sysPara->para.EditMode)
|
||
{
|
||
// qDebug()<<"显示新场景--open";
|
||
this->pPicScene->setIsdrawBackground(true);
|
||
this->stackedWidgetOption->hide();
|
||
// //show_scene_new_dlg();
|
||
// foreach (QLayout *lay, listQLayout) {
|
||
// newScene->showQLayout(lay,false);
|
||
// }
|
||
newScene->Layout_ToNew();
|
||
newScene->show();
|
||
|
||
// //edit@03-07
|
||
// for(char i=((MyView*)pViewer)->getzoomRatio();i<3;i++)
|
||
// {
|
||
// on_enlargeButton_pressed();
|
||
// }
|
||
}
|
||
else
|
||
{
|
||
// qDebug()<<"隐藏新场景--hide";
|
||
this->pPicScene->setIsdrawBackground(false);
|
||
this->stackedWidgetOption->setVisible(true);
|
||
newScene->hide();
|
||
newScene->Layout_ToDefault();
|
||
// foreach (QLayout *lay, listQLayout) {
|
||
// newScene->showQLayout(lay,true);
|
||
// }
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
void SceneEditOption::bindScene(PicScene *pPicScene, QGraphicsView *pGraphicViewer,QTextEdit *pTextEdit){
|
||
this->pPicScene = pPicScene;
|
||
this->pViewer = pGraphicViewer;
|
||
this->textEdit = pTextEdit;
|
||
//connect(pPicScene,SIGNAL(xmlContentChanged ()),this,SLOT(enableButtonSave()));
|
||
connect(pPicScene,SIGNAL(selectionChanged()),this,SLOT(enableButtonSave()));
|
||
|
||
ui->saveButton->setEnabled(false);
|
||
connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool)));
|
||
connect(dialogFileOperation,SIGNAL(createSceneImage(QString)),this,SLOT(onCreateSceneImage(QString)));
|
||
#ifdef MYSAVEFILEDLG
|
||
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)));
|
||
#endif
|
||
//edit@12-06 显示网格线
|
||
this->pPicScene->setIsdrawBackground(true);
|
||
}
|
||
|
||
void SceneEditOption::show_scene_new_dlg()
|
||
{
|
||
QWidget *tabMainWindow=this->parentWidget()->parentWidget();
|
||
|
||
if(!newScene)
|
||
{
|
||
this->stackedWidgetOption->hide();
|
||
newScene=new FormScenedlg(tabMainWindow);
|
||
newScene->setObjectName("newScene");
|
||
|
||
newScene->setAutoFillBackground(true);
|
||
newScene->setPalette(tabMainWindow->palette());
|
||
|
||
newScene->bindScene(this->pPicScene,this->pViewer,this->textEdit);
|
||
//edit@12-07另一种信号通信
|
||
connect(newScene,SIGNAL(delButton()),this,SLOT(on_delButton_pressed()));
|
||
connect(newScene,SIGNAL(saveButton()),this,SLOT(on_saveButton_pressed()));
|
||
connect(newScene,SIGNAL(openfileButton()),this,SLOT(on_openfileButton_pressed()));
|
||
connect(newScene,SIGNAL(previewButton()),this,SLOT(on_previewButton_pressed()));
|
||
//connect(newScene,SIGNAL(previewButton()),this,SIGNAL(previewScene()));
|
||
|
||
connect(newScene,SIGNAL(addButton()),this,SLOT(on_addButton_pressed()));
|
||
connect(newScene,SIGNAL(EditItemButton()),this,SLOT(on_EditItemButton_pressed()));
|
||
connect(newScene,SIGNAL(saveAsButton()),this,SLOT(on_saveAsButton_pressed()));
|
||
connect(newScene,SIGNAL(newfileButton()),this,SLOT(on_newfileButton_pressed()));
|
||
connect(newScene,SIGNAL(enlargeButton()),this,SLOT(on_enlargeButton_pressed()));
|
||
connect(newScene,SIGNAL(reduceButton()),this,SLOT(on_reduceButton_pressed()));
|
||
connect(newScene,SIGNAL(ZoomOrigin()),this,SLOT(on_test_pressed()));
|
||
connect(newScene,SIGNAL(btn_test2()),this,SLOT(on_btn_test2()));
|
||
connect(this->pPicScene,SIGNAL(showTextWidthHeight()),newScene,SLOT(reset_showTextWidthHeight()));
|
||
//connect(this->pPicScene,SIGNAL(adjustItemsPos()),newScene,SLOT(adjustItemsPosFalse()));
|
||
connect(newScene,SIGNAL(insertImage(QString,bool)),this,SLOT(insertImageItem(QString,bool)));
|
||
|
||
newScene->move(0,270);
|
||
newScene->Layout_ToNew();
|
||
}
|
||
}
|
||
|
||
void SceneEditOption::on_previewButton_pressed()
|
||
{
|
||
syncAllPositions();
|
||
this->pPicScene->setIsdrawBackground(false);
|
||
emit previewScene();
|
||
}
|
||
|
||
|
||
void SceneEditOption::on_addButton_pressed()
|
||
{
|
||
// ========== 清空编辑器内容 ==========
|
||
textEdit->clear();
|
||
textEdit->setHtml("");
|
||
|
||
// ========== 场景1:添加图元(用于显示) ==========
|
||
textItem = new PicTextItem();
|
||
QList<QGraphicsItem *> items = pPicScene->items();
|
||
if(!items.isEmpty()){
|
||
// QRectF itemRect= items.last()->boundingRect();
|
||
// textItem->setPos(items.last()->scenePos().x()+itemRect.width()+20, items.last()->scenePos().y());
|
||
QRectF itemRect= items.first()->boundingRect();
|
||
textItem->setPos(items.first()->scenePos().x()+itemRect.width()+20, items.first()->scenePos().y());
|
||
}
|
||
else textItem->setPos(this->pViewer->mapToScene(0,0));//edit@12-07
|
||
|
||
pPicScene->addItem(textItem);
|
||
pPicScene->clearSelection();
|
||
textItem->setHtml("");
|
||
textItem->setSelected(true);
|
||
|
||
// ========== 场景2:添加图元(存储真实内容) ==========
|
||
|
||
textItem2 = new PicTextItem();
|
||
textItem2->setPos(textItem->pos());
|
||
pPicScene2->addItem(textItem2);
|
||
pPicScene2->clearSelection();
|
||
textItem2->setHtml("");
|
||
textItem2->setSelected(true);
|
||
|
||
|
||
ui->saveButton->setEnabled(true);
|
||
on_EditItemButton_pressed();
|
||
}
|
||
bool SceneEditOption::maybeSave(){
|
||
|
||
if (xmlfileName.startsWith(QLatin1String(":/")))
|
||
return true;
|
||
|
||
QMessageBox msgBox(QMessageBox::Information,tr("提示"),tr("文档已经改变,是否保存?"));
|
||
QPushButton *saveButton = msgBox.addButton(tr("保存"), QMessageBox::ActionRole);
|
||
QPushButton *cancleSaveButton = msgBox.addButton(tr("放弃保存"), QMessageBox::ActionRole);
|
||
QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel);
|
||
|
||
msgBox.exec();
|
||
|
||
if (msgBox.clickedButton() == saveButton) {
|
||
on_saveButton_pressed();
|
||
return false;
|
||
} else if (msgBox.clickedButton() == cancleSaveButton) {
|
||
return true;
|
||
}
|
||
else
|
||
return false;
|
||
|
||
return true;
|
||
}
|
||
|
||
int SceneEditOption::getSelectedIndex()
|
||
{
|
||
QList<QGraphicsItem *> items = pPicScene->items();
|
||
for(int i = 0; i < items.size(); i++) {
|
||
if(items.at(i)->isSelected()) {
|
||
return i;
|
||
}
|
||
}
|
||
return -1; // 没有选中的图元
|
||
}
|
||
|
||
void SceneEditOption::syncAllPositions()
|
||
{
|
||
QList<QGraphicsItem *> items1 = pPicScene->items();
|
||
QList<QGraphicsItem *> items2 = pPicScene2->items();
|
||
|
||
int minSize = qMin(items1.size(), items2.size());
|
||
|
||
for (int i = 0; i < minSize; i++) {
|
||
QPointF pos1 = items1.at(i)->pos();
|
||
QPointF pos2 = items2.at(i)->pos();
|
||
|
||
if (pos1 != pos2) {
|
||
items2.at(i)->setPos(pos1);
|
||
}
|
||
}
|
||
|
||
}
|
||
void SceneEditOption::on_newfileButton_pressed()
|
||
{
|
||
if (maybeSave()) {
|
||
pPicScene->clear();
|
||
pViewer->viewport()->update();
|
||
unsigned char SpecialVarEnable = 0;
|
||
sysPara->devOp->fpgaWr(0xa4b0,(unsigned char *)&SpecialVarEnable,1);
|
||
xmlfileName = "";
|
||
QFile file(xmlfileName);
|
||
emit fileNameChanged(QFileInfo(xmlfileName).fileName());
|
||
//Scene Test
|
||
pPicScene2->clear();
|
||
}
|
||
#ifdef VARCOLOR
|
||
textEdit->insertHtml(QString("<span style='background:#ffffff;color=#000000;'> <span />"));
|
||
#endif
|
||
}
|
||
void SceneEditOption::on_delButton_pressed()
|
||
{
|
||
int index = getSelectedIndex(); // 获取选中图元的索引
|
||
if (index == -1) return;
|
||
|
||
QList<QGraphicsItem *> items = pPicScene->items();
|
||
if (index < items.size()) {
|
||
// 从场景1删除
|
||
QGraphicsItem *item = items.at(index);
|
||
pPicScene->removeItem(item);
|
||
delete item;
|
||
}
|
||
|
||
QList<QGraphicsItem *> htmlItems = pPicScene2->items();
|
||
if (index < htmlItems.size()) {
|
||
// 从场景2删除
|
||
QGraphicsItem *htmlItem = htmlItems.at(index);
|
||
pPicScene->removeItem(htmlItem);
|
||
delete htmlItem;
|
||
}
|
||
|
||
ui->saveButton->setEnabled(true);
|
||
}
|
||
void SceneEditOption::on_saveAsButton_pressed()
|
||
{
|
||
pPicScene->clearSelection();
|
||
#ifdef MYSAVEFILEDLG
|
||
disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0);
|
||
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)));
|
||
dialogSaveFile->refreshListView(editMode);
|
||
dialogSaveFile->show();
|
||
dialogSaveFile->setEnterFileName("");
|
||
#endif
|
||
}
|
||
void SceneEditOption::on_saveButton_pressed()
|
||
{
|
||
pPicScene->clearSelection();
|
||
if(xmlfileName.isEmpty())
|
||
{
|
||
qDebug()<<"xml file null";
|
||
#ifdef MYSAVEFILEDLG
|
||
disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0);
|
||
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)));
|
||
dialogSaveFile->refreshListView(editMode);
|
||
dialogSaveFile->show();
|
||
dialogSaveFile->setEnterFileName("");
|
||
|
||
#endif
|
||
}
|
||
else
|
||
{
|
||
pPicScene->update();
|
||
saveFile();
|
||
if(sysPara){
|
||
sysPara->sysFile =xmlfileName;
|
||
snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData());
|
||
}
|
||
//snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData());
|
||
ui->saveButton->setEnabled(false);
|
||
emit fileNameChanged(QFileInfo(xmlfileName).fileName());
|
||
}
|
||
}
|
||
|
||
void SceneEditOption::on_openfileButton_pressed()
|
||
{
|
||
pPicScene->clearSelection();
|
||
dialogFileOperation->refreshListView(editMode);
|
||
dialogFileOperation->exec();
|
||
}
|
||
|
||
void SceneEditOption::on_EditItemButton_pressed()
|
||
{
|
||
// 1. 获取选中图元的索引
|
||
int selectedIndex = getSelectedIndex();
|
||
if (selectedIndex == -1) return;
|
||
|
||
// 2. 获取两个场景的图元列表
|
||
QList<QGraphicsItem *> items = pPicScene->items();
|
||
QList<QGraphicsItem *> htmlItems = pPicScene2->items();
|
||
// 3. 边界检查:确保两个场景的图元数量匹配
|
||
if (items.size() != htmlItems.size()) {
|
||
return;
|
||
}
|
||
// 4. 检查索引是否在范围内
|
||
if (selectedIndex >= htmlItems.size() && selectedIndex >= items.size()) {
|
||
return;
|
||
}
|
||
// 5. 获取对应的图元
|
||
PicTextItem *pTextItem = qgraphicsitem_cast<PicTextItem*>(items.at(selectedIndex));
|
||
PicTextItem *pTextItem2 = qgraphicsitem_cast<PicTextItem*>(htmlItems.at(selectedIndex));
|
||
// 6. 执行编辑操作
|
||
textEdit->setHtml(pTextItem2->toHtml());
|
||
|
||
// 保持选中状态
|
||
pTextItem->setSelected(true);
|
||
pTextItem2->setSelected(true);
|
||
|
||
// 切换到textedit的界面
|
||
emit editItemMode();
|
||
stackedWidgetText->setCurrentIndex(0);
|
||
stackedWidgetOption->setCurrentIndex(0);
|
||
ui->saveButton->setEnabled(true);
|
||
|
||
}
|
||
|
||
void SceneEditOption::onEditItemDone()
|
||
{
|
||
int selectedIndex = getSelectedIndex();
|
||
if (selectedIndex == -1) return;
|
||
// ========== 只更新场景2的HTML内容 ==========
|
||
QList<QGraphicsItem *> htmlItems = pPicScene2->items();
|
||
if (selectedIndex < htmlItems.size()) {
|
||
PicTextItem *pTextItem2 = qgraphicsitem_cast<PicTextItem*>(htmlItems.at(selectedIndex));
|
||
if (pTextItem2) {
|
||
// 场景2:更新真实内容
|
||
pTextItem2->setHtml(textEdit->toHtml());
|
||
onSceneAccepted(pTextItem2);
|
||
}
|
||
}
|
||
// 场景1只需要更新显示,不需要存储完整HTML
|
||
QList<QGraphicsItem *> items = pPicScene->items();
|
||
if (selectedIndex < items.size()) {
|
||
PicTextItem *pTextItem = qgraphicsitem_cast<PicTextItem*>(items.at(selectedIndex));
|
||
if (pTextItem) {
|
||
// 场景1:只需要更新显示内容(如渲染后的图片)
|
||
// 处理图片
|
||
//创建Item的Html对应的图片
|
||
if (createItemImage()) {
|
||
QString html = "<img src=\"/home/plg/doc/scene.png\" />";
|
||
textEdit->setHtml(html);
|
||
}
|
||
else textEdit->setHtml("");
|
||
|
||
if (pPicScene->items().size() > selectedIndex) {
|
||
PicTextItem * item = (PicTextItem *)pPicScene->items().at(selectedIndex);
|
||
item->setHtml(textEdit->toHtml());
|
||
// onSceneAccepted(item);
|
||
}
|
||
}
|
||
}
|
||
|
||
// //Scene Test 储存原始html
|
||
// QList<QGraphicsItem *> picItems = pPicScene2->selectedItems();
|
||
// for(int i=0;i<picItems.size();i++)
|
||
// {
|
||
// PicTextItem *pTextItem = (PicTextItem *)picItems.at(i);
|
||
// QFont font = pTextItem->font();
|
||
// font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace);
|
||
// pTextItem->setFont(font);
|
||
// pTextItem->setHtml(textEdit->toHtml());
|
||
|
||
// //创建Item的Html对应的图片
|
||
// if (createItemImage()) {
|
||
// QString html = "<img src=\"/home/plg/doc/scene.png\" />";
|
||
// textEdit->setHtml(html);
|
||
// }
|
||
// // 场景1保存图片场景,用于放大缩小
|
||
// if (pPicScene->items().size() > i) {
|
||
// PicTextItem * item = (PicTextItem *)pPicScene->items().at(i);
|
||
// item->setHtml(textEdit->toHtml());
|
||
// onSceneAccepted(item);
|
||
// } else {
|
||
// onSceneAccepted(pTextItem);
|
||
// }
|
||
// }
|
||
|
||
stackedWidgetText->setCurrentIndex(3);
|
||
stackedWidgetOption->setCurrentIndex(1);
|
||
return;
|
||
}
|
||
|
||
void SceneEditOption::onCreateSceneImage(QString filePath)
|
||
{
|
||
m_CreateImageFlag = true;
|
||
m_pSavePicScene->clear();
|
||
onFileOpen(filePath,false);
|
||
m_pSavePicScene->clearSelection();
|
||
QSize size(m_pSavePicScene->itemsBoundingRect().width(),m_pSavePicScene->itemsBoundingRect().height());
|
||
QImage image(size,QImage::Format_ARGB32);
|
||
image.fill(0x00ffffff);//填充白色
|
||
QPainter painter(&image);
|
||
m_pSavePicScene->render(&painter,QRectF(),m_pSavePicScene->itemsBoundingRect());
|
||
image.save("./printSceneView.png");//图片
|
||
m_CreateImageFlag = false;
|
||
}
|
||
|
||
extern QStringList stringListRecive;
|
||
|
||
void SceneEditOption::parseVbfile(QXmlStreamReader &reader) {
|
||
// int textItemPosX;
|
||
// int textItemPosY;
|
||
// textItemPosX = picText->pos().x() - pPicScene->itemsBoundingRect().x();
|
||
// textItemPosY = picText->pos().y() - pPicScene->itemsBoundingRect().y();
|
||
float pos_x,pos_y;
|
||
bool Condition= false ;
|
||
int CatchStartValue = -1;
|
||
int CatchValue = -1;
|
||
while (!reader.atEnd()) {
|
||
reader.readNext();
|
||
if (reader.isStartElement()) { // 开始元素
|
||
QString strElementName = reader.name().toString();
|
||
if (QString::compare(strElementName, "VBfile") == 0) {
|
||
//qDebug() << QString::fromLocal8Bit("********** 开始元素<VBfile> ********** ");
|
||
} else if (QString::compare(strElementName, QString("pointer_x")) == 0) { // 方式一
|
||
reader.readNext();
|
||
if (reader.isCharacters()) {
|
||
pos_x = reader.text().toString().toDouble();
|
||
//qDebug() << QString("pointer_x:%1").arg(reader.text().toString());
|
||
}
|
||
} else if (QString::compare(strElementName, QString("pointer_y")) == 0) { // 方式二
|
||
pos_y = reader.readElementText().toDouble();
|
||
//qDebug() << QString("pointer_y:%1").arg(reader.readElementText());
|
||
}
|
||
else if (QString::compare(strElementName, QString("Condition")) == 0) {
|
||
Condition = reader.readElementText().toInt() ? true : false;
|
||
}
|
||
else if (QString::compare(strElementName, QString("CatchStartValue")) == 0) {
|
||
CatchStartValue = reader.readElementText().toInt();
|
||
}
|
||
else if (QString::compare(strElementName, QString("CatchValue")) == 0) {
|
||
CatchValue = reader.readElementText().toInt();
|
||
}
|
||
else if (QString::compare(strElementName, QString("html_src")) == 0) {
|
||
//qDebug() << QString("html_src:%1").arg(reader.readElementText());
|
||
}
|
||
} else if (reader.isEntityReference()) { // 实体引用
|
||
QString strName = reader.name().toString();
|
||
QString strText = reader.text().toString();
|
||
//qDebug() << QString("EntityReference : %1(%2)").arg(strName).arg(strText);
|
||
} else if (reader.isCDATA()) { // CDATA
|
||
QString strCDATA = reader.text().toString();
|
||
//qDebug() << QString("CDATA : %1").arg(strCDATA);
|
||
PicTextItem *pPictText = new PicTextItem();
|
||
if(m_CreateImageFlag)
|
||
{
|
||
m_pSavePicScene->addItem(pPictText);
|
||
}
|
||
else
|
||
{
|
||
pPicScene->addItem(pPictText);
|
||
}
|
||
QFont font = pPictText->font();
|
||
font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace);
|
||
pPictText->setFont(font);
|
||
pPictText->setPos(pos_x,pos_y);
|
||
pPictText->SpecialConditions = Condition;
|
||
pPictText->CatchCnt1StartValue = CatchStartValue;
|
||
pPictText->CatchCnt1CurrValue = CatchValue;
|
||
// Condition= false ;
|
||
// CatchValue = -1;
|
||
//LogInfo::setRunStatusText(tr("接收文件解析::2"));
|
||
if(!sysPara->status.forTemplateUse || m_CreateImageFlag)
|
||
{
|
||
pPictText->setHtml(strCDATA);
|
||
}
|
||
else
|
||
{
|
||
//qDebug() << tr("接收文件解析:");
|
||
//LogInfo::setRunStatusText(tr("接收文件解析::3"));
|
||
//stringListRecive << "aaaa" << "bbbb" << "cccc";
|
||
if(strCDATA.contains("#1111") || strCDATA.contains("<img src=\"/home/plg/doc/modbusQR#01.bmp\" />"))
|
||
{
|
||
if(stringListRecive.size() > 0)
|
||
{
|
||
if(strCDATA.contains("#1111"))
|
||
{
|
||
strCDATA.replace("#1111",stringListRecive.at(0).toStdString().c_str());
|
||
}
|
||
else if(strCDATA.contains("<img src=\"/home/plg/doc/modbusQR#01.bmp\" />"))
|
||
{
|
||
emit generateQRCode(stringListRecive.at(0));
|
||
strCDATA.replace("modbusQR#01.bmp","modbusQR.bmp");
|
||
}
|
||
}
|
||
|
||
}
|
||
else if(strCDATA.contains("#2222") || strCDATA.contains("<img src=\"/home/plg/doc/modbusQR#02.bmp\" />"))
|
||
{
|
||
if(stringListRecive.size() > 1)
|
||
{
|
||
if(strCDATA.contains("#2222"))
|
||
{
|
||
strCDATA.replace("#2222",stringListRecive.at(1).toStdString().c_str());
|
||
}
|
||
else if(strCDATA.contains("<img src=\"/home/plg/doc/modbusQR#02.bmp\" />"))
|
||
{
|
||
emit generateQRCode(stringListRecive.at(1));
|
||
strCDATA.replace("modbusQR#02.bmp","modbusQR.bmp");
|
||
}
|
||
}
|
||
}
|
||
else if(strCDATA.contains("#3333") || strCDATA.contains("<img src=\"/home/plg/doc/modbusQR#03.bmp\" />"))
|
||
{
|
||
if(stringListRecive.size() > 2)
|
||
{
|
||
if(strCDATA.contains("#3333"))
|
||
{
|
||
strCDATA.replace("#3333",stringListRecive.at(2).toStdString().c_str());
|
||
}
|
||
else if(strCDATA.contains("<img src=\"/home/plg/doc/modbusQR#03.bmp\" />"))
|
||
{
|
||
emit generateQRCode(stringListRecive.at(2));
|
||
strCDATA.replace("modbusQR#03.bmp","modbusQR.bmp");
|
||
}
|
||
}
|
||
}
|
||
pPictText->setHtml(strCDATA);
|
||
}
|
||
// if(Condition)
|
||
// {
|
||
// SpecialVarPrint specialVarPrint;
|
||
// specialVarPrint.SpecialVarEnable = Condition;
|
||
// specialVarPrint.SpecialVarCountStart = CatchStartValue;
|
||
// specialVarPrint.SpecialVarCountEnd = CatchValue;
|
||
// specialVarPrint.SpecialVarColStart = 3 + pos_x- pPicScene->itemsBoundingRect().x();
|
||
// specialVarPrint.SpecialVarColEnd = 3 + pos_x - pPicScene->itemsBoundingRect().x()+ pPictText->boundingRect().width();
|
||
// specialVarPrint.SpecialVarRowStart = pos_y - pPicScene->itemsBoundingRect().y();
|
||
// specialVarPrint.SpecialVarRowEnd = pos_y - pPicScene->itemsBoundingRect().y()+ pPictText->boundingRect().height();
|
||
// sysPara->devOp->fpgaWr(0xa4b0,(unsigned char *)&specialVarPrint,sizeof(SpecialVarPrint)); // Send specialVarPrint 2022-8-6
|
||
// LogInfo::setRunStatusText(tr("发送特殊变量内容:"));
|
||
// LogInfo::setRunStatusText(tr("SpecialVarEnable:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarEnable)));
|
||
// LogInfo::setRunStatusText(tr("SpecialVarCountStart:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarCountStart)));
|
||
// LogInfo::setRunStatusText(tr("SpecialVarCountEnd:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarCountEnd)));
|
||
// LogInfo::setRunStatusText(tr("SpecialVarColStart:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarColStart)));
|
||
// LogInfo::setRunStatusText(tr("SpecialVarColEnd:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarColEnd)));
|
||
// LogInfo::setRunStatusText(tr("SpecialVarRowStart:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarRowStart)));
|
||
// LogInfo::setRunStatusText(tr("SpecialVarRowEnd:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarRowEnd)));
|
||
// LogInfo::setRunStatusText(tr("itemsBoundingRect().y():%1").arg(QString().sprintf("%02X",pPicScene->itemsBoundingRect().y())));
|
||
// LogInfo::setRunStatusText(tr("itemsBoundingRect().x():%1").arg(QString().sprintf("%02X",pPicScene->itemsBoundingRect().x())));
|
||
// }
|
||
Condition= false ;
|
||
CatchValue = -1;
|
||
CatchStartValue = -1;
|
||
|
||
reader.readNext();
|
||
if (reader.isCharacters()) {
|
||
QString strCharacters = reader.text().toString();
|
||
//qDebug() << QString("Characters : %1").arg(strCharacters);
|
||
}
|
||
} else if (reader.isEndElement()) { // 结束元素
|
||
QString strElementName = reader.name().toString();
|
||
if (QString::compare(strElementName, "Blogs") == 0) {
|
||
//qDebug() << QString::fromLocal8Bit("********** 结束元素<Blogs> ********** ");
|
||
break; // 跳出循环(解析 QXmlStreamReader::EndDocument)
|
||
} else if (QString::compare(strElementName, "Blog") == 0) {
|
||
//qDebug() << QString::fromLocal8Bit("********** 结束元素<Blog> ********** ");
|
||
}
|
||
}
|
||
}
|
||
}
|
||
/*
|
||
* 和DialogFileOperation对接
|
||
* */
|
||
void SceneEditOption::onFileOpen(QString filePath,bool insertFlag){
|
||
if(editMode==SCENE) {
|
||
if(filePath.endsWith(".xml"))
|
||
{
|
||
QFile file(filePath);
|
||
|
||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { // 以只写模式打开文件
|
||
xmlfileName=filePath;
|
||
QXmlStreamReader reader(&file);
|
||
if(!m_CreateImageFlag)
|
||
{
|
||
pPicScene->clear();
|
||
pViewer->viewport()->update();
|
||
unsigned char SpecialVarEnable = 0;
|
||
sysPara->devOp->fpgaWr(0xa4b0,(unsigned char *)&SpecialVarEnable,1);
|
||
}
|
||
// 解析 XML,直到结束
|
||
while (!reader.atEnd()) {
|
||
|
||
// 读取下一个元素
|
||
QXmlStreamReader::TokenType nType = reader.readNext();
|
||
|
||
switch (nType) {
|
||
case QXmlStreamReader::StartDocument: { // 开始文档
|
||
//qDebug() << QString::fromLocal8Bit("********** 开始文档(XML 声明) ********** ");
|
||
// XML 声明
|
||
QString strVersion = reader.documentVersion().toString();
|
||
QString strEncoding = reader.documentEncoding().toString();
|
||
bool bAlone = reader.isStandaloneDocument();
|
||
//qDebug() << QString::fromLocal8Bit("版本:%1 编码:%2 Standalone:%3")
|
||
// .arg(strVersion).arg(strEncoding).arg(bAlone) << "\r\n";
|
||
break;
|
||
}
|
||
case QXmlStreamReader::Comment: { // 注释
|
||
//qDebug() << QString::fromLocal8Bit("********** 注释 ********** ");
|
||
QString strComment = reader.text().toString();
|
||
//qDebug() << strComment << "\r\n";
|
||
break;
|
||
}
|
||
case QXmlStreamReader::ProcessingInstruction: { // 处理指令
|
||
//qDebug() << QString::fromLocal8Bit("********** 处理指令 ********** ");
|
||
QString strProcInstr = reader.processingInstructionData().toString();
|
||
//qDebug() << strProcInstr << "\r\n";
|
||
break;
|
||
}
|
||
case QXmlStreamReader::DTD: { // DTD
|
||
//qDebug() << QString::fromLocal8Bit("********** DTD ********** ");
|
||
QString strDTD = reader.text().toString();
|
||
QXmlStreamNotationDeclarations notationDeclarations = reader.notationDeclarations(); // 符号声明
|
||
QXmlStreamEntityDeclarations entityDeclarations = reader.entityDeclarations(); // 实体声明
|
||
// DTD 声明
|
||
QString strDTDName = reader.dtdName().toString();
|
||
QString strDTDPublicId = reader.dtdPublicId().toString(); // DTD 公开标识符
|
||
QString strDTDSystemId = reader.dtdSystemId().toString(); // DTD 系统标识符
|
||
//qDebug() << QString::fromLocal8Bit("DTD : %1").arg(strDTD);
|
||
//qDebug() << QString::fromLocal8Bit("DTD 名称 : %1").arg(strDTDName);
|
||
//qDebug() << QString::fromLocal8Bit("DTD 公开标识符 : %1").arg(strDTDPublicId);
|
||
//qDebug() << QString::fromLocal8Bit("DTD 系统标识符 : %1").arg(strDTDSystemId);
|
||
//qDebug() << "\r\n";
|
||
|
||
break;
|
||
}
|
||
case QXmlStreamReader::StartElement: { // 开始元素
|
||
QString strElementName = reader.name().toString();
|
||
if (QString::compare(strElementName, "VBfiles") == 0) { // 根元素
|
||
//qDebug() << QString::fromLocal8Bit("********** 开始元素<VBfiles> ********** ");
|
||
QXmlStreamAttributes attributes = reader.attributes();
|
||
if (attributes.hasAttribute("Version")) {
|
||
QString strVersion = attributes.value("Version").toString();
|
||
//qDebug() << QString::fromLocal8Bit("属性:Version(%1)").arg(strVersion);
|
||
}
|
||
|
||
parseVbfile(reader);
|
||
}
|
||
break;
|
||
}
|
||
case QXmlStreamReader::EndDocument: { // 结束文档
|
||
//qDebug() << QString::fromLocal8Bit("********** 结束文档 ********** ");
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (reader.hasError()) { // 解析出错
|
||
//qDebug() << QString::fromLocal8Bit("错误信息:%1 行号:%2 列号:%3 字符位移:%4").arg(reader.errorString()).arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.characterOffset());
|
||
}
|
||
//qDebug()<<"open done";
|
||
file.close(); // 关闭文件
|
||
//snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",filePath.toLatin1().constData());
|
||
if(!m_CreateImageFlag)//生成图片显示
|
||
{
|
||
if(sysPara)
|
||
{
|
||
sysPara->sysFile =filePath;
|
||
sysPara->loadParaFromFile();
|
||
//qDebug()<<"textedit txt mode onFileOpen" << sysPara->sysFile;
|
||
snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",filePath.toLatin1().constData());
|
||
}
|
||
|
||
emit fileNameChanged(QFileInfo(xmlfileName).fileName());
|
||
ui->saveButton->setEnabled(false);
|
||
QList<QGraphicsItem *> items = pPicScene->items();
|
||
foreach (QGraphicsItem *item, items) {
|
||
PicTextItem *picText = qgraphicsitem_cast<PicTextItem*>(item);
|
||
onSceneAccepted(picText);
|
||
}
|
||
|
||
//Scene Test
|
||
updatePicScene2Item();
|
||
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
}
|
||
void SceneEditOption::saveFile(){
|
||
QFile file(xmlfileName);
|
||
if (!file.open(QFile::WriteOnly | QFile::Text)) { // 只写模式打开文件
|
||
qDebug() << QString("Cannot write file %1(%2).").arg(xmlfileName).arg(file.errorString());
|
||
return;
|
||
}
|
||
QXmlStreamWriter writer(&file);
|
||
writer.setAutoFormatting(true); // 自动格式化
|
||
writer.writeStartDocument("1.0", true); // 开始文档(XML 声明)
|
||
writer.writeComment(QString::fromLocal8Bit("Vernon Bach graphic scene file")); // 注释
|
||
writer.writeDTD(QString::fromLocal8Bit("<!DOCTYPE VBfiles [ <!ELEMENT VBfiles (VBfile) > <!ELEMENT VBfile (pointer_x,pointer_y,html_src)> <!ELEMENT pointer_x (#PCDATA)><!ELEMENT pointer_y (#PCDATA)><!ELEMENT html_src (#PCDATA)> ]>"));
|
||
writer.writeStartElement("VBfiles"); // 开始根元素 <picscene>
|
||
writer.writeAttribute("Version", "1.0"); // 属性
|
||
|
||
QList<QGraphicsItem *> items = pPicScene->items();
|
||
//Scene Test pPicScene2保存的是html pPicScene保存的是图片
|
||
QList<QGraphicsItem *> items2 = pPicScene2->items();
|
||
// std::cout<<"save pPicScene2 size:"<<pPicScene2->items().size()<<std::endl;
|
||
int index=0;
|
||
foreach (QGraphicsItem *item, items) {
|
||
PicTextItem *picText = qgraphicsitem_cast<PicTextItem*>(item);
|
||
writer.writeStartElement("VBfile"); // 开始子元素 <picscene>
|
||
writer.writeTextElement(QString::fromLocal8Bit("pointer_x"), QString::fromLocal8Bit("%1").arg(picText->pos().x()));
|
||
writer.writeTextElement(QString::fromLocal8Bit("pointer_y"), QString::fromLocal8Bit("%1").arg(picText->pos().y()));
|
||
writer.writeTextElement(QString::fromLocal8Bit("Condition"), QString::fromLocal8Bit("%1").arg(picText->SpecialConditions? 1:0));
|
||
writer.writeTextElement(QString::fromLocal8Bit("CatchStartValue"), QString::fromLocal8Bit("%1").arg(picText->CatchCnt1StartValue));
|
||
writer.writeTextElement(QString::fromLocal8Bit("CatchValue"), QString::fromLocal8Bit("%1").arg(picText->CatchCnt1CurrValue));
|
||
writer.writeTextElement(QString::fromLocal8Bit("html_src"), QString::fromLocal8Bit("my_src"));
|
||
|
||
//Scene Test 内容用pPicScene2 Item的html 其他的位置信息用pPicScene Item
|
||
if(index<items.size()){
|
||
PicTextItem *picText2 = (PicTextItem *)items2.at(index);
|
||
writer.writeCDATA((picText2->toHtml()));
|
||
}
|
||
index++;
|
||
|
||
// writer.writeCDATA((picText->toHtml()));
|
||
writer.writeEndElement(); // 结束子元素 </picscene>
|
||
}
|
||
writer.writeEndElement(); // 结束根元素 </picscenes>
|
||
writer.writeEndDocument(); // 结束文档
|
||
fsync(file.handle());
|
||
file.close(); // 关闭文件
|
||
}
|
||
|
||
void SceneEditOption::onSaveASFile(QString filename,bool Flag){// use for dialogSaveFile class
|
||
qDebug()<<filename;
|
||
xmlfileName = filename;
|
||
if(!filename.endsWith(".xml",Qt::CaseInsensitive))
|
||
xmlfileName += ".xml";
|
||
|
||
saveFile();
|
||
if(sysPara){
|
||
sysPara->sysFile =xmlfileName;
|
||
snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData());
|
||
}
|
||
//snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData());
|
||
ui->saveButton->setEnabled(false);
|
||
emit fileNameChanged(QFileInfo(xmlfileName).fileName());
|
||
}
|
||
void SceneEditOption::on_enlargeButton_pressed()
|
||
{
|
||
((MyView*)pViewer)->ZoomOut();
|
||
}
|
||
void SceneEditOption::on_reduceButton_pressed()
|
||
{
|
||
((MyView*)pViewer)->ZoomIn();
|
||
}
|
||
|
||
void SceneEditOption::onSceneAccepted(PicTextItem *pTextItem){
|
||
for(QTextBlock textBlock = pTextItem->document()->begin();textBlock != pTextItem->document()->end(); textBlock = textBlock.next()){
|
||
QTextBlockFormat textBlockFormat = textBlock.blockFormat();
|
||
textBlockFormat.setAlignment(Qt::AlignTop);
|
||
textBlockFormat.setTopMargin(-1);
|
||
textBlockFormat.setBottomMargin(sysPara->para.textEditLineSpace-1);
|
||
QTextCursor textCursor = pTextItem->textCursor();
|
||
textCursor.setPosition(textBlock.position());
|
||
textCursor.setBlockFormat(textBlockFormat);
|
||
pTextItem->setTextCursor(textCursor);
|
||
}
|
||
|
||
QFont font = pTextItem->font();
|
||
font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace);
|
||
pTextItem->setFont(font);
|
||
|
||
sysPara->saveParaToFile();
|
||
}
|
||
|
||
//edit@12-10
|
||
void SceneEditOption::on_test_pressed()
|
||
{
|
||
const QPoint originScene=pViewer->mapFromScene(0,0);
|
||
const QRectF sceneRect=pPicScene->sceneRect();
|
||
const QRectF BoundingRect=pPicScene->itemsBoundingRect();
|
||
qDebug()<<QString("originScene=(%1,%2)").arg(originScene.x()).arg(originScene.y())<<",sceneRect="<<sceneRect<<",BoundingRect="<<BoundingRect;
|
||
qDebug()<<"pViewer-geometry="<<pViewer->geometry();
|
||
qreal bottom=0;
|
||
bool isTextItem=true;
|
||
foreach (const QGraphicsItem *item, pPicScene->items()) {
|
||
if(item->sceneBoundingRect().bottom()>bottom)
|
||
{
|
||
bottom=item->sceneBoundingRect().bottom();
|
||
isTextItem=-1==((QGraphicsTextItem*)item)->toHtml().indexOf("img ",0,Qt::CaseInsensitive)?true:false;
|
||
}
|
||
qDebug()<<"item-pos="<<item->pos()
|
||
<<", isSelected="<<item->isSelected()
|
||
<<", text="<<((QGraphicsTextItem*)item)->toPlainText()
|
||
//<<", html="<<((QGraphicsTextItem*)item)->toHtml()
|
||
<<", type="<<(-1==((QGraphicsTextItem*)item)->toHtml().indexOf("img ",0,Qt::CaseInsensitive)?true:false)
|
||
<<", button-pos="<<item->sceneBoundingRect().bottom()
|
||
;
|
||
}
|
||
qDebug()<<"bottom="<<bottom<<", isTextItem="<<isTextItem;
|
||
|
||
//int value=pViewer->horizontalScrollBar()->value();
|
||
//qDebug()<<"pViewer-horizontalScrollBar-value="<<value;
|
||
|
||
pPicScene->update();
|
||
pViewer->update();
|
||
}
|
||
//edit@12-10
|
||
void SceneEditOption::on_btn_test2()
|
||
{
|
||
const QPoint originScene=pViewer->mapFromScene(0,0);
|
||
QRectF sceneRect=pPicScene->sceneRect();
|
||
|
||
qreal left=sceneRect.width(),top=sceneRect.width();
|
||
foreach (const QGraphicsItem *item, pPicScene->items()) {
|
||
left=qMin(left,item->pos().x());
|
||
top=qMin(top,item->pos().y());
|
||
}
|
||
|
||
foreach (QGraphicsItem *item, pPicScene->items()) {
|
||
QPointF oldpos=item->pos();
|
||
//oldpos=pViewer->mapToScene(oldpos.x()-left,oldpos.y()-top);
|
||
oldpos=QPointF(oldpos.x()-left,oldpos.y()-(top-pViewer->mapToScene(0,0).y()));
|
||
item->setPos(oldpos);
|
||
}
|
||
pPicScene->update();
|
||
}
|
||
|
||
void SceneEditOption::onInkJetPrinterCurrentChanged(int index)
|
||
{
|
||
if(SCENE==sysPara->para.EditMode)
|
||
{
|
||
if(0==index)//edit@12-14 mainwindow tab
|
||
{
|
||
onStackedWidgetOptionCurrentChanged(1);
|
||
}
|
||
else //edit@12-14 other tabs
|
||
{
|
||
onStackedWidgetOptionCurrentChanged(0);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
bool SceneEditOption::createItemImage(){
|
||
QSize docSize = textEdit->document()->size().toSize();
|
||
QImage image(docSize,QImage::Format_ARGB32);
|
||
// image.fill(0x00ffffff);//填充白色
|
||
image.fill(Qt::transparent);
|
||
QPainter painter(&image);
|
||
textEdit->document()->drawContents (&painter, image.rect()); /*将text写到pic*/
|
||
bool res = image.save("/home/plg/doc/scene.png");
|
||
return res;
|
||
}
|
||
|
||
|
||
void SceneEditOption::updatePicScene2Item(){
|
||
|
||
pPicScene2->clear();
|
||
QList<QGraphicsItem *> items = pPicScene->items();
|
||
for(int i=0;i<items.size();i++){
|
||
textItem2 = new PicTextItem();
|
||
pPicScene2->addItem(textItem2);
|
||
textItem2->setPlainText("");
|
||
}
|
||
// 重新复制所有 items
|
||
for(int i=0;i<items.size();i++){
|
||
PicTextItem *pTextItem = (PicTextItem *)items.at(i);
|
||
PicTextItem *pTextItem2 = (PicTextItem *)pPicScene2->items().at(i);
|
||
pTextItem2->setHtml(pTextItem->toHtml());
|
||
pTextItem2->setPos(pTextItem->pos());
|
||
textEdit->setHtml(pTextItem->toHtml());
|
||
if(!pTextItem->toHtml().contains("<img src=")){
|
||
//创建Item的Html对应的图片
|
||
if (createItemImage()) {
|
||
QString html = "<img src=\"/home/plg/doc/scene.png\" />";
|
||
textEdit->setHtml(html);
|
||
}
|
||
else textEdit->setHtml("");
|
||
}
|
||
pTextItem->setHtml(textEdit->toHtml());
|
||
}
|
||
|
||
}
|
||
|
||
QList<QGraphicsItem *> SceneEditOption::getPicSceneItems()
|
||
{
|
||
return pPicScene2->items();
|
||
}
|
||
|
||
//Scene Test
|
||
void SceneEditOption::insertImageItem(QString filePath,bool){
|
||
|
||
pPicScene->clearSelection();
|
||
QString html = "<img src='" + filePath + "'/>";
|
||
textEdit->setHtml (html);
|
||
textItem = new PicTextItem();
|
||
pPicScene->addItem(textItem);
|
||
|
||
pPicScene2->clearSelection();
|
||
textItem2 = new PicTextItem();
|
||
pPicScene2->addItem(textItem2);
|
||
textItem2->setHtml(textEdit->toHtml());
|
||
|
||
QList<QGraphicsItem *> items = pPicScene->items();
|
||
if(pPicScene->items().count()>1){
|
||
QRectF itemRect= items.at(1)->boundingRect();
|
||
textItem->setPos( items.at(1)->scenePos().x()+itemRect.width()+20, items.at(1)->scenePos().y());
|
||
}
|
||
else textItem->setPos(this->pViewer->mapToScene(0,0));//edit@12-07
|
||
textItem->setSelected(true);
|
||
textItem->setHtml(textEdit->toHtml());
|
||
|
||
}
|