2008-09-05

New Article

I don't know for how long it has been available on-line, but I wrote another article for Qt Quarterly. For your reading pleasure: Designing Delegates.

Labels:

3 Comments:

At 9:11 PM, Blogger elvis said...

Nice and technical article. I appreciated it a lot. However I think you're leaking your model. Probably want to have it as a child of the dialog and let Qt free it for you:

--- treedialog.cpp.orig 2008-09-05 21:05:59.000000000 +0200
+++ treedialog.cpp 2008-09-05 21:06:13.000000000 +0200
@@ -56,7 +56,7 @@

void TreeDialog::populateTree()
{
- QStandardItemModel *model = new QStandardItemModel();
+ QStandardItemModel *model = new QStandardItemModel( this );

QStandardItem *parentItem = model->invisibleRootItem();
for( int i=0; i<4; ++i)

Only a tiny 9K in your example, but could be more in real life :)

 
At 9:33 PM, Blogger Johan Thelin said...

Of course, you're right. Sorry about that. My mind got sucked into some sort of the-view-takes-ownership-of-the-model-idea...

 
At 10:02 PM, Blogger elvis said...

:)

 

Post a Comment

<< Home