Commit 25087b01 authored by Robert Loehning's avatar Robert Loehning

ModelEditor: Fix various warnings

Change-Id: Ibcd95304c2c59dd047481e89ac3162c74b53307b
Reviewed-by: default avatarJochen Becher <jochen_becher@gmx.de>
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 98505427
...@@ -565,11 +565,6 @@ void ClassItem::updateMembers(const Style *style) ...@@ -565,11 +565,6 @@ void ClassItem::updateMembers(const Style *style)
auto dclass = dynamic_cast<DClass *>(object()); auto dclass = dynamic_cast<DClass *>(object());
QMT_CHECK(dclass); QMT_CHECK(dclass);
// TODO move bool haveIconFonts into class Style?
bool haveIconFonts = false; // style->normalFont().family() == QStringLiteral("Modelling");
// TODO any reason to show visibility as group instead of per member?
bool useGroupVisibility = false;
foreach (const MClassMember &member, dclass->members()) { foreach (const MClassMember &member, dclass->members()) {
switch (member.memberType()) { switch (member.memberType()) {
case MClassMember::MemberUndefined: case MClassMember::MemberUndefined:
...@@ -587,50 +582,14 @@ void ClassItem::updateMembers(const Style *style) ...@@ -587,50 +582,14 @@ void ClassItem::updateMembers(const Style *style)
break; break;
} }
if (!text->isEmpty()) if (text && !text->isEmpty())
*text += QStringLiteral("<br/>"); *text += QStringLiteral("<br/>");
bool addNewline = false; bool addNewline = false;
bool addSpace = false; bool addSpace = false;
if (member.visibility() != *currentVisibility) { if (currentVisibility)
if (useGroupVisibility) {
if (member.visibility() != MClassMember::VisibilityUndefined) {
QString vis;
switch (member.visibility()) {
case MClassMember::VisibilityUndefined:
break;
case MClassMember::VisibilityPublic:
vis = QStringLiteral("public:");
break;
case MClassMember::VisibilityProtected:
vis = QStringLiteral("protected:");
break;
case MClassMember::VisibilityPrivate:
vis = QStringLiteral("private:");
break;
case MClassMember::VisibilitySignals:
vis = QStringLiteral("signals:");
break;
case MClassMember::VisibilityPrivateSlots:
vis = QStringLiteral("private slots:");
break;
case MClassMember::VisibilityProtectedSlots:
vis = QStringLiteral("protected slots:");
break;
case MClassMember::VisibilityPublicSlots:
vis = QStringLiteral("public slots:");
break;
}
*text += vis;
addNewline = true;
addSpace = true;
}
}
*currentVisibility = member.visibility(); *currentVisibility = member.visibility();
}
if (member.group() != currentGroup) { if (member.group() != currentGroup) {
if (addSpace)
*text += QStringLiteral(" ");
*text += QString(QStringLiteral("[%1]")).arg(member.group()); *text += QString(QStringLiteral("[%1]")).arg(member.group());
addNewline = true; addNewline = true;
*currentGroup = member.group(); *currentGroup = member.group();
...@@ -638,61 +597,55 @@ void ClassItem::updateMembers(const Style *style) ...@@ -638,61 +597,55 @@ void ClassItem::updateMembers(const Style *style)
if (addNewline) if (addNewline)
*text += QStringLiteral("<br/>"); *text += QStringLiteral("<br/>");
addSpace = false;
bool haveSignal = false; bool haveSignal = false;
bool haveSlot = false; bool haveSlot = false;
if (!useGroupVisibility) { if (member.visibility() != MClassMember::VisibilityUndefined) {
if (member.visibility() != MClassMember::VisibilityUndefined) { QString vis;
QString vis; switch (member.visibility()) {
switch (member.visibility()) { case MClassMember::VisibilityUndefined:
case MClassMember::VisibilityUndefined: break;
break; case MClassMember::VisibilityPublic:
case MClassMember::VisibilityPublic: vis = QStringLiteral("+");
vis = haveIconFonts ? QString(QChar(0xe990)) : QStringLiteral("+"); addSpace = true;
addSpace = true; break;
break; case MClassMember::VisibilityProtected:
case MClassMember::VisibilityProtected: vis = QStringLiteral("#");
vis = haveIconFonts ? QString(QChar(0xe98e)) : QStringLiteral("#"); addSpace = true;
addSpace = true; break;
break; case MClassMember::VisibilityPrivate:
case MClassMember::VisibilityPrivate: vis = QStringLiteral("-");
vis = haveIconFonts ? QString(QChar(0xe98f)) : QStringLiteral("-"); addSpace = true;
addSpace = true; break;
break; case MClassMember::VisibilitySignals:
case MClassMember::VisibilitySignals: vis = QStringLiteral("&gt;");
vis = haveIconFonts ? QString(QChar(0xe994)) : QStringLiteral("&gt;"); haveSignal = true;
haveSignal = true; addSpace = true;
addSpace = true; break;
break; case MClassMember::VisibilityPrivateSlots:
case MClassMember::VisibilityPrivateSlots: vis = QStringLiteral("-$");
vis = haveIconFonts ? QString(QChar(0xe98f)) + QChar(0xe9cb) haveSlot = true;
: QStringLiteral("-$"); addSpace = true;
haveSlot = true; break;
addSpace = true; case MClassMember::VisibilityProtectedSlots:
break; vis = QStringLiteral("#$");
case MClassMember::VisibilityProtectedSlots: haveSlot = true;
vis = haveIconFonts ? QString(QChar(0xe98e)) + QChar(0xe9cb) addSpace = true;
: QStringLiteral("#$"); break;
haveSlot = true; case MClassMember::VisibilityPublicSlots:
addSpace = true; vis = QStringLiteral("+$");
break; haveSlot = true;
case MClassMember::VisibilityPublicSlots: addSpace = true;
vis = haveIconFonts ? QString(QChar(0xe990)) + QChar(0xe9cb) break;
: QStringLiteral("+$");
haveSlot = true;
addSpace = true;
break;
}
*text += vis;
} }
*text += vis;
} }
if (member.properties() & MClassMember::PropertyQsignal && !haveSignal) { if (member.properties() & MClassMember::PropertyQsignal && !haveSignal) {
*text += haveIconFonts ? QString(QChar(0xe994)) : QStringLiteral("&gt;"); *text += QStringLiteral("&gt;");
addSpace = true; addSpace = true;
} }
if (member.properties() & MClassMember::PropertyQslot && !haveSlot) { if (member.properties() & MClassMember::PropertyQslot && !haveSlot) {
*text += haveIconFonts ? QString(QChar(0xe9cb)) : QStringLiteral("$"); *text += QStringLiteral("$");
addSpace = true; addSpace = true;
} }
if (addSpace) if (addSpace)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment