×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    32

    How to add more items in QListWidget

    Hi all,

    Previously I posted this question on Qt sdk

    How to add more items in QListWidget ?

    Below is the code I am using, it gives error as "memory full" in device (N8)

    void gotItem(IndividualSearchData *item)
    {

    Cell* cell = new Cell();
    cell->setTitle(item->m_Title);
    cell->setDescription(item->m_ShortDescription);
    cell->setImage(item->m_IconURL);
    connect(cell,SIGNAL(imageButtonClicked(QPixmap)),this,SLOT(previewImage(QPixmap)));
    QListWidgetItem *dataItem= new QListWidgetItem(ui->listWidget);

    dataItem->setSizeHint(QSize(430,189));
    ui->listWidget->addItem(dataItem);
    ui->listWidget->setItemWidget(dataItem,cell);

    }


    Cell is a sub class of of QWidget and contains three labels "title", "discription" and pass url as parameter.

    The cell download the image from this url.

    The gotItem method is called for about 400-500 times(whenever we get data from server)

    I checked with memory, it keeps on increasing, but how to reduce this ?

    Please let me know how to achieve this.


    The thing is I get Data from the server after parsing I get 3 strings one for title one for description and string as url, I need to down load the image and show it.
    I want show the text data first(title and description) and then image as it downloads from the server.

    I have tried without image and reducing the items around 100-150 still memory keep on increasing.

    Thanks in advance

    siddu

  2. #2
    Registered User
    Join Date
    Aug 2006
    Location
    Poland
    Posts
    36

    Re: How to add more items in QListWidget

    Hi Siddu,
    I'm guessing that you have memory leak becuase you didn't set the parent for you "Cell" item that you created on the heap.

    Best regards,
    Mido

  3. #3
    Registered User
    Join Date
    Aug 2006
    Location
    Poland
    Posts
    36

    Re: How to add more items in QListWidget

    Hi again :-),
    If you are using QT for Symbian, Try to increase the heap size for your application. Check the link below in order to do that:
    Heap memory available for an application

    Good luck!
    Mido

  4. #4
    Registered User
    Join Date
    Dec 2010
    Posts
    32

    Re: How to add more items in QListWidget

    Hi Muhammad_hakim,

    Thanks for the reply,

    I have used ui->listWidget->setItemWidget(dataItem,cell);

    I thought ui->listWIdget would be a parent.

    if not which is the parent of cell now ?

    Please let me know, I am fed up with this for pas 3 days .


    Thanks,
    Siddu

  5. #5
    Registered User
    Join Date
    Dec 2010
    Posts
    32

    Re: How to add more items in QListWidget

    Hi

    What is the maximum heap size allowed for N8 devce ?

    As I read http://www.nokian8.mobi/n8-features/
    its unlinited ?


    Thanks,
    Siddu

  6. #6
    Registered User
    Join Date
    Aug 2006
    Location
    Poland
    Posts
    36

    Re: How to add more items in QListWidget

    I think the parent of your "Cell" objects should be "ui->listWidget".

    Regards,
    Mido

  7. #7
    Registered User
    Join Date
    Aug 2006
    Location
    Poland
    Posts
    36

    Re: How to add more items in QListWidget

    Quote Originally Posted by siddugh View Post
    Hi

    What is the maximum heap size allowed for N8 devce ?

    As I read http://www.nokian8.mobi/n8-features/
    its unlinited ?


    Thanks,
    Siddu
    The following is extracted from symbian documentation:

    epocheapsize
    epocheapsize minimum maximum

    Use the epocheapsize statement to specify the minimum and maximum sizes of the initial heap for a process. The default sizes are 4KB minimum and 1MB maximum.This directive is applicable from Symbian OS v9.1, EKA2 releases. EKA2 supports multiple process creation and allows the heap size to be calibrated between the minimum and maximum limits.

    The minimum size specifies the RAM that is initially mapped for the heap's use. The process can then obtain more heap memory on demand until the maximum value is reached.

    The sizes can be specified in decimal or hexadecimal format. Memory is allocated in pages, so the minimum and maximum values are rounded up to a multiple of the page size (4K).

  8. #8
    Registered User
    Join Date
    Aug 2006
    Location
    Poland
    Posts
    36

    Re: How to add more items in QListWidget

    Yes, It's unlimited within the limits of your phone available/free memory :-).
    There's a default value And if you need to increase it you should use the macro as I mentioned in my last reply.

    Also, you can check the following link, I think you may have similar issue with memory:
    http://bugreports.qt.nokia.com/browse/QTBUG-15716

    Best regards,
    Mido

  9. #9
    Registered User
    Join Date
    Dec 2010
    Posts
    32

    Re: How to add more items in QListWidget

    Hi muhammad_hakim,

    I will check by changing the heap limit,

    Currently as you said I set Cell parent to ui->listWidget, and also scaled the image after downloading, now the memory comes around 50MB, I am running on mac and using the instrument tool to check the memory.


    Thanks,
    Siddu

Similar Threads

  1. How to add more items in QListWidget
    By siddugh in forum [Archived] Qt SDKs and Tools
    Replies: 12
    Last Post: 2011-01-03, 05:23
  2. Replies: 6
    Last Post: 2010-12-03, 14:46
  3. Multiline items in QListWidget
    By pavel_turbin in forum Qt
    Replies: 2
    Last Post: 2010-07-10, 20:26
  4. QListWidget - owner drawn items
    By tamhanna in forum Qt
    Replies: 4
    Last Post: 2010-04-28, 09:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •