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

Qt-interest Archive, January 2008
QPointer problem


Message 1 in thread

I have a QPointer
QPointer<StepListForm>	lpStepListForm;

I call
lpStepListForm->close();
...
if (lpStepListForm.isNull())
{
	instruction 1
}
The problem is the event that set lpStepListForm to NULL is process 
after the control lpStepListForm.isNull, so the instruction1 is not 
executed.
I Can't set lpStepListForm = NULL after the close().
Suggestions? Must I use a Semaphore in a separated thread?

Thanks
Teo

--
 [ signature omitted ] 

Message 2 in thread

On Thursday 31 January 2008 16:10:13 matteo wrote:
> I have a QPointer
> QPointer<StepListForm>	lpStepListForm;
>
> I call
> lpStepListForm->close();
> ...
> if (lpStepListForm.isNull())
> {
> 	instruction 1
> }
> The problem is the event that set lpStepListForm to NULL is process
> after the control lpStepListForm.isNull, so the instruction1 is not
> executed.
> I Can't set lpStepListForm = NULL after the close().
> Suggestions? Must I use a Semaphore in a separated thread?

QObject-derived classes can only be used from the thread they were created in 
or moved to. That includes deleting them.

QPointer is thread-safe, meaning you'll either get the object or a null. But 
the access to the object itself isn't, which means you must provide an 
external locking mechanism if you intend to call anything on that object from 
outside its thread.

-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: This is a digitally signed message part.


Message 3 in thread

Dear All

I subclassed QAbstractItemModel and
set the model to QTreeView. And then i display items (Which i create in
subclassed QAbstractItemModel) in a tree structure in the window.

Problem :

When i create the items at the design time, it shows perfectly but when i
create the items at the run time. The Window is not getting updated
although the item is being created in subclasses QAbstractItemModel. I
tried to use update functionality of LayOut and Widget but it doesnt make
any difference. Please help me ,how can i update the VIew when a new item
is added at run time.

Thanks alot......

--
 [ signature omitted ]