Results 1 to 2 of 2

Thread: Need help in setting the background of a QListPickSelector entry to an image ..

  1. #1
    Join Date
    Jun 2010
    Posts
    26
    Qt products
    Qt4
    Platforms
    Windows Symbian S60 Maemo/MeeGo

    Default Need help in setting the background of a QListPickSelector entry to an image ..

    Hi all .... I'm using a QListPickSelector in my project and the idea is that it displays a set of images, rather than a list of strings .. Now I have tried using the setIcon() function, which works, but the image displayed is very tiny .. !

    Here is the output I get when I use the setIcon() function:



    As you can see, the image displayed is *very* tiny ... I would like it to be filled throughout its respective list entry area (which is also rectangular) ...

    I am trying to use the setBackground() function by passing it a QBrush, which has the said image as its texture .. but when I try this, nothing happens, the background is setting black as usual .. Can somebody help me with this .. ?

    Here is one variable of many different combinations I have tried:

    Qt Code:
    1. QBrush brush;
    2. brush.setTexture(QPixmap(":/p1.png"));
    3. brush.setStyle(Qt::TexturePattern);
    4.  
    5. int i,j,k;
    6. for(j=0;j<=1;j++)
    7. {
    8. k=0;
    9. for(i=0;i<=9;i++)
    10. {
    11. QStandardItem *item = new QStandardItem("Hello");
    12. item->setBackground(brush);
    13. k+=5;
    14. model->setItem(i,j,item);
    15. }
    16. }
    17. canvasBackgroundTypeSelector->setModel(model);
    To copy to clipboard, switch view to plain text mode 

    I really need help with this ..

  2. #2
    Join Date
    Jun 2010
    Posts
    26
    Qt products
    Qt4
    Platforms
    Windows Symbian S60 Maemo/MeeGo

    Default Re: Need help in setting the background of a QListPickSelector entry to an image ..

    Can someone help me with this please ?

Similar Threads

  1. Replies: 10
    Last Post: 10th November 2010, 03:12
  2. Setting QDial background image using stylesheet
    By dpatel in forum Qt Programming
    Replies: 0
    Last Post: 28th April 2010, 13:13
  3. Setting background image for Central Widget
    By xfurrier in forum Qt Programming
    Replies: 8
    Last Post: 25th February 2010, 10:14
  4. Replies: 0
    Last Post: 6th April 2009, 01:20
  5. Setting background image of QFrame
    By Claymore in forum Qt Programming
    Replies: 2
    Last Post: 12th February 2007, 19:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.