Results 1 to 6 of 6

Thread: event problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: event problem

    Quote Originally Posted by windkracht8
    Anyone any idea how this is possible?
    You don't invoke the base class implementation.

    Try:
    Qt Code:
    1. bool frmMain::event(QEvent* event)
    2. {
    3. if(event->type() == QEvent::User){
    4. bC* eTemp = (bC*)event;
    5. iTemp = eTemp->rij();
    6. iTemp2 = eTemp->col();
    7. knopGeklikt(iTemp,iTemp2);
    8. event->accept();
    9. return true;
    10. }
    11. return QWidget::event( event );
    12. }
    To copy to clipboard, switch view to plain text mode 
    or better:
    Qt Code:
    1. bool frmMain::customEvent(QEvent* event)
    2. {
    3. if(event->type() == QEvent::User){
    4. bC* eTemp = (bC*)event;
    5. iTemp = eTemp->rij();
    6. iTemp2 = eTemp->col();
    7. knopGeklikt(iTemp,iTemp2);
    8. event->accept();
    9. return true;
    10. }
    11. return QWidget::customEvent( event );
    12. }
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to jacek for this useful post:

    windkracht8 (17th August 2006)

  3. #2
    Join Date
    Aug 2006
    Posts
    27
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2
    Thanked 2 Times in 1 Post

    Default Re: event problem

    Qt is getting a little more clear now. Thanks for the respons.
    One more question though:

    This piece of code:
    Qt Code:
    1. bool frmMain::customEvent(QEvent* event)
    2. {
    3. if(event->type() == QEvent::User){
    4. bC* eTemp = (bC*)event;
    5. iTemp = eTemp->rij();
    6. iTemp2 = eTemp->col();
    7. knopGeklikt(iTemp,iTemp2);
    8. event->accept();
    9. return true;
    10. }
    11. return QWidget::customEvent( event );
    12. }
    To copy to clipboard, switch view to plain text mode 
    Gave the error that "virtual bool QObject::customEvent(QEvent* event)" was overwriting
    "virtual void QObject::customEvent(QEvent* event)".
    So I'm going with this at the moment:
    Qt Code:
    1. void frmMain::customEvent(QEvent* event)
    2. {
    3. bC* eTemp = (bC*)event;
    4. iTemp = eTemp->rij();
    5. iTemp2 = eTemp->col();
    6. knopGeklikt(iTemp,iTemp2);
    7. event->accept();
    8. }
    To copy to clipboard, switch view to plain text mode 
    Should be ok right?
    I removed the "if(event->type() == QEvent::User)" statement becauss it looks obsolete, since customEvent doesn't get anything else then the "QEvent::User" and I only use one customevent.

    Thanks all,
    Bart.

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

    Default Re: event problem

    Quote Originally Posted by windkracht8
    Should be ok right?
    I removed the "if(event->type() == QEvent::User)" statement becauss it looks obsolete, since customEvent doesn't get anything else then the "QEvent::User" and I only use one customevent.
    Yep, then looks fine.
    J-P Nurmi

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: event problem

    Quote Originally Posted by windkracht8
    Gave the error that "virtual bool QObject::customEvent(QEvent* event)" was overwriting
    "virtual void QObject::customEvent(QEvent* event)".
    I don't know where I saw that bool

Similar Threads

  1. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  2. Problem with receiving events from QDateEdit
    By gunhelstr in forum Qt Programming
    Replies: 4
    Last Post: 20th April 2006, 11:21
  3. 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
  4. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.