Results 1 to 4 of 4

Thread: QTextEdit - disable paste()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Posts
    2

    Default Re: QTextEdit - disable paste()

    Thank you for reply.
    First is same I did.

    I've also tried the second before
    Qt Code:
    1. bool Edytor::canInsertFromMimeData (const QMimeData*){
    2. qDebug()<<"CanInsert";
    3. return false;
    4. };
    5.  
    6. void Edytor::insertFromMimeData (QMimeData*){
    7. qDebug()<<"Insert";
    8. return;
    9. };
    To copy to clipboard, switch view to plain text mode 

    But it doesn't work too.

    I checked qt source code.

    Qt Code:
    1. void QTextEdit::paste()
    2. {
    3. Q_D(QTextEdit);
    4. d->control->paste();
    5. }
    To copy to clipboard, switch view to plain text mode 

    d is instance of QTextEdit.
    Line d->control->paste() invokes paste method of QTextControl class.
    Which looks like below:
    Qt Code:
    1. void QTextControl::paste()
    2. {
    3. const QMimeData *md = QApplication::clipboard()->mimeData();
    4. if (md)
    5. insertFromMimeData(md);
    6. }
    To copy to clipboard, switch view to plain text mode 
    It invokes insertFromMimeData(QMimeData *src) but not from QTextEdit but from QTextControl to which I have no access.

    Am I wrong somewhere?

  2. #2
    Join Date
    Dec 2011
    Posts
    1
    Qt products
    Qt3
    Platforms
    MacOS X

    Default Re: QTextEdit - disable paste()

    Any further developments here? I also tried sub-classing QTextEdit and overriding canInsertFromMimeData (const QMimeData*) as the docs seem to indicate should work, but if doesn't for me. I also tried overriding canPaste() without success. Any other ideas?

    Thanks,

    Rob

Similar Threads

  1. Problem pasting text into a QTextEdit
    By Spockmeat in forum Qt Programming
    Replies: 8
    Last Post: 14th March 2009, 14:36
  2. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  3. Disable Return on QTextEdit
    By raphaelf in forum Newbie
    Replies: 3
    Last Post: 23rd May 2007, 08:04
  4. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 06:03

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
  •  
Qt is a trademark of The Qt Company.