Get rid of qtextitemint.cpp
All the variables are public, so there's no need to use non-exported constructor
This commit is contained in:
parent
a78089716b
commit
060eb63ce8
3 changed files with 33 additions and 57 deletions
|
|
@ -262,10 +262,6 @@ PRIVATE
|
||||||
emoji_suggestions/emoji_suggestions_helper.h
|
emoji_suggestions/emoji_suggestions_helper.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if (DESKTOP_APP_USE_PACKAGED)
|
|
||||||
nice_target_sources(lib_ui ${src_loc} PRIVATE ui/text/qtextitemint.cpp)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT DESKTOP_APP_USE_PACKAGED_FONTS)
|
if (NOT DESKTOP_APP_USE_PACKAGED_FONTS)
|
||||||
nice_target_sources(lib_ui ${src_loc} PRIVATE fonts/fonts.qrc)
|
nice_target_sources(lib_ui ${src_loc} PRIVATE fonts/fonts.qrc)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
// This file is part of Desktop App Toolkit,
|
|
||||||
// a set of libraries for developing nice desktop applications.
|
|
||||||
//
|
|
||||||
// For license and copyright information please follow this link:
|
|
||||||
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
|
||||||
//
|
|
||||||
#include <private/qtextengine_p.h>
|
|
||||||
|
|
||||||
QTextItemInt::QTextItemInt(
|
|
||||||
const QGlyphLayout &g,
|
|
||||||
QFont *font,
|
|
||||||
const QChar *chars_,
|
|
||||||
int numChars,
|
|
||||||
QFontEngine *fe,
|
|
||||||
const QTextCharFormat &format)
|
|
||||||
: charFormat(format)
|
|
||||||
, num_chars(numChars)
|
|
||||||
, chars(chars_)
|
|
||||||
, f(font)
|
|
||||||
, glyphs(g)
|
|
||||||
, fontEngine(fe) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void QTextItemInt::initWithScriptItem(const QScriptItem &si) {
|
|
||||||
// explicitly initialize flags so that initFontAttributes can be called
|
|
||||||
// multiple times on the same TextItem
|
|
||||||
flags = { };
|
|
||||||
if (si.analysis.bidiLevel %2)
|
|
||||||
flags |= QTextItem::RightToLeft;
|
|
||||||
ascent = si.ascent;
|
|
||||||
descent = si.descent;
|
|
||||||
|
|
||||||
if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) {
|
|
||||||
underlineStyle = charFormat.underlineStyle();
|
|
||||||
} else if (charFormat.boolProperty(QTextFormat::FontUnderline)
|
|
||||||
|| f->d->underline) {
|
|
||||||
underlineStyle = QTextCharFormat::SingleUnderline;
|
|
||||||
}
|
|
||||||
|
|
||||||
// compat
|
|
||||||
if (underlineStyle == QTextCharFormat::SingleUnderline)
|
|
||||||
flags |= QTextItem::Underline;
|
|
||||||
|
|
||||||
if (f->d->overline || charFormat.fontOverline())
|
|
||||||
flags |= QTextItem::Overline;
|
|
||||||
if (f->d->strikeOut || charFormat.fontStrikeOut())
|
|
||||||
flags |= QTextItem::StrikeOut;
|
|
||||||
}
|
|
||||||
|
|
@ -142,6 +142,32 @@ bool IsBad(QChar ch) {
|
||||||
|| (Platform::IsMac() && ch == 6158);
|
|| (Platform::IsMac() && ch == 6158);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InitTextItemWithScriptItem(QTextItemInt &ti, const QScriptItem &si) {
|
||||||
|
// explicitly initialize flags so that initFontAttributes can be called
|
||||||
|
// multiple times on the same TextItem
|
||||||
|
ti.flags = { };
|
||||||
|
if (si.analysis.bidiLevel %2)
|
||||||
|
ti.flags |= QTextItem::RightToLeft;
|
||||||
|
ti.ascent = si.ascent;
|
||||||
|
ti.descent = si.descent;
|
||||||
|
|
||||||
|
if (ti.charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) {
|
||||||
|
ti.underlineStyle = ti.charFormat.underlineStyle();
|
||||||
|
} else if (ti.charFormat.boolProperty(QTextFormat::FontUnderline)
|
||||||
|
|| ti.f->underline()) {
|
||||||
|
ti.underlineStyle = QTextCharFormat::SingleUnderline;
|
||||||
|
}
|
||||||
|
|
||||||
|
// compat
|
||||||
|
if (ti.underlineStyle == QTextCharFormat::SingleUnderline)
|
||||||
|
ti.flags |= QTextItem::Underline;
|
||||||
|
|
||||||
|
if (ti.f->overline() || ti.charFormat.fontOverline())
|
||||||
|
ti.flags |= QTextItem::Overline;
|
||||||
|
if (ti.f->strikeOut() || ti.charFormat.fontStrikeOut())
|
||||||
|
ti.flags |= QTextItem::StrikeOut;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace Text
|
} // namespace Text
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
@ -1706,14 +1732,16 @@ private:
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (_p) {
|
} else if (_p) {
|
||||||
QTextCharFormat format;
|
QTextItemInt gf;
|
||||||
QTextItemInt gf(glyphs.mid(glyphsStart, glyphsEnd - glyphsStart),
|
gf.glyphs = glyphs.mid(glyphsStart, glyphsEnd - glyphsStart);
|
||||||
&_e->fnt, engine.layoutData->string.unicode() + itemStart,
|
gf.f = &_e->fnt;
|
||||||
itemEnd - itemStart, engine.fontEngine(si), format);
|
gf.chars = engine.layoutData->string.unicode() + itemStart;
|
||||||
|
gf.num_chars = itemEnd - itemStart;
|
||||||
|
gf.fontEngine = engine.fontEngine(si);
|
||||||
gf.logClusters = logClusters + itemStart - si.position;
|
gf.logClusters = logClusters + itemStart - si.position;
|
||||||
gf.width = itemWidth;
|
gf.width = itemWidth;
|
||||||
gf.justified = false;
|
gf.justified = false;
|
||||||
gf.initWithScriptItem(si);
|
InitTextItemWithScriptItem(gf, si);
|
||||||
|
|
||||||
auto hasSelected = false;
|
auto hasSelected = false;
|
||||||
auto hasNotSelected = true;
|
auto hasNotSelected = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue