Results 1 to 8 of 8

Thread: Q3ListView not being populated.

  1. #1
    Join Date
    Jan 2007
    Posts
    92
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default Q3ListView not being populated.

    I am having a problem for populating list on the screen while using Q3ListView. I am trying to add list dynamically. UI form loads itself properly and Q3Listviews items and values all intialized without any problem but somehow list does not appear at all list just appears empty. Even scroll bar appears that indicates list is there you can move scroll bar up or down but list is not being populated on the screen . I tried to apply trigger update method still did not work.

    Any idea or clue will be helpful.
    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Q3ListView not being populated.

    How do you add the items?

  3. #3
    Join Date
    Jan 2007
    Posts
    92
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default Re: Q3ListView not being populated.

    I inserting items to the list view using insertItem function . here the code snippet from my file .

    Q3ListView * m_pSoftVer;

    Function Def:-

    void cTester::SetVersionNum(CTestdevice * pDevice)
    {
    if(m_pSoftVer)
    {
    m_pSoftVerNo->setText("");
    m_pSoftVer->clear();

    CSoftupdate *pSoftUpdate = NULL;
    CModulecat *pModuleCat = NULL;
    QString strName, strVersion, strMajor, strMinor, strBuild, strPackageVersion;

    try
    {
    - - -
    - - -
    if(pSoftUpdate)
    {

    if(pSoftUpdate->GetVersionNum( pDevice, pModuleCat ))
    {
    m_pSoftVerNo->setText( pModuleCat->GetPackageVersion().c_str() );
    for(int i = 0; pModuleCat->GetNumberOfModules(); i++)
    {
    -- --- ----
    pModuleCat->GetModule(i, &pModuleInfo.Raw());
    strName = pModuleInfo->GetName().c_str();
    strMajor = strMajor.setNum(pModuleInfo->GetMajorVersion());
    strMinor = strMinor.setNum(pModuleInfo->GetMinorVersion());
    strBuild = strBuild.setNum(pModuleInfo->GetBuildNumber());
    strVersion = strMajor + "." + strMinor + "." + strBuild;

    // insert items to the list view
    m_pSoftVer->insertItem( new Q3ListViewItem( m_pSoftVer,
    strName, strVersion ) );


    -----
    -----
    }

  4. #4
    Join Date
    Jan 2007
    Posts
    92
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default Re: Q3ListView not being populated.

    I have ported my code from Qt 3 to Qt 4.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Q3ListView not being populated.

    Quote Originally Posted by user_mail07 View Post
    m_pSoftVer->insertItem( new Q3ListViewItem( m_pSoftVer, strName, strVersion ) );
    This inserts the item twice, try:
    Qt Code:
    1. (void) new Q3ListViewItem( m_pSoftVer, strName, strVersion );
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Jan 2007
    Posts
    92
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default Re: Q3ListView not being populated.

    I tried that still did not work.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Q3ListView not being populated.

    What happens when you use:
    Qt Code:
    1. (void) new Q3ListViewItem( m_pSoftVer, "XXX", "XXX" );
    To copy to clipboard, switch view to plain text mode 
    instead?

  8. The following user says thank you to jacek for this useful post:

    user_mail07 (19th March 2007)

  9. #8
    Join Date
    Jan 2007
    Posts
    92
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default Re: Q3ListView not being populated.

    Problem is solved. Actually after porting to Qt 4, header of Q3listview was not displaying up after loading UI forms. So I had to add manually using addColumn("") method to display header even tough header was present in UI form. After that all items start displaying properly once header was added to the list view.
    Thanks.

Similar Threads

  1. QFormbuilder : can not create widget of Q3ListView
    By user_mail07 in forum Qt Programming
    Replies: 5
    Last Post: 26th January 2007, 23:12
  2. extended selection in q3listview
    By sreedhar in forum Qt Programming
    Replies: 7
    Last Post: 13th November 2006, 09:03
  3. Q3ListView
    By kemp in forum Qt Programming
    Replies: 6
    Last Post: 9th October 2006, 08:58
  4. Q3ListView highlight part of a column
    By sreedhar in forum Qt Programming
    Replies: 1
    Last Post: 5th May 2006, 09:26
  5. container populated with custom widgets
    By momesana in forum Qt Programming
    Replies: 2
    Last Post: 16th April 2006, 21:02

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.