Merge branch 'FreeCAD:master' into master

This commit is contained in:
mosfet80
2023-02-23 14:00:58 +01:00
committed by GitHub
2 changed files with 10 additions and 5 deletions

View File

@@ -820,9 +820,12 @@ void ExpressionCompleter::slotUpdate(const QString & prefix, int pos)
std::transform(result.cbegin(),
result.cend(),
std::back_inserter(tokens),
[](const std::tuple<int, int, std::string>& item) {
[&](const std::tuple<int, int, std::string>& item) {
return std::make_tuple(
get<0>(item), get<1>(item), QString::fromStdString(get<2>(item)));
get<0>(item),
QString::fromStdString(expr.toStdString().substr(0,get<1>(item))).size(),
QString::fromStdString(get<2>(item))
);
});
return tokens;
};
@@ -883,7 +886,9 @@ void ExpressionCompleter::slotUpdate(const QString & prefix, int pos)
}
// Not an unclosed string and the last character is a space
if (!stringing && !prefix.isEmpty() && prefix[prefixEnd-1] == QChar(32)) {
if (!stringing && !prefix.isEmpty() &&
prefixEnd > 0 && prefixEnd <= prefix.size() &&
prefix[prefixEnd-1] == QChar(32)) {
if (auto itemView = popup())
itemView->setVisible(false);
return;

View File

@@ -180,7 +180,7 @@ void NotificationLabel::paintEvent(QPaintEvent *ev)
{
QStylePainter p(this);
QStyleOptionFrame opt;
opt.init(this);
opt.initFrom(this);
p.drawPrimitive(QStyle::PE_PanelTipLabel, opt);
p.end();
QLabel::paintEvent(ev);
@@ -191,7 +191,7 @@ void NotificationLabel::resizeEvent(QResizeEvent *e)
QStyleHintReturnMask frameMask;
QStyleOption option;
option.init(this);
option.initFrom(this);
if (style()->styleHint(QStyle::SH_ToolTip_Mask, &option, this, &frameMask)) {
setMask(frameMask.region);