![]() |
2010-06-28
, 16:06
|
Posts: 341 |
Thanked: 57 times |
Joined on Nov 2009
|
#1
|
![]() |
2010-06-28
, 16:49
|
Posts: 180 |
Thanked: 76 times |
Joined on May 2010
|
#2
|
![]() |
2010-07-02
, 13:55
|
Posts: 341 |
Thanked: 57 times |
Joined on Nov 2009
|
#3
|
![]() |
2010-07-02
, 14:22
|
Posts: 3,617 |
Thanked: 2,412 times |
Joined on Nov 2009
@ Cambridge, UK
|
#4
|
Yes but I tried using QStandardItem once before, and the problem I faced was that nothing actually showed up on the screen !?
Full details on this problem are here: http://talk.maemo.org/showpost.php?p=732549&postcount=4
The Following User Says Thank You to Rob1n For This Useful Post: | ||
![]() |
2010-07-02
, 15:11
|
Posts: 341 |
Thanked: 57 times |
Joined on Nov 2009
|
#5
|
Looking at that again now - you appear to be creating the QStandarditemModel as a local variable (i.e. on the stack), so it will be destroyed when it goes out of context. I had a similar issue using PyQt. Have you tried creating it on the heap instead (i.e. QStandardItem *model = new QStandardItemModel(10,2))?
![]() |
2010-07-02
, 15:40
|
Posts: 3,617 |
Thanked: 2,412 times |
Joined on Nov 2009
@ Cambridge, UK
|
#6
|
![]() |
2010-07-02
, 15:44
|
Posts: 341 |
Thanked: 57 times |
Joined on Nov 2009
|
#7
|
QImage *bg = new QImage(":/p1.png"); QBrush *brush = new QBrush(*bg); QStandardItemModel *model = new QStandardItemModel(10,2); int i,j,k; for(j=0;j<=1;j++) { k=0; for(i=0;i<=9;i++) { QStandardItem *item = new QStandardItem("Hello"); item->setForeground(*brush); model->setItem(i,j,item); } } canvasBackgroundTypeSelector->setModel(model);
![]() |
2010-07-03
, 10:16
|
Posts: 341 |
Thanked: 57 times |
Joined on Nov 2009
|
#8
|