本文整理汇总了C++中TextEditor::lineNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ TextEditor::lineNumber方法的具体用法?C++ TextEditor::lineNumber怎么用?C++ TextEditor::lineNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextEditor
的用法示例。
在下文中一共展示了TextEditor::lineNumber方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showExtended
void IDLabel::showExtended(const QPoint &p) {//, bool alreadyAdjusted, RegisterLabel *v) {
/* QPoint p2 = p;
if (!alreadyAdjusted)
p2 = mapToParent(p);
if (v == NULL)
v = this;*/
/* if (m_parent->m_extended->m_orig == this || m_parent->m_extended->m_orig == v) {
m_parent->m_extended->move(p2);
return;
}*/
QString alias = getRegisterText(m_register, true);
QString regName = ((m_register >= 32) ?
QString("<b>%1</b>").arg(alias) :
QString("<b>r%1</b> (%2)").arg(QString::number(m_register), alias));
QString mText = QString(
"<span style=\"font-size: 12;\">%1</span>"
"<pre>").arg(regName);
if (m_value == 0)
mText += QString("Value = 0");
else {
QString one = getNoInBase(m_value, 16),
// two = getNoInBase(m_value, 2),
three = getNoInBase(m_value, -10),
four = getNoInBase(m_value, 10);
mText += QString(
"Hex: %1<br>"
// "Binary: %2<br>"
"Decimal: %2")
.arg(one, /*two, */three);
if (three != four)
mText += QString("<br>UDecimal: %1").arg(four);
}
// Display the line which is responsible for setting
// the value currently in this register.
TextEditor *active = NULL;
if (m_lastModified != NULL && m_lastModified->isValid() && m_lastModified->getTextBlock() != NULL && (active = m_parent->m_parent->m_gui->getActiveProgram()) != NULL) {
mText += QString("<br>"
"(Set by line <i>%1</i>)").arg(1 + active->lineNumber(*m_lastModified->getTextBlock()));
}
mText += QString("</pre>");
/*
QString("");
("Last modifed by<br>line: <b>%1</b>").arg(QString("N/A"));*/
//"<ul style=\"list-style: none;\">"
/*"<li "STYLE_LEFT">Hex</li><li "STYLE_RIGHT">%2</li>"
"<li "STYLE_LEFT">Binary</li><li "STYLE_RIGHT">%3</li>"
"<li "STYLE_LEFT">Decimal</li><li "STYLE_RIGHT">%4</li>"
"<li "STYLE_LEFT">Unsigned</li><li "STYLE_RIGHT">%5</li>"*/
//"</ul>"
m_parent->showExtended(p, mText, this);
}
示例2: getRegisterText
QString RegisterPane::getRegisterText(int registerNo) {
unsigned int value = m_registerLabels[registerNo]->getValue();
QString alias = ::getRegisterText(registerNo, true);
QString regName = ((registerNo >= 32) ?
QString("<b>%1</b>").arg(alias) :
QString("<b>r%1</b> (%2)").arg(QString::number(registerNo), alias));
QString mText = QString(
"<span style=\"font-size: 12;\">%1</span>"
"<pre>").arg(regName);
if (value == 0)
mText += QString("Value = 0");
else {
QString one = getNoInBase(value, 16),
// two = getNoInBase(value, 2),
three = getNoInBase((signed)value, -10),//D_SIGNED_DECIMAL),
four = getNoInBase(value, 10);
mText += QString(
"Hex: %1<br>"
// "Binary: %2<br>"
"Decimal: %2")
.arg(one, /*two, */three);
if (three != four)
mText += QString("<br>UDecimal: %1").arg(four);
}
// Display the line which is responsible for setting
// the value currently in this register.
ParseNode *lastModified = m_registerLabels[registerNo]->m_lastModified;
TextEditor *active = NULL;
if (lastModified != NULL && lastModified->isValid() && lastModified->getTextBlock() != NULL && (active = m_parent->m_gui->getActiveProgram()) != NULL) {
mText += QString("<br>"
"(Set by line <i>%1</i>)").arg(1 + active->lineNumber(*lastModified->getTextBlock()));
}
mText += QString("</pre>");
return mText;
}
示例3: updateDisplay
void StackView::updateDisplay(State *s, int state) {
if (m_dirty && state != RUNNING) {
s->getStack(m_stack);
int cur_index = 0, size = m_stack.size();
const unsigned int base = 16; // hex
const QString &longestAddr = QString::number(STACK_BASE_ADDRESS - 4, base);
const int maxAddrLength = longestAddr.length();
m_display->setUpdatesEnabled(false);
m_display->setPlainText("");
QString text;
unsigned int address = STACK_BASE_ADDRESS - 4;
foreach(int value, m_stack) {
QString addr = QString::number(address, base);
for(int max = addr.length(), i = maxAddrLength; i > max; i--)
addr += " ";
const QString &valString = QString::number(value, base);
text = QString(": %1\n").arg(valString);
QTextCursor c = m_display->textCursor();
c.movePosition(QTextCursor::End);
//int oldEnd = c.position();
QTextCharFormat format(m_display->currentCharFormat());
if (cur_index++ > 200) {
if (VERBOSE)
cerr << "STACK_SIZE: " << m_stack.size() << endl;
c.insertText(QString("... STACK IS TOO LARGE TO DISPLAY ...\n"
"You may be in an infinite loop. Stack size: %1 words").arg(QString::number(size)));
/*QMessageBox::warning(this, tr("Stack warning"),
QString("Stack is too large to display.\n"
"You may be in an infinite loop. Stack size: %1 words").arg(QString::number(size)));*/
break;
}
// TODO: Have tip tell which line last modified it!
QString tip = QString("Hex: %1: %2<br>"
"Dec: %3: %4").arg(addr, valString,
QString::number(address, 10),
QString::number(value, 10));
if (address == m_sp) {
format.setFontWeight(100);
tip += "<br>(<b>$sp</b>)";
}
if (m_modifiedMap.contains(address)) {
ParseNode *last = m_modifiedMap[address];
TextEditor *active = NULL;
if (last != NULL && last->isValid() && last->getTextBlock() != NULL && (active = m_gui->getActiveProgram()) != NULL) {
tip += QString("<br>"
"(Set by line <i>%1</i>)").arg(1 + active->lineNumber(*last->getTextBlock()));
}
}
format.setToolTip(tip);
c.insertText(addr, format);
if (address == m_sp)
format.setFontWeight(50);
c.insertText(text, format);
address -= 4;
}