当前位置: 首页>>代码示例>>C++>>正文


C++ QTextDocument::end方法代码示例

本文整理汇总了C++中QTextDocument::end方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextDocument::end方法的具体用法?C++ QTextDocument::end怎么用?C++ QTextDocument::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTextDocument的用法示例。


在下文中一共展示了QTextDocument::end方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: end

QTextBlock QTextDocumentProto::end() const
{
  QTextDocument *item = qscriptvalue_cast<QTextDocument*>(thisObject());
  if (item)
    return item->end();
  return QTextBlock();
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例2: setAlignment

 // Set the alignment of all blocks to the given alignment
 void setAlignment(Qt::Alignment align) {
     QTextDocument* textDocument = document();
     for (QTextBlock it = textDocument->begin(); it != textDocument->end(); it = it.next()) {
         QTextCursor cur(it);
         QTextBlockFormat format = cur.blockFormat();
         format.setAlignment(align);
         cur.setBlockFormat(format);
     }
 }
开发者ID:afester,项目名称:CodeSamples,代码行数:10,代码来源:TextItem.cpp

示例3: main

int main(int argv, char **args)
{
    QString contentString("One\nTwp\nThree");

    QTextDocument *doc = new QTextDocument(contentString);

//! [0]
    for (QTextBlock it = doc->begin(); it != doc->end(); it = it.next())
        cout << it.text().toStdString() << endl;
//! [0]

    return 0;
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例4: setInternalAlignment

void TextItem::setInternalAlignment(Qt::Alignment align) {
	// Store alignment
	alignment = align;

    // Set the alignment of all blocks to the given alignment
    QTextDocument* textDocument = textItem->document();
    for (QTextBlock it = textDocument->begin(); it != textDocument->end(); it = it.next()) {
		QTextCursor cur(it);
		QTextBlockFormat format = cur.blockFormat();
		format.setAlignment(align);
		cur.setBlockFormat(format);
    }
}
开发者ID:afester,项目名称:CodeSamples,代码行数:13,代码来源:TextItem.cpp

示例5: updateExistsTextColor

void TextOutput::updateExistsTextColor()
{
    if (!m_existsTimer.hasExpired(1000)) return;

    QTextDocument* doc = document();
    for (QTextBlock it = doc->begin(); it != doc->end(); it = it.next())
    {
        QTextCursor cur(it);
        cur.select(QTextCursor::BlockUnderCursor);

        QTextCharFormat f(cur.charFormat());
        QColor color(f.foreground().color());
        color.setAlpha(128);
        f.setForeground(color);
        cur.setCharFormat(f);
    }
}
开发者ID:JoeyFan,项目名称:liteide,代码行数:17,代码来源:textoutput.cpp

示例6: getInput

bool CVProjectDialog::getInput(Core::CVProject& proj) {
    proj.name = _name->text();
	proj.path = _path->text() + QDir::separator() + proj.name;
    proj.type = _type->currentIndex() == 0 ? Core::CVProject::PHOTOGRAMMETRY : Core::CVProject::LIDAR;
	proj.refPath = _conf->text();
	if (proj.type == Core::CVProject::PHOTOGRAMMETRY) {
		proj.scale = _scale->currentText();
	}

	proj.datum = _epsg->currentText().toInt();

	QTextDocument* doc = _note->document();
	QStringList l;
	for (QTextBlock it = doc->begin(); it != doc->end(); it = it.next()) {
         l << it.text();
	}
	proj.notes = l.join("\n");
	return !proj.name.isEmpty() && !proj.path.isEmpty() && !proj.refPath.isEmpty();
}
开发者ID:geoin,项目名称:ControlloVoliRT,代码行数:19,代码来源:cvprojectdialog.cpp

示例7: toStringFromDocument

QString Dialog::toStringFromDocument() {
    QTextDocument *doc = message()->document();
    QString txt;
    for (QTextBlock bl = doc->begin(); bl != doc->end(); bl = bl.next())
        if (bl.isValid()) {
            for (QTextBlock::iterator it = bl.begin(); !it.atEnd(); ++it) {
                QTextFragment fragm = it.fragment();
                if (fragm.isValid() && fragm.charFormat().isImageFormat()) {
                    QString imgName = fragm.charFormat().toImageFormat().name();
                    txt += imgName;
                } else if (fragm.isValid())
                    txt += fragm.text();
            }

            if (bl != doc->begin())
                txt += "\n";
        }
    int i = (int)txt.size() - 1;
    while (i >= 0 && (txt[i] == ' ' || txt[i] == '\n')) --i;
    txt.remove(i + 1, txt.size() - i - 1);
    return txt;
}
开发者ID:pva701,项目名称:codes,代码行数:22,代码来源:dialog.cpp

示例8: find

bool GenericCodeEditor::find( const QRegExp &expr, QTextDocument::FindFlags options )
{
    // Although QTextDocument provides a find() method, we implement
    // our own, because the former one is not adequate.

    if(expr.isEmpty()) return true;

    bool backwards = options & QTextDocument::FindBackward;

    QTextCursor c( textCursor() );
    int pos;
    if (c.hasSelection())
    {
        bool matching = expr.exactMatch(c.selectedText());

        if( backwards == matching )
            pos = c.selectionStart();
        else
            pos = c.selectionEnd();
    }
    else
        pos = c.position();

    QTextDocument *doc = QPlainTextEdit::document();
    QTextBlock startBlock = doc->findBlock(pos);
    int startBlockOffset = pos - startBlock.position();

    QTextCursor cursor;

    if (!backwards) {
        int blockOffset = startBlockOffset;
        QTextBlock block = startBlock;
        while (block.isValid()) {
            if (findInBlock(doc, block, expr, blockOffset, options, cursor))
                break;
            blockOffset = 0;
            block = block.next();
        }
        if(cursor.isNull())
        {
            blockOffset = 0;
            block = doc->begin();
            while(true) {
                if (findInBlock(doc, block, expr, blockOffset, options, cursor)
                    || block == startBlock)
                    break;
                block = block.next();
            }
        }
    } else {
        int blockOffset = startBlockOffset;
        QTextBlock block = startBlock;
        while (block.isValid()) {
            if (findInBlock(doc, block, expr, blockOffset, options, cursor))
                break;
            block = block.previous();
            blockOffset = block.length() - 1;
        }
        if(cursor.isNull())
        {
            block = doc->end();
            while(true) {
                blockOffset = block.length() - 1;
                if (findInBlock(doc, block, expr, blockOffset, options, cursor)
                    || block == startBlock)
                    break;
                block = block.previous();
            }
        }
    }

    if(!cursor.isNull()) {
        setTextCursor(cursor);
        return true;
    }
    else
        return false;
}
开发者ID:ARTisERR0R,项目名称:supercollider,代码行数:78,代码来源:editor.cpp

示例9: interpolateButtonClicked

void MainWindow::interpolateButtonClicked()
{
    QString tString = ui->tLineEdit->text();
    bool ok;
    double tValue = tString.toDouble(&ok);

    if(!ok)
        ; // if you're too stupid to enter a valid number, you're too stupid
    // to read a proper error message, so no error message here.


    // get the input by filtering non-valid input data
    QTextDocument *doc = ui->dataInput->document();
    QStringList inputList;
    for (QTextBlock it = doc->begin(); it != doc->end(); it = it.next())
    {
        QString line = QString::fromStdString(it.text().toStdString());
        // empty lines and malformed input are skipped
        if(line != ""
            && line.contains(QRegExp("-?\\d+(\\.\\d+)?\\s+-?\\d+(\\.\\d+)?")))
            inputList << line.trimmed();
        else
            qDebug() << "Skipping line: " << line;
    }

    int number_points = inputList.size();
    double data[number_points][2];

    // split the lines in x and y
    for(int i=0; i<inputList.size(); i++)
    {
        QString point = inputList.at(i);
        QStringList l = point.split(QRegExp("\\s+"));

        // this should never happen
        if(l.size()<2){
            qDebug() << "String couldn't be split.";
            qDebug() << "Can't interpolate.";
            return;
        }

        data[i][0] = l.at(0).toDouble();
        data[i][1] = l.at(1).toDouble();
    }

    // the output file
    QFile output;
    output.setFileName("results.dat");
    output.open(QIODevice::WriteOnly | QIODevice::Text);
    QTextStream fout(&output);

    // basic matrix
    double Mcr[4][4] = {
        {-0.5, 1.5, -1.5, 0.5},
        {1, -2.5, 2, -0.5},
        {-0.5, 0, 0.5, 0},
        {0, 1, 0, 0}
    };

    double Gbi[4][2];

    for(int i=0; i<number_points-1; i++)
    {
        // Select the four points required for the calculation.
        // With the min/max functions the border points are implicitely
        // duplicated as they wouldn't be interpolated by the algorithm
        // otherwise.
        for(int j=0; j<2; j++)
        {
            Gbi[0][j] = data[std::max(0, i-1)][j];
            Gbi[1][j] = data[i][j];
            Gbi[2][j] = data[std::min(number_points-1, i+1)][j];
            Gbi[3][j] = data[std::min(number_points-1, i+2)][j];
        }

        // interpolate points between two given points
        for(double u=0; u<1; u=u+0.001)
        {
            double T[4] = {pow(u,3), pow(u,2), u, 1};
            double results[2] = {0, 0};

            // interpolate one point by calculating T * Mcr * Gbi
            for(int bi_ctr=0; bi_ctr<2; bi_ctr++)
            {
                double sum = 0;
                for(int point_row=0; point_row<4; point_row++)
                {
                    for(int mcr_row=0; mcr_row<4; mcr_row++)
                    {
                        sum += T[mcr_row] * Mcr[mcr_row][point_row]
                                * Gbi[point_row][bi_ctr];
                    }
                }
                results[bi_ctr] = sum;
            }

            fout << results[0] << " " << results[1] << "\n";

            // if the user entered a valid value for x then display y
            if(ok)
//.........这里部分代码省略.........
开发者ID:slopjong,项目名称:Snippets,代码行数:101,代码来源:mainwindow.cpp


注:本文中的QTextDocument::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。