Пример #1
0
QString WatchItem::toToolTip() const
{
    QString res;
    QTextStream str(&res);
    str << "<html><body><table>";
    formatToolTipRow(str, tr("Name"), name);
    formatToolTipRow(str, tr("Expression"), expression());
    formatToolTipRow(str, tr("Internal Type"), QLatin1String(type));
    bool ok;
    const quint64 intValue = value.toULongLong(&ok);
    if (ok && intValue) {
        formatToolTipRow(str, tr("Value"), QLatin1String("(dec)  ") + value);
        formatToolTipRow(str, QString(), QLatin1String("(hex)  ") + QString::number(intValue, 16));
        formatToolTipRow(str, QString(), QLatin1String("(oct)  ") + QString::number(intValue, 8));
        formatToolTipRow(str, QString(), QLatin1String("(bin)  ") + QString::number(intValue, 2));
    } else {
        QString val = value;
        if (val.size() > 1000) {
            val.truncate(1000);
            val += QLatin1Char(' ');
            val += tr("... <cut off>");
        }
        formatToolTipRow(str, tr("Value"), val);
    }
    if (realAddress())
        formatToolTipRow(str, tr("Object Address"), formatToolTipAddress(realAddress()));
    if (origaddr)
        formatToolTipRow(str, tr("Pointer Address"), formatToolTipAddress(origaddr));
    if (arrayIndex >= 0)
        formatToolTipRow(str, tr("Array Index"), QString::number(arrayIndex));
    if (size)
        formatToolTipRow(str, tr("Static Object Size"), tr("%n bytes", 0, size));
    formatToolTipRow(str, tr("Internal ID"), QLatin1String(internalName()));
    str << "</table></body></html>";
    return res;
}
Пример #2
0
QString StackFrame::toToolTip() const
{
    const QString filePath = QDir::toNativeSeparators(file);
    QString res;
    QTextStream str(&res);
    str << "<html><body><table>";
    if (address)
        str << "<tr><td>" << tr("Address:") << "</td><td>"
            << formatToolTipAddress(address) << "</td></tr>";
    if (!function.isEmpty())
        str << "<tr><td>"
            << (language == CppLanguage ? tr("Function:") : tr("JS-Function:"))
            << "</td><td>" << function << "</td></tr>";
    if (!file.isEmpty())
        str << "<tr><td>" << tr("File:") << "</td><td>" << filePath << "</td></tr>";
    if (line != -1)
        str << "<tr><td>" << tr("Line:") << "</td><td>" << line << "</td></tr>";
    if (!from.isEmpty())
        str << "<tr><td>" << tr("From:") << "</td><td>" << from << "</td></tr>";
    if (!to.isEmpty())
        str << "<tr><td>" << tr("To:") << "</td><td>" << to << "</td></tr>";
    str << "</table>";

    str <<"<br> <br><i>" << tr("Note:") << " </i> ";
    bool showDistributionNote = false;
    if (isUsable()) {
        str << tr("Sources for this frame are available.<br>Double-click on "
            "the file name to open an editor.");
    } else if (line <= 0) {
        str << tr("Binary debug information is not accessible for this "
            "frame. This either means the core was not compiled "
            "with debug information, or the debug information is not "
            "accessible.");
        showDistributionNote = true;
    } else {
        str << tr("Binary debug information is accessible for this "
            "frame. However, matching sources have not been found.");
        showDistributionNote = true;
    }
    if (!Utils::HostOsInfo::isWindowsHost() && showDistributionNote) {
        str << QLatin1Char(' ') <<
               tr("Note that most distributions ship debug information "
                  "in separate packages.");
    }

    str << "</body></html>";
    return res;
}