Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Add some function to reimplement method

Add some function to reimplement method

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pablik2005
    wrote on last edited by
    #1

    Hi
    I want add:
    [code]
    if( !anchorAt( e->pos() ).isEmpty() )
    QMessageBox::information(0,"",anchorAt( e->pos() ));
    [/code]
    to orginal(default, not edited) method "mouseDoubleClickEvent" in qtextedit.

    If i make my own method
    [code]
    void MyTextEdit::mouseDoubleClickEvent(QMouseEvent *e)
    {
    if( !anchorAt( e->pos() ).isEmpty() )
    QMessageBox::information(0,"",anchorAt( e->pos() ));
    }
    [/code]
    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
    [code]
    void MyTextEdit::mouseDoubleClickEvent(QMouseEvent *e)
    {
    //i have to finde default code mouseDoubleClickEventand and past here

    if( !anchorAt( e->pos() ).isEmpty() )
        QMessageBox::information(0,"",anchorAt( e->pos() ));
    

    }
    [/code]

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

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Pablik2005
      wrote on last edited by
      #2

      ok i hav solution
      [code]
      void MyTextEdit::mouseDoubleClickEvent(QMouseEvent *e)
      {
      QTextEdit::mouseDoubleClickEvent(e);
      if( !anchorAt( e->pos() ).isEmpty() )
      QMessageBox::information(0,"",anchorAt( e->pos() ));
      }
      [/code]

      1 Reply Last reply
      0
      • R Offline
        R Offline
        raaghuu
        wrote on last edited by
        #3

        that is correct... although you might want to do it the other way round-QTextEdit::mouseDoubleClickEvent(e) after your code... in this case it doesn't matter, but in some cases it might

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved