本文整理汇总了C++中QTextCursor::selectedTableCells方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextCursor::selectedTableCells方法的具体用法?C++ QTextCursor::selectedTableCells怎么用?C++ QTextCursor::selectedTableCells使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextCursor
的用法示例。
在下文中一共展示了QTextCursor::selectedTableCells方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mergeCells
/*!
\overload
\since 4.1
Merges the cells selected by the provided \a cursor.
\sa splitCell()
*/
void QTextTable::mergeCells(const QTextCursor &cursor)
{
if (!cursor.hasComplexSelection())
return;
int firstRow, numRows, firstColumn, numColumns;
cursor.selectedTableCells(&firstRow, &numRows, &firstColumn, &numColumns);
mergeCells(firstRow, firstColumn, numRows, numColumns);
}
示例2: selectionBoundingBox
QRectF KoTextLayoutTableArea::selectionBoundingBox(QTextCursor &cursor) const
{
int lastRow = d->endOfArea->row;
if (d->lastRowHasSomething == false) {
--lastRow;
}
if (lastRow < d->startOfArea->row) {
return QRectF(); // empty
}
int firstRow = qMax(d->startOfArea->row, d->headerRows);
QTextTableCell startTableCell = d->table->cellAt(cursor.selectionStart());
QTextTableCell endTableCell = d->table->cellAt(cursor.selectionEnd());
if (startTableCell == endTableCell) {
if (startTableCell.row() < d->startOfArea->row || startTableCell.row() > lastRow) {
return QRectF(); // cell is not in this area
}
KoTextLayoutArea *area = d->cellAreas[startTableCell.row()][startTableCell.column()];
Q_ASSERT(area);
return area->selectionBoundingBox(cursor);
} else {
int selectionRow;
int selectionColumn;
int selectionRowSpan;
int selectionColumnSpan;
cursor.selectedTableCells(&selectionRow, &selectionRowSpan, &selectionColumn, &selectionColumnSpan);
qreal top, bottom;
if (selectionRow < d->headerRows) {
top = d->headerRowPositions[selectionRow] + d->headerOffsetY;
} else {
top = d->rowPositions[qMin(qMax(firstRow, selectionRow), lastRow)];
}
if (selectionRow + selectionRowSpan < d->headerRows) {
bottom = d->headerRowPositions[selectionRow + selectionRowSpan] + d->headerOffsetY;
} else {
bottom = d->rowPositions[d->headerRows] + d->headerOffsetY;
if (selectionRow + selectionRowSpan >= firstRow) {
bottom = d->rowPositions[qMin(selectionRow + selectionRowSpan, lastRow + 1)];
}
}
return QRectF(d->columnPositions[selectionColumn], top,
d->columnPositions[selectionColumn + selectionColumnSpan] - d->columnPositions[selectionColumn], bottom - top);
}
}