0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-09-23 08:29:07 +03:00

support of Qt6

This commit is contained in:
Alexander Arin
2021-11-02 22:30:29 +03:00
parent 1c81196db2
commit 8efb6792a3
21 changed files with 338 additions and 98 deletions

View File

@@ -63,7 +63,11 @@ void FontEditorWidget::initEditor()
m_fontSizeEditor = new QComboBox(this);
m_fontSizeEditor->setModel(&m_fontSizeModel);
m_fontSizeEditor->setEditable(true);
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3)
connect(m_fontSizeEditor,SIGNAL(currentTextChanged(QString)),this,SLOT(slotFontSizeChanged(QString)));
#else
connect(m_fontSizeEditor,SIGNAL(currentIndexChanged(QString)),this,SLOT(slotFontSizeChanged(QString)));
#endif
addWidget(m_fontSizeEditor);
addSeparator();

View File

@@ -110,7 +110,7 @@ void HtmlContext::parseSymbs(QString text)
text.remove(pos,rx.matchedLength());
}
foreach(QString pattern,m_symbPatterns){
foreach(QString pattern, m_symbPatterns){
rx.setPattern(pattern);
while (text.contains(rx)){
int pos=rx.indexIn(text);
@@ -120,6 +120,13 @@ void HtmlContext::parseSymbs(QString text)
}
#else
QRegularExpression rx("<[^<]*>");
while (text.contains(rx)){
int pos=text.indexOf(rx); //rx.indexIn(text);
if (rx.cap().compare("<br>",Qt::CaseInsensitive)==0)
m_symbs.append(new Symb(rx.cap(),pos));
text.remove(pos,rx.matchedLength());
}
// TODO: Qt6 port
#endif
}
@@ -191,43 +198,43 @@ bool HtmlContext::isVectorEqual(QVector<Tag *> source, QVector<Tag *> dest)
return true;
}
QString HtmlContext::extendTextByTags(QString text, int pos)
{
QString curText="";
QVector<Tag*> curTags=tagsAt(pos);
for(int i=0;i<curTags.count();i++){
curText+='<'+curTags.at(i)->tagText()+'>';
}
//QString HtmlContext::extendTextByTags(QString text, int pos)
//{
// QString curText="";
// QVector<Tag*> curTags=tagsAt(pos);
// for(int i=0;i<curTags.count();i++){
// curText+='<'+curTags.at(i)->tagText()+'>';
// }
for(int i=0;i<text.length();i++,pos++){
QVector<Tag*> tagsAtPos=tagsAt(pos);
if (!HtmlContext::isVectorEqual(curTags,tagsAtPos)){
QVector<TagDiff> diffs=HtmlContext::tagVectDiff(curTags,tagsAtPos);
foreach(TagDiff diff,diffs){
if (diff.direction==TagDiff::Inner){
curText+='<'+diff.tag->tagText()+'>';
curTags.append(diff.tag);
}
else{
curText+="</"+HtmlContext::extractWord(diff.tag->tagText(),1)+'>';
curTags.remove(curTags.indexOf(diff.tag));
}
}
}
Symb s=symbAt(pos);
if (s.isValid()){
if (s.isTag()) curText+=s.text()+text.at(i);
else curText+=s.text();
} else curText+=text.at(i);
}
// for(int i=0;i<text.length();i++,pos++){
// QVector<Tag*> tagsAtPos=tagsAt(pos);
// if (!HtmlContext::isVectorEqual(curTags,tagsAtPos)){
// QVector<TagDiff> diffs=HtmlContext::tagVectDiff(curTags,tagsAtPos);
// foreach(TagDiff diff,diffs){
// if (diff.direction==TagDiff::Inner){
// curText+='<'+diff.tag->tagText()+'>';
// curTags.append(diff.tag);
// }
// else{
// curText+="</"+HtmlContext::extractWord(diff.tag->tagText(),1)+'>';
// curTags.remove(curTags.indexOf(diff.tag));
// }
// }
// }
// Symb s=symbAt(pos);
// if (s.isValid()){
// if (s.isTag()) curText+=s.text()+text.at(i);
// else curText+=s.text();
// } else curText+=text.at(i);
// }
curTags=tagsAt(pos);
for(int i=0;i<curTags.count();i++){
curText+="</"+HtmlContext::extractWord(curTags.at(i)->tagText(),1)+'>';
}
// curTags=tagsAt(pos);
// for(int i=0;i<curTags.count();i++){
// curText+="</"+HtmlContext::extractWord(curTags.at(i)->tagText(),1)+'>';
// }
return curText;
}
// return curText;
//}
QVector<Tag *> HtmlContext::tagsAt(int pos)
{

View File

@@ -82,7 +82,7 @@ public:
static QVector<TagDiff> tagVectDiff(QVector<Tag*> source, QVector<Tag*> dest);
static bool isVectorEqual(QVector<Tag*> source, QVector<Tag*> dest);
void fillTagVector(QString html);
QString extendTextByTags(QString text, int pos);
//QString extendTextByTags(QString text, int pos);
QVector<Tag *> tagsAt(int pos);
Symb symbAt(int pos);
void clearTags();

View File

@@ -360,10 +360,13 @@ void TextItem::updateLayout()
bool TextItem::isNeedExpandContent() const
{
bool result = false;
#if QT_VERSION < 0x060000
QRegExp rx("$*\\{[^{]*\\}");
#else
QRegularExpression rx("$*\\{[^{]*\\}");
QRegularExpression rx("\\$*\\{[^{]*\\}");
result = content().contains(rx) || isContentBackedUp();
return result;
#endif
return content().contains(rx) || isContentBackedUp();
}

View File

@@ -88,9 +88,6 @@
<property name="text">
<string>Cancel</string>
</property>
<property name="shortcut">
<string>Esc</string>
</property>
</widget>
</item>
</layout>