Results 1 to 2 of 2

Thread: QTextCursor selection forward and backward problem only on linux

  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QTextCursor selection forward and backward problem only on linux

    I have subclass QGraphicsItem to write a Layer text editor... xhtml editor
    Subversion:
    http://fop-miniscribus.googlecode.co...phicsViewEdit/

    Now i have problem on Linux..
    this MouseMoveEvent run perfect on Window XP qt4.4 and QTextCursor select correct text
    forward and backward ...

    Why on linux (ubuntu) qt4.4 it select the full line and can not select only one or two Character?

    Qt Code:
    1. /* subversion /include/mounttextprivate.cpp */
    2. /* StartSelectionMouse = mouse position (QTextCursor) from MousePressEvent */
    3.  
    4. void TextWriter::tmouseMoveEvent(QEvent *e, Qt::MouseButton button, const QPointF &pos)
    5. {
    6. ///////////qDebug() << "### mouseMoveEvent in ";
    7. const int cursorPos = _d->documentLayout()->hitTest(pos,Qt::ExactHit) + 1;
    8. const int cursornow = cursorPos - 1;
    9. /* if drag move mime make and return !!! */
    10. if (C_cursor.hasSelection() && DragFill) {
    11. cursortime = false;
    12. repaintCursor();
    13. return;
    14. }
    15. const int cursorPosFozze = _d->documentLayout()->hitTest(pos,Qt::FuzzyHit);
    16. const int stopat = qMax(StartSelectionMouse,cursorPos);
    17. const int startat = qMin(StartSelectionMouse,cursorPos);
    18. ////////////qDebug() << "### start/stop cell position " << StartSelectionMouse << cursorPos << cursorPosFozze;
    19. if (StartSelectionMouse != -1 && cursorPos > 0 && !C_cursor.currentTable()) {
    20. if (StartSelectionMouse != cursorPos) {
    21. /////////setBlinkingCursorEnabled(false);
    22. /* selection tracer */
    23. cursorIsFocusIndicator = true;
    24. if (stopat == cursorPos) {
    25. /* cursor selection mode start>>>>>>>>>>>>>>>>>stop */
    26. C_cursor.setPosition(StartSelectionMouse);
    27. for (int i = StartSelectionMouse; i < cursorPos; ++i) {
    28. C_cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
    29. }
    30. cursor_position = stopat;
    31. } else {
    32. /* cursor selection mode stop<<<<<<<<start */
    33. C_cursor.setPosition(stopat);
    34. const int diffs = stopat - cursornow;
    35. /////////qDebug() << "### diffs " << diffs << "," << cursornow << "," << stopat;
    36. for (int i = 0; i < diffs; ++i) {
    37. C_cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor);
    38. }
    39. return;
    40. }
    41. repaintCursor();
    42. }
    43. }
    44.  
    45. if ( C_cursor.currentTable() ) {
    46. QTextTable *table = C_cursor.currentTable();
    47. QTextTableCell firstcell = OnPosition(StartSelectionMouse);
    48. QTextTableCell lastcell = OnPosition(cursorPosFozze);
    49. if ( firstcell.isValid() && lastcell.isValid() ) {
    50. int fcellrow = firstcell.row();
    51. int fcellcool = firstcell.column();
    52. int numRows = qBound(1,lastcell.row() - fcellrow,table->rows());
    53. int numColumns = qBound(1,lastcell.column() - fcellcool,table->columns());
    54. ///////qDebug() << "### nnrow / nncool " << numRows << numColumns;
    55. C_cursor.selectedTableCells(&fcellrow,&numRows,&fcellcool,&numColumns);
    56. C_cursor.setPosition(firstcell.firstPosition());
    57. C_cursor.setPosition(lastcell.lastPosition(), QTextCursor::KeepAnchor);
    58. cursor_position = stopat;
    59. setBlinkingCursorEnabled(false);
    60. QRectF tablerect = _d->documentLayout()->frameBoundingRect(table);
    61. emit updateRequest(tablerect);
    62. return;
    63. }
    64. }
    65. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTextCursor selection forward and backward problem only on linux

    Is this a problem from qt version?
    i write on mac on qt4.4 & linux qt4.3 .. are this possible?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.