/* subversion /include/mounttextprivate.cpp */
/* StartSelectionMouse = mouse position (QTextCursor) from MousePressEvent */
void TextWriter
::tmouseMoveEvent(QEvent *e, Qt
::MouseButton button,
const QPointF &pos
) {
///////////qDebug() << "### mouseMoveEvent in ";
const int cursorPos = _d->documentLayout()->hitTest(pos,Qt::ExactHit) + 1;
const int cursornow = cursorPos - 1;
/* if drag move mime make and return !!! */
if (C_cursor.hasSelection() && DragFill) {
cursortime = false;
repaintCursor();
return;
}
const int cursorPosFozze = _d->documentLayout()->hitTest(pos,Qt::FuzzyHit);
const int stopat = qMax(StartSelectionMouse,cursorPos);
const int startat = qMin(StartSelectionMouse,cursorPos);
////////////qDebug() << "### start/stop cell position " << StartSelectionMouse << cursorPos << cursorPosFozze;
if (StartSelectionMouse != -1 && cursorPos > 0 && !C_cursor.currentTable()) {
if (StartSelectionMouse != cursorPos) {
/////////setBlinkingCursorEnabled(false);
/* selection tracer */
cursorIsFocusIndicator = true;
if (stopat == cursorPos) {
/* cursor selection mode start>>>>>>>>>>>>>>>>>stop */
C_cursor.setPosition(StartSelectionMouse);
for (int i = StartSelectionMouse; i < cursorPos; ++i) {
}
cursor_position = stopat;
} else {
/* cursor selection mode stop<<<<<<<<start */
C_cursor.setPosition(stopat);
const int diffs = stopat - cursornow;
/////////qDebug() << "### diffs " << diffs << "," << cursornow << "," << stopat;
for (int i = 0; i < diffs; ++i) {
}
return;
}
repaintCursor();
}
}
if ( C_cursor.currentTable() ) {
if ( firstcell.isValid() && lastcell.isValid() ) {
int fcellrow = firstcell.row();
int fcellcool = firstcell.column();
int numRows = qBound(1,lastcell.row() - fcellrow,table->rows());
int numColumns = qBound(1,lastcell.column() - fcellcool,table->columns());
///////qDebug() << "### nnrow / nncool " << numRows << numColumns;
C_cursor.selectedTableCells(&fcellrow,&numRows,&fcellcool,&numColumns);
C_cursor.setPosition(firstcell.firstPosition());
C_cursor.
setPosition(lastcell.
lastPosition(),
QTextCursor::KeepAnchor);
cursor_position = stopat;
setBlinkingCursorEnabled(false);
QRectF tablerect
= _d
->documentLayout
()->frameBoundingRect
(table
);
emit updateRequest(tablerect);
return;
}
}
}
/* subversion /include/mounttextprivate.cpp */
/* StartSelectionMouse = mouse position (QTextCursor) from MousePressEvent */
void TextWriter::tmouseMoveEvent(QEvent *e, Qt::MouseButton button, const QPointF &pos)
{
///////////qDebug() << "### mouseMoveEvent in ";
const int cursorPos = _d->documentLayout()->hitTest(pos,Qt::ExactHit) + 1;
const int cursornow = cursorPos - 1;
/* if drag move mime make and return !!! */
if (C_cursor.hasSelection() && DragFill) {
cursortime = false;
repaintCursor();
return;
}
const int cursorPosFozze = _d->documentLayout()->hitTest(pos,Qt::FuzzyHit);
const int stopat = qMax(StartSelectionMouse,cursorPos);
const int startat = qMin(StartSelectionMouse,cursorPos);
////////////qDebug() << "### start/stop cell position " << StartSelectionMouse << cursorPos << cursorPosFozze;
if (StartSelectionMouse != -1 && cursorPos > 0 && !C_cursor.currentTable()) {
if (StartSelectionMouse != cursorPos) {
/////////setBlinkingCursorEnabled(false);
/* selection tracer */
cursorIsFocusIndicator = true;
if (stopat == cursorPos) {
/* cursor selection mode start>>>>>>>>>>>>>>>>>stop */
C_cursor.setPosition(StartSelectionMouse);
for (int i = StartSelectionMouse; i < cursorPos; ++i) {
C_cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
}
cursor_position = stopat;
} else {
/* cursor selection mode stop<<<<<<<<start */
C_cursor.setPosition(stopat);
const int diffs = stopat - cursornow;
/////////qDebug() << "### diffs " << diffs << "," << cursornow << "," << stopat;
for (int i = 0; i < diffs; ++i) {
C_cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor);
}
return;
}
repaintCursor();
}
}
if ( C_cursor.currentTable() ) {
QTextTable *table = C_cursor.currentTable();
QTextTableCell firstcell = OnPosition(StartSelectionMouse);
QTextTableCell lastcell = OnPosition(cursorPosFozze);
if ( firstcell.isValid() && lastcell.isValid() ) {
int fcellrow = firstcell.row();
int fcellcool = firstcell.column();
int numRows = qBound(1,lastcell.row() - fcellrow,table->rows());
int numColumns = qBound(1,lastcell.column() - fcellcool,table->columns());
///////qDebug() << "### nnrow / nncool " << numRows << numColumns;
C_cursor.selectedTableCells(&fcellrow,&numRows,&fcellcool,&numColumns);
C_cursor.setPosition(firstcell.firstPosition());
C_cursor.setPosition(lastcell.lastPosition(), QTextCursor::KeepAnchor);
cursor_position = stopat;
setBlinkingCursorEnabled(false);
QRectF tablerect = _d->documentLayout()->frameBoundingRect(table);
emit updateRequest(tablerect);
return;
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks