Results 1 to 8 of 8

Thread: x11,about qwidget::repaint()

  1. #1
    Join Date
    Aug 2008
    Location
    Nanjing, China
    Posts
    66
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default x11,about qwidget::repaint()

    Hi all
    I use QTableView,QTableModel(inherit QAbstractTableModel)to display data.
    Every second, I change the background color in model and emit signal.In the slot, I use tableview->viewPort()->repaint() to repaint the tableview.

    In windows, the program works well. But in x11(suse), the background color does not change at all.

    Please give a clue! Thank you in advance.


    ps: I use qApp->processEvents() after tableview->viewPort()->repaint().But has no effect.In qt assistant there is int QApplication::x11ProcessEvent ( XEvent * ), but I do not know how to use it. what is a xevent?
    Last edited by calmspeaker; 7th December 2009 at 01:40.
    Jerry

  2. #2
    Join Date
    Aug 2008
    Location
    Nanjing, China
    Posts
    66
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: x11,about qwidget::repaint()

    I also tried this way:
    Qt Code:
    1. emit dataChanged(this->index(0,0),this->index(this->rowCount(),0));
    To copy to clipboard, switch view to plain text mode 
    But it cannot repaint the tableview immediately in windows XP( cannot get the "Blink" result!) and it did not repaint the tableview at all int SUSE.
    Jerry

  3. #3
    Join Date
    Aug 2008
    Location
    Nanjing, China
    Posts
    66
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: x11,about qwidget::repaint()

    I make a small piece of code, the pro works well in windows xp(compile by vc2008) and does not work in SUSE(compile by gcc)
    Attached Files Attached Files
    Jerry

  4. #4
    Join Date
    Aug 2008
    Location
    Nanjing, China
    Posts
    66
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: x11,about qwidget::repaint()

    I just tried the code in solaris,it works either.
    Now, the question is, the code works in windows xp,solaris, does not work in SUSE.
    If my way cannot go through,can anybody tell me that how to change the background color of column of QTableView every second which works in SUSE,solaris,windowsXP?
    Last edited by calmspeaker; 8th December 2009 at 02:36.
    Jerry

  5. #5
    Join Date
    Aug 2008
    Location
    Nanjing, China
    Posts
    66
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: x11,about qwidget::repaint()

    Quote Originally Posted by calmspeaker View Post
    Hi all
    I use QTableView,QTableModel(inherit QAbstractTableModel)to display data.
    Every second, I change the background color in model and emit signal.In the slot, I use tableview->viewPort()->repaint() to repaint the tableview.

    In windows, the program works well. But in x11(suse), the background color does not change at all.

    Please give a clue! Thank you in advance.


    ps: I use qApp->processEvents() after tableview->viewPort()->repaint().But has no effect.In qt assistant there is int QApplication::x11ProcessEvent ( XEvent * ), but I do not know how to use it. what is a xevent?
    I use QTableView and TableModel (not QTableModel)
    是谁导演这场戏,在这孤单角色里。。。。。
    Jerry

  6. #6
    Join Date
    Sep 2009
    Location
    Tashkent, Uzbekistan
    Posts
    107
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: x11,about qwidget::repaint()

    Quote Originally Posted by calmspeaker View Post
    Hi all
    I use QTableView,QTableModel(inherit QAbstractTableModel)to display data.
    Every second, I change the background color in model and emit signal.In the slot, I use tableview->viewPort()->repaint() to repaint the tableview.

    In windows, the program works well. But in x11(suse), the background color does not change at all.

    Please give a clue! Thank you in advance.


    ps: I use qApp->processEvents() after tableview->viewPort()->repaint().But has no effect.In qt assistant there is int QApplication::x11ProcessEvent ( XEvent * ), but I do not know how to use it. what is a xevent?
    Hi, X11 is *NIX GUI core.So X11 events are *NIX GUI core events. Qt operates on top of that. Also the code for MS and *NIX is a bit different. You can read that in assistant. And why do you need to repaint so frequently? You can use repaint only cell changes, not the whole table. If it will run slow then you can try QGraphicsView.

    Best regards.

  7. #7
    Join Date
    Aug 2008
    Location
    Nanjing, China
    Posts
    66
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Unhappy Re: x11,about qwidget::repaint()

    Quote Originally Posted by Tanuki-no Torigava View Post
    Hi, X11 is *NIX GUI core.So X11 events are *NIX GUI core events. Qt operates on top of that. Also the code for MS and *NIX is a bit different. You can read that in assistant. And why do you need to repaint so frequently? You can use repaint only cell changes, not the whole table. If it will run slow then you can try QGraphicsView.

    Best regards.
    Becasue I need to remind the user of the information(the alarm of the scada system) .
    I am also considering that repaint the first column of the tableview to reduce the cost of cpu.But now there is a more serious problem as you know.

    I just looked into the assistant. But nothing I got.
    Jerry

  8. #8
    Join Date
    Aug 2008
    Location
    Nanjing, China
    Posts
    66
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: x11,about qwidget::repaint()

    the problem is solved.
    The reason is: bool m_change is not initalized. In gcc, m_change = !change cannot change the m_change's value.

    Thanks all.
    Jerry

Tags for this Thread

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.