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.
Re: Q3ListView not being populated.
How do you add the items?
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 ) );
-----
-----
}
Re: Q3ListView not being populated.
I have ported my code from Qt 3 to Qt 4.
Re: Q3ListView not being populated.
Quote:
Originally Posted by
user_mail07
m_pSoftVer->insertItem( new Q3ListViewItem( m_pSoftVer, strName, strVersion ) );
This inserts the item twice, try:
Code:
(void) new Q3ListViewItem( m_pSoftVer, strName, strVersion );
Re: Q3ListView not being populated.
I tried that still did not work.
Re: Q3ListView not being populated.
What happens when you use:
Code:
(void) new Q3ListViewItem( m_pSoftVer, "XXX", "XXX" );
instead?
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.