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:
@@ -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();
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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();
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -88,9 +88,6 @@
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Esc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
Reference in New Issue
Block a user