Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, June 2007
QTableView flickering


Message 1 in thread

Hello

I have a program where I use the model/view concept.
The model is derived from QSqlQueryModel and the view
is derived from QTableView. It seems to work fine, but
when I update the model all the table is repainted, and I get
some flickering. I don't understand why the table is completely 
repainted if I only change the content of a cell.

Do you know any way to avoid that behaviour?

Note: I use Qt 4.2

Thanks in advance

-- 
 [ signature omitted ] 

Message 2 in thread

El Domingo, 10 de Junio de 2007 00:39, escribió:
> how are you updating the model?  When your done, are you emitting reset() ?
>  Put a  breakpoint in abstract model's reset signal and see if its getting
> called. --Scott

Thanks Scott for your answer.

I'm updating by means of the function:

QSqlQueryModel::setQuery(myquery);

I've checked the signal modelReset() and it's emited.

What can I do?

-- 
 [ signature omitted ] 

Message 3 in thread

Is the query actually changing? Or are you just trying to update the results?

setQuery, clearly resets the model...

If the DB is constantly change underneath, and new querys are required, I am not sure how your going to avoid flicker... 

But normally, you set the query once before showing attaching the model to a view, and only call setQuery again when you are changing the query.. Especially since QSqlQueryModel is designed for read only views...

Take a look at the query model example.

Hope this helps.

Scott

> -----Original Message-----
> From: Manuel Parrilla [mailto:mparrilla@xxxxxxx]
> Sent: Sunday, June 10, 2007 9:35 AM
> To: qt-interest@xxxxxxxxxxxxx
> Cc: Scott Aron Bloom
> Subject: Re: QTableView flickering
> 
> El Domingo, 10 de Junio de 2007 00:39, escribió:
> > how are you updating the model?  When your done, are you emitting
> reset() ?
> >  Put a  breakpoint in abstract model's reset signal and see if its
> getting
> > called. --Scott
> 
> Thanks Scott for your answer.
> 
> I'm updating by means of the function:
> 
> QSqlQueryModel::setQuery(myquery);
> 
> I've checked the signal modelReset() and it's emited.
> 
> What can I do?
> 
> --
> 
> Manuel Parrilla Sánchez

--
 [ signature omitted ] 

Message 4 in thread

El Domingo, 10 de Junio de 2007 18:48, Scott Aron Bloom escribió:
> Is the query actually changing? Or are you just trying to update the
> results?
>
I'm trying to update the results, but I don't know how to do it without using
setQuery.

> setQuery, clearly resets the model...
>
> If the DB is constantly change underneath, and new querys are required, I
> am not sure how your going to avoid flicker...
>
> But normally, you set the query once before showing attaching the model to
> a view, and only call setQuery again when you are changing the query..
> Especially since QSqlQueryModel is designed for read only views...
>
My model is read-write, and when I edit any data in the table I'd like to
update the modifications whitout repainting all the table. 

Any suggestion?

> Take a look at the query model example.
>
I've done it, but I don't find the key.

-- 
 [ signature omitted ]