本文整理汇总了C++中QTextTableCell::end方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextTableCell::end方法的具体用法?C++ QTextTableCell::end怎么用?C++ QTextTableCell::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextTableCell
的用法示例。
在下文中一共展示了QTextTableCell::end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hitTestIterated
int KTextDocumentLayout::hitTestIterated(QTextFrame::iterator begin, QTextFrame::iterator end, const QPointF &point, Qt::HitTestAccuracy accuracy) const
{
int position = -1;
QTextFrame::iterator it = begin;
for (it = begin; it != end; ++it) {
QTextBlock block = it.currentBlock();
QTextTable *table = qobject_cast<QTextTable*>(it.currentFrame());
QTextFrame *subFrame = it.currentFrame();
if (table) {
QTextTableCell cell = m_state->hitTestTable(table, point);
if (cell.isValid()) {
position = hitTestIterated(cell.begin(), cell.end(), point,
accuracy);
if (position == -1)
position = cell.lastPosition();
return position;
}
continue;
} else if (subFrame) {
position = hitTestIterated(subFrame->begin(), subFrame->end(), point, accuracy);
if (position != -1)
return position;
continue;
} else {
if (!block.isValid())
continue;
}
// kDebug(32500) <<"hitTest[" << point.x() <<"," << point.y() <<"]";
QTextLayout *layout = block.layout();
if (point.y() > layout->boundingRect().bottom()) {
// just skip this block. position = block.position() + block.length() - 1;
continue;
}
for (int i = 0; i < layout->lineCount(); i++) {
QTextLine line = layout->lineAt(i);
// kDebug(32500) <<" + line[" << line.textStart() <<"]:" << line.y() <<"-" << line.height();
if (point.y() > line.y() + line.height()) {
position = line.textStart() + line.textLength();
continue;
}
if (accuracy == Qt::ExactHit && point.y() < line.y()) // between lines
return -1;
if (accuracy == Qt::ExactHit && // left or right of line
(point.x() < line.x() || point.x() > line.x() + line.width()))
return -1;
if (point.x() > line.width() && layout->textOption().textDirection() == Qt::RightToLeft) {
// totally right of RTL text means the position is the start of the text.
return block.position() + line.textStart();
}
return block.position() + line.xToCursor(point.x());
}
}
return -1;
}
示例2: fillTable
void TextDocumentModel::fillTable(QTextTable *table, QStandardItem *parent)
{
for (int row = 0; row < table->rows(); ++row) {
for (int col = 0; col < table->columns(); ++col) {
QTextTableCell cell = table->cellAt(row, col);
auto *item = new QStandardItem;
item->setText(tr("Cell %1x%2").arg(row).arg(col));
appendRow(parent, item, cell.format());
for (auto it = cell.begin(); it != cell.end(); ++it)
fillFrameIterator(it, item);
}
}
}