PDA

View Full Version : Problem while using QComboBox



merry
10th December 2007, 09:21
Hi all

Working on Qt4.2 .

Actually I am having problem with the QCombobox

I am trying to insert list of drives in my system at runtime.

All the list of drives are inserted in the QComboBox ,but if the item is one ,it displays the space for two items , and if the items are two ,it displays the space for four items ,
I dont understand why it is so:

I had done like this:


void ShowDrivesinCombo()
{
Combo_SelectDrive->clear();
DriveInfo *m_pDriveInfo = NULL;
m_pDriveInfo = pDriveListStart;

while(m_pDriveInfo)
{
m_strDrivesInfoList<< tr((const char *) m_pDriveInfo->DisplayLable);
m_pDriveInfo = m_pDriveInfo->next;
}
Combo_SelectDrive->addItems(m_strDrivesInfoList);
Combo_SelectDrive->setEditable(false);
Combo_SelectDrive->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);

}




Pls tell me wat to do now?

Thanx

wysota
10th December 2007, 10:05
Maybe m_strDrivesInfoList is not empty?

high_flyer
10th December 2007, 14:28
or maybe for some reason m_pDriveInfo->DisplayLable delivers an empty node after each full one?
Wait... do you mean the size of the combo box - as in its width? or the size of the drop down list?

jpn
10th December 2007, 17:28
Perhaps you should use QDir::drives()? ;)

merry
20th December 2007, 09:53
Hi all

Again while using QComboBox I got another problem.

I am working on a dialog Based application

At run Time , I am adding items in the QComboBox , in one dialog , After selecting item from the QComboBox , I switch over to another dialog and while moving on another dialog , then the process runs according to the item selected from the QComboBox.

If I select Second item from the QComboBox , and then runs the process in another dialog always runs according to the first item and not the item that is selected by me.

I dont understand what to do

Regards

jpn
20th December 2007, 10:21
Do you use the current index anyhow?

merry
20th December 2007, 10:22
Yaa , Thanx my Problem is solved.