Results 1 to 3 of 3

Thread: How to update eventFilter function?

  1. #1
    Join Date
    Apr 2009
    Location
    İstanbul, Türkiye
    Posts
    26
    Thanks
    1

    Default How to update eventFilter function?

    How to update eventFilter function?

    I use update( ) function but it`s not worked .

    bool CLASS_NAME::eventFilter(QObject *o, QEvent *e)
    {
    for ( int i = 0; i < 42; i++ ) {

    if (o == tree_widget[i]->viewport() && e->type() == QEvent::Paint) {

    QPainter p;

    p.begin(tree_widget[i]->viewport() );

    p.drawText( 35, 70, "something");

    p.end();
    }
    }

    return QWidget::eventFilter(o, e);
    }

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to update eventFilter function?

    You cannot paint outside the paintEvent method. That is one of the key rules of Qt widgets. What is it that you are trying to achieve? It looks as if you should sub-class the QTreeWidget, reimplement paintEvent and then call the QTreeWidget's paintEvent function at the end.

  3. #3
    Join Date
    Apr 2009
    Location
    İstanbul, Türkiye
    Posts
    26
    Thanks
    1

    Default Re: How to update eventFilter function?

    I can paint using eventFilter. But it`s worked when program started.

    I try to achive; when clicked button, draw differrent text.

Similar Threads

  1. QPSQL problem
    By LoneWolf in forum Installation and Deployment
    Replies: 60
    Last Post: 4th November 2009, 15:22
  2. Regading Driver to connect Postgresql Database
    By dummystories in forum Installation and Deployment
    Replies: 38
    Last Post: 12th March 2009, 08:19
  3. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 13:57
  4. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 18:33
  5. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 13:52

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.