~ci-train-bot/qmenumodel/qmenumodel-ubuntu-xenial-landing-064

« back to all changes in this revision

Viewing changes to libqmenumodel/src/qmenumodel.cpp

  • Committer: CI Train Bot
  • Author(s): Albert Astals Cid
  • Date: 2016-02-16 09:30:10 UTC
  • mfrom: (118.2.1 clazy_run)
  • Revision ID: ci-train-bot@canonical.com-20160216093010-2rl073b0yycvajyh
Fix clazy warnings

const char * -> QStringLiteral/QLatin1String
Reserve lists we know the size of
Add const &
Use new connect syntax
Add missing return to a function
Fix #ifndef/define pair

clazy: https://quickgit.kde.org/?p=clazy.git
Approved by: PS Jenkins bot, Lars Uebernickel

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
    clearModel();
65
65
 
66
66
    if (other) {
67
 
        m_root = new MenuNode("", other, 0, 0, this);
 
67
        m_root = new MenuNode(QLatin1String(""), other, 0, 0, this);
68
68
    }
69
69
 
70
70
    endResetModel();
138
138
    if (row >= 0) {
139
139
        switch (role) {
140
140
        case Action:
141
 
            attribute = getStringAttribute(node, row, G_MENU_ATTRIBUTE_ACTION);
 
141
            attribute = getStringAttribute(node, row, QStringLiteral(G_MENU_ATTRIBUTE_ACTION));
142
142
            break;
143
143
        case Qt::DisplayRole:
144
144
        case Label:
145
 
            attribute = getStringAttribute(node, row, G_MENU_ATTRIBUTE_LABEL);
 
145
            attribute = getStringAttribute(node, row, QStringLiteral(G_MENU_ATTRIBUTE_LABEL));
146
146
            break;
147
147
        case Extra:
148
148
            attribute = getExtraProperties(node, row);
149
149
            break;
150
150
        case hasSection:
151
 
            attribute = QVariant(hasLink(node, row, G_MENU_LINK_SECTION));
 
151
            attribute = QVariant(hasLink(node, row, QStringLiteral(G_MENU_LINK_SECTION)));
152
152
            break;
153
153
        case hasSubMenu:
154
 
            attribute = QVariant(hasLink(node, row, G_MENU_LINK_SUBMENU));
 
154
            attribute = QVariant(hasLink(node, row, QStringLiteral(G_MENU_LINK_SUBMENU)));
155
155
            break;
156
156
        case Depth:
157
157
            attribute = QVariant(node->depth());
287
287
QString QMenuModel::parseExtraPropertyName(const QString &name) const
288
288
{
289
289
    QString newName(name);
290
 
    if (name.startsWith("x-")) {
 
290
    if (name.startsWith(QLatin1String("x-"))) {
291
291
        newName = name.mid(2);
292
292
    }
293
 
    return newName.replace("-", "_");
 
293
    return newName.replace(QLatin1String("-"), QLatin1String("_"));
294
294
}
295
295
 
296
296
GMenuModel *QMenuModel::menuModel() const