Results 1 to 6 of 6

Thread: Need Qt Optimization for 32MB ram Machine

  1. #1
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Need Qt Optimization for 32MB ram Machine

    Hello All,

    I am using QT 4.3 , My Application should be run on 32 mb ram machine, I am using ListWidget in my application , each time when i press up and down button i am giving scrolling of elements by using scrolltoitem() which in term takes items from QList as follows,

    QList<QListWidgetItem*> listItem1=m_pListWidget->findItems(list.value(position),Qt::MatchExactly );

    if(!listItem.isEmpty())
    m_pListWidget->scrollToItem(listItem1.value(0),QAbstractItemView ::PositionAtTop);

    Here m_pListWidget is QListWidget, list is QList which has whole data

    Like this I have 4 ListWidgets While scrolling like this its taking more time,


    Is there any option to optimize application by disabling unwanted options from qt Makefile or Configure file, Because my application should be run on 32 mb ram machine
    Thanks,
    Rajesh.S

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Need Qt Optimization for 32MB ram Machine

    For minimal memory consumption and better performance you should forget about QListWidget and go with QListView + efficiently written simple custom model.
    J-P Nurmi

  3. #3
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Need Qt Optimization for 32MB ram Machine

    hello sir,

    Please give me idea about how to use qlistview and how to wrie custom modal,
    Thanks,
    Rajesh.S

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Need Qt Optimization for 32MB ram Machine

    You could try out with QStringListModel which is a simple wrapper model for QStringList. To get even more control, go with subclassing QAbstractListModel after reading model subclassing reference.
    J-P Nurmi

  5. #5
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: Need Qt Optimization for 32MB ram Machine

    Hello sir,

    Please give som simple example how to use Listview,
    Thanks,
    Rajesh.S

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Need Qt Optimization for 32MB ram Machine

    Now that you're currently using QListWidget, does it contain anything else but strings? QStringListModel which is very easy to use:
    Qt Code:
    1. #include <QtGui>
    2.  
    3. int main(int argc, char *argv[])
    4. {
    5. QApplication a(argc, argv);
    6. QStringList items = QStringList() << "1" << "2" << "3";
    7. QListView* view = new QListView;
    8. QStringListModel* model = new QStringListModel(items);
    9. view->setModel(model);
    10. view->show();
    11. return a.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 
    Just be aware that QStringListModel is not able to store anything else but strings (Qt:isplayRole & Qt::EditRole).

    Also, get rid of managing several list of same data and finding items like that upon every key press.
    J-P Nurmi

Similar Threads

  1. Optimization specifics with qmake
    By bitChanger in forum Qt Programming
    Replies: 1
    Last Post: 29th August 2006, 17:55

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.