Show
Ignore:
Timestamp:
07/05/08 13:09:27 (5 months ago)
Author:
eugene
Message:

Don't interfere Qt with additional mouse selection copying slots, just instruct how to do the copy.

Location:
trunk/qt4-gui/src/widgets
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt4-gui/src/widgets/mlview.cpp

    r6166 r6428  
    4646  setLineWrapMode(QTextEdit::WidgetWidth); 
    4747  setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); 
    48   connect(this, SIGNAL(selectionChanged()), SLOT(slotCopy())); 
    4948 
    5049  updateFont(); 
     
    295294} 
    296295 
    297 /** 
    298  * After we have copied the text, we update the copy so that all emoticons are 
    299  * replaced with their respective smiley. 
    300  */ 
    301 void MLView::slotCopy() 
    302 { 
    303   QTextCursor cr=textCursor(); 
    304   if (!cr.hasSelection()) 
    305     return; 
    306  
    307   QString html = cr.selection().toHtml(); 
    308  
    309   Emoticons::unparseMessage(html); 
    310  
    311   QString text = QTextDocumentFragment::fromHtml(html).toPlainText(); 
    312  
    313   QClipboard* cb = QApplication::clipboard(); 
    314   cb->setText(text); 
    315   if (cb->supportsSelection()) 
    316     cb->setText(text, QClipboard::Selection); 
     296QMimeData* MLView::createMimeDataFromSelection() const 
     297{ 
     298  QMimeData* result = QTextEdit::createMimeDataFromSelection(); 
     299 
     300  if (result->hasHtml()) 
     301  { 
     302    QString html = result->html(); 
     303    Emoticons::unparseMessage(html); 
     304    QTextDocumentFragment fragment = 
     305      QTextDocumentFragment::fromHtml(html, document()); 
     306    result->setText(fragment.toPlainText()); 
     307  } 
     308 
     309  return result; 
    317310} 
    318311 
  • trunk/qt4-gui/src/widgets/mlview.h

    r6166 r6428  
    7171protected: 
    7272  virtual void contextMenuEvent(QContextMenuEvent* event); 
     73  virtual QMimeData* createMimeDataFromSelection() const; 
    7374 
    7475public slots: 
     
    7677 
    7778private slots: 
    78   void slotCopy(); 
    7979  void slotCopyUrl(); 
    8080  void makeQuote();