equal
deleted
inserted
replaced
134 Inserts the text stored in the application clipboard into the line |
134 Inserts the text stored in the application clipboard into the line |
135 control. |
135 control. |
136 |
136 |
137 \sa insert() |
137 \sa insert() |
138 */ |
138 */ |
139 void QLineControl::paste() |
139 void QLineControl::paste(QClipboard::Mode clipboardMode) |
140 { |
140 { |
141 QString clip = QApplication::clipboard()->text(QClipboard::Clipboard); |
141 QString clip = QApplication::clipboard()->text(clipboardMode); |
142 if (!clip.isEmpty() || hasSelectedText()) { |
142 if (!clip.isEmpty() || hasSelectedText()) { |
143 separate(); //make it a separate undo/redo command |
143 separate(); //make it a separate undo/redo command |
144 insert(clip); |
144 insert(clip); |
145 separate(); |
145 separate(); |
146 } |
146 } |
1348 } |
1348 } |
1349 } |
1349 } |
1350 #endif |
1350 #endif |
1351 switch(ev->type()){ |
1351 switch(ev->type()){ |
1352 #ifndef QT_NO_GRAPHICSVIEW |
1352 #ifndef QT_NO_GRAPHICSVIEW |
|
1353 case QEvent::GraphicsSceneMouseDoubleClick: |
1353 case QEvent::GraphicsSceneMouseMove: |
1354 case QEvent::GraphicsSceneMouseMove: |
1354 case QEvent::GraphicsSceneMouseRelease: |
1355 case QEvent::GraphicsSceneMouseRelease: |
1355 case QEvent::GraphicsSceneMousePress:{ |
1356 case QEvent::GraphicsSceneMousePress:{ |
1356 QGraphicsSceneMouseEvent *gvEv = static_cast<QGraphicsSceneMouseEvent*>(ev); |
1357 QGraphicsSceneMouseEvent *gvEv = static_cast<QGraphicsSceneMouseEvent*>(ev); |
1357 QMouseEvent* mouse = new QMouseEvent(ev->type(), |
1358 QMouseEvent* mouse = new QMouseEvent(ev->type(), |
1437 bool mark = ev->modifiers() & Qt::ShiftModifier; |
1438 bool mark = ev->modifiers() & Qt::ShiftModifier; |
1438 int cursor = xToPos(ev->pos().x()); |
1439 int cursor = xToPos(ev->pos().x()); |
1439 moveCursor(cursor, mark); |
1440 moveCursor(cursor, mark); |
1440 break; |
1441 break; |
1441 } |
1442 } |
|
1443 case QEvent::GraphicsSceneMouseDoubleClick: |
1442 case QEvent::MouseButtonDblClick: |
1444 case QEvent::MouseButtonDblClick: |
1443 if (ev->button() == Qt::LeftButton) { |
1445 if (ev->button() == Qt::LeftButton) { |
1444 selectWordAtPos(xToPos(ev->pos().x())); |
1446 selectWordAtPos(xToPos(ev->pos().x())); |
1445 if (m_tripleClickTimer) |
1447 if (m_tripleClickTimer) |
1446 killTimer(m_tripleClickTimer); |
1448 killTimer(m_tripleClickTimer); |
1574 #ifndef QT_NO_CLIPBOARD |
1576 #ifndef QT_NO_CLIPBOARD |
1575 else if (event == QKeySequence::Copy) { |
1577 else if (event == QKeySequence::Copy) { |
1576 copy(); |
1578 copy(); |
1577 } |
1579 } |
1578 else if (event == QKeySequence::Paste) { |
1580 else if (event == QKeySequence::Paste) { |
1579 if (!isReadOnly()) |
1581 if (!isReadOnly()) { |
1580 paste(); |
1582 QClipboard::Mode mode = QClipboard::Clipboard; |
|
1583 #ifdef Q_WS_X11 |
|
1584 if (event->modifiers() == (Qt::CTRL | Qt::SHIFT) && event->key() == Qt::Key_Insert) |
|
1585 mode = QClipboard::Selection; |
|
1586 #endif |
|
1587 paste(mode); |
|
1588 } |
1581 } |
1589 } |
1582 else if (event == QKeySequence::Cut) { |
1590 else if (event == QKeySequence::Cut) { |
1583 if (!isReadOnly()) { |
1591 if (!isReadOnly()) { |
1584 copy(); |
1592 copy(); |
1585 del(); |
1593 del(); |
1759 } else { |
1767 } else { |
1760 unknown = true; |
1768 unknown = true; |
1761 } |
1769 } |
1762 break; |
1770 break; |
1763 #endif |
1771 #endif |
1764 |
|
1765 default: |
1772 default: |
1766 if (!handled) |
1773 if (!handled) |
1767 unknown = true; |
1774 unknown = true; |
1768 } |
1775 } |
1769 } |
1776 } |