PDA

View Full Version : Q3ListView not being populated.



user_mail07
13th March 2007, 19:57
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.

jacek
13th March 2007, 20:15
How do you add the items?

user_mail07
14th March 2007, 01:50
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 ) );


-----
-----
}

user_mail07
14th March 2007, 19:54
I have ported my code from Qt 3 to Qt 4.

jacek
14th March 2007, 20:38
m_pSoftVer->insertItem( new Q3ListViewItem( m_pSoftVer, strName, strVersion ) );
This inserts the item twice, try:
(void) new Q3ListViewItem( m_pSoftVer, strName, strVersion );

user_mail07
14th March 2007, 23:58
I tried that still did not work.

jacek
15th March 2007, 00:12
What happens when you use:
(void) new Q3ListViewItem( m_pSoftVer, "XXX", "XXX" ); instead?

user_mail07
19th March 2007, 15:54
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.