Results 1 to 4 of 4

Thread: event

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2007
    Posts
    104
    Thanks
    22
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default event

    Qt Code:
    1. bool ProgramEditor::event(QEvent *e)
    2. {
    3.  
    4. switch(e->type())
    5. {
    6. case QEvent::ShortcutOverride:
    7. keyPressEvent((QKeyEvent*)e);
    8. break;
    9. case QEvent::Close:
    10. closeEvent((QCloseEvent *)e);
    11. e->accept();
    12. break;
    13. default:
    14. break;
    15. }
    16. return QWidget::event(e);
    17. }
    To copy to clipboard, switch view to plain text mode 
    This my overloaded event function.I realized that my keyPressEvent is called twice.I tried to delete QWidget::event(e) but this time program didnt execute well.So How can I use event ? Thanks.
    Last edited by jpn; 12th December 2007 at 13:42. Reason: missing [code] tags

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: event

    Hmm, what are you trying to do?

    PS. Please use [code]-tags around code snippets.
    J-P Nurmi

  3. #3
    Join Date
    Jul 2007
    Posts
    104
    Thanks
    22
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: event

    I tried to control shortcuts(button1:F1...) So I used
    Qt Code:
    1. case QEvent::ShortcutOverride:
    To copy to clipboard, switch view to plain text mode 
    function.When F1 is pressed (means button1 is clicked()) I can handle but twice.It is called from QApplication file too.
    But now I agreed to try that:
    Qt Code:
    1. connect(button1,SIGNAL(clicked( )),this,SLOT(function( ))
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: event

    You can assign shortcuts to actions and buttons, and there is QShortcut too..
    J-P Nurmi

Similar Threads

  1. QDockWidget-title
    By moowy in forum Qt Programming
    Replies: 18
    Last Post: 23rd April 2014, 20:13
  2. Replies: 1
    Last Post: 16th October 2007, 22:41
  3. Create new an event, help me?
    By dungsivn in forum Qt Programming
    Replies: 6
    Last Post: 4th July 2007, 11:22
  4. The event fired by the mouse click on the frame
    By Placido Currò in forum Qt Programming
    Replies: 8
    Last Post: 3rd March 2007, 09:05
  5. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55

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.