Results 1 to 5 of 5

Thread: Add some function to reimplement method

  1. #1
    Join Date
    Apr 2012
    Posts
    40
    Platforms
    Unix/X11 Windows

    Default Add some function to reimplement method

    Hi
    I want add:
    Qt Code:
    1. if( !anchorAt( e->pos() ).isEmpty() )
    2. QMessageBox::information(0,"",anchorAt( e->pos() ));
    To copy to clipboard, switch view to plain text mode 
    to orginal(default, not edited) method "mouseDoubleClickEvent" in qtextedit.

    If i make my own method
    Qt Code:
    1. void MyTextEdit::mouseDoubleClickEvent(QMouseEvent *e)
    2. {
    3. if( !anchorAt( e->pos() ).isEmpty() )
    4. QMessageBox::information(0,"",anchorAt( e->pos() ));
    5. }
    To copy to clipboard, switch view to plain text mode 
    then default(if you double click on char then selected all word) will be not work

    So if i want add(not edit) then i will be have to make somting like this
    Qt Code:
    1. void MyTextEdit::mouseDoubleClickEvent(QMouseEvent *e)
    2. {
    3. //i have to finde default code mouseDoubleClickEventand and past here
    4.  
    5. if( !anchorAt( e->pos() ).isEmpty() )
    6. QMessageBox::information(0,"",anchorAt( e->pos() ));
    7. }
    To copy to clipboard, switch view to plain text mode 

    Somebody know faster way to do this , without copy code from default method ??

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Add some function to reimplement method

    <facepalm/> Call the base class implementation... This is basic C++...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2012
    Posts
    40
    Platforms
    Unix/X11 Windows

    Default Re: Add some function to reimplement method

    then i will by have to make new method xx()
    Qt Code:
    1. MyTextEdit::xx(QMouseEvent *e)
    2. {
    3. mouseDoubleClickEvent(e)
    4. if( !anchorAt( e->pos() ).isEmpty() )
    5. QMessageBox::information(0,"",anchorAt( e->pos() ));
    6. }
    To copy to clipboard, switch view to plain text mode 

    but now how tu set methos xx() to make on doubleclick
    in constructor
    connect(mouse, Signal (double click), this , slot(xx())) ???

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Add some function to reimplement method

    No, you will not have to make a new method.

    Qt Code:
    1. void MyTextEdit::mouseDoubleClickEvent(QMouseEvent *e) {
    2. QTextEdit::mouseDoubleClickEvent(e);
    3. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Apr 2012
    Posts
    40
    Platforms
    Unix/X11 Windows

    Default Re: Add some function to reimplement method

    ok thx i dont know that

Similar Threads

  1. Calling a method from a non-member method
    By AndresBarbaRoja in forum Newbie
    Replies: 5
    Last Post: 19th March 2011, 10:38
  2. Replies: 1
    Last Post: 25th November 2010, 11:37
  3. Method/Function With QString Arg
    By seanmu13 in forum Qt Programming
    Replies: 2
    Last Post: 7th July 2007, 09:43
  4. Replies: 3
    Last Post: 16th May 2007, 11:07
  5. Calling Recursivly loading function in Run() method of QThread
    By santosh.kumar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 14:42

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.