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

Qt-interest Archive, March 2002
QListViewItem updation


Message 1 in thread

Once again i am unable to solve the QListViewItem

i am using qt3.0 libraries libqt-mt.so. 

In a recursive loop if i tried to add something to the listview it seems that
list is updated only after the loop get's over. otherwise while the loop is 
executing my listview doesn't seems to refresh and grayish windows appears 
instead. i tried doing the same in a seperate thread too but to no avail.

my program will actually receive sockets calls in asynchronous mode prob is 
that unless i get out of the loop the qlistview doesn't seems to be updated. 

is there any solution for this or where am i going wrong.


cheers
Rohit



ListView->viewport()->setUpdatesEnabled(TRUE);
for(int i=1;i<4500;i++)
{
new QListViewItem( ListView, "rohit" );
ListView->triggerUpdate();
}    


Message 2 in thread

On Thursday 07 March 2002 12:12, you wrote:
> ListView->viewport()->setUpdatesEnabled(TRUE);
> for(int i=1;i<4500;i++)
> {
> new QListViewItem( ListView, "rohit" );
> ListView->triggerUpdate();
> }

As far as I know, "update" queues a repaint for when you next visit the Qt 
event loop (and redundant updates are discarded).  In other words, the above 
code might translate into just one repaint, which happens only when your 
functions have all returned.

Try to use something like QWidget::repaint(), which does an immediate repaint.

If that doesn't work for QListView, a last resort is to try returning to the 
Qt event loop between blocks of inserts.

-Justin


Message 3 in thread

Hi Folks,

I want to subclass a QFileDialog to add some extra widgets.
I'd like to use the native Windows Open File dialog by
using getOpenFileName(), as otherwise network drives do
not seem to be accessible in the basic QFileDialog.
However, it seems that there is no way to modify the native
dialog - is this true?

Assuming I have to use a QFileDialog in order to add widgets,
how do I get it to see network files?

- Keith


Message 4 in thread

Keith,

at least a starting point:

The WNetOpenEnum, WNetEnumResource and WNetCloseEnum functions allow
to enumerate the shared drives (and printers, but that is of less interest
here).
The MSDN docs provide an example how to put these functions to good use.

More work will be needed to show the found shares in the 
QFileDialog history list: the functions may take some time to complete,
so just adding them may cause an unwanted delay. One would rather want
to see a treeview in the combobox and open the shared drives explicitly.

Had the same problem, but there was never time to implement it yet...

HTH,
Soeren


> Hi Folks,
> 
> I want to subclass a QFileDialog to add some extra widgets.
> I'd like to use the native Windows Open File dialog by
> using getOpenFileName(), as otherwise network drives do
> not seem to be accessible in the basic QFileDialog.
> However, it seems that there is no way to modify the native
> dialog - is this true?
> 
> Assuming I have to use a QFileDialog in order to add widgets,
> how do I get it to see network files?


Message 5 in thread

nope  it didn't helped 

QWidget * widget = new QWidget(ListView);
ListView->viewport()->setUpdatesEnabled(TRUE);
for(int i=1;i<4500;i++)
{
new QListViewItem( ListView, "rohit" );
widget->repaint();
ListView->triggerUpdate();
}    


about the second option that is left could you please explain how do i move to 
the QT event loop or should i use a different class at all like QTable or 
something else. prob is that i do not want the table but if it won't work i 
will have no resort but to try some other class. :-( 



thanx for your time
cheers
Rohit



On Friday 08 March 2002 05:37 am, Justin wrote:
> On Thursday 07 March 2002 12:12, you wrote:
> > ListView->viewport()->setUpdatesEnabled(TRUE);
> > for(int i=1;i<4500;i++)
> > {
> > new QListViewItem( ListView, "rohit" );
> > ListView->triggerUpdate();
> > }
>
> As far as I know, "update" queues a repaint for when you next visit the Qt
> event loop (and redundant updates are discarded).  In other words, the
> above code might translate into just one repaint, which happens only when
> your functions have all returned.
>
> Try to use something like QWidget::repaint(), which does an immediate
> repaint.
>
> If that doesn't work for QListView, a last resort is to try returning to
> the Qt event loop between blocks of inserts.
>
> -Justin


Message 6 in thread

Hi,

>
> about the second option that is left could you please explain how do i move
> to the QT event loop or should i use a different class at all like QTable
> or something else. prob is that i do not want the table but if it won't
> work i will have no resort but to try some other class. :-(
>

process the events of the event loop i.e. every 100 records:

for(int i=1;i<4500;i++)
{
  new QListViewItem( ListView, "rohit" );
  if(!(i % 100))
    qApp->processEvents();
}

That will slow it down a little bit, but the display will be alright.

greetings,
P.J.


-- 
 [ signature omitted ]