View Single Post
Posts: 341 | Thanked: 57 times | Joined on Nov 2009
#7
Originally Posted by Rob1n View Post
The only thing I can see that might work is to do it via setBackground.
Yeah thats what I thought too, but its not working for some reason .. This is what I'm trying:

Code:
            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);
EDIT: In the above code I'm setting the foreground instead of background .. I did this because I tried setting the background first, but it didn't do anything .. i tried it on the foreground then to see if the foreground text gets written using the texture from the image, but instead the text was just black instead of white now .. I'm wondering if the image itself is being loaded properly or not ..

Last edited by ahmadka; 2010-07-02 at 15:50.