[Solved] Blank space in QComboBox
-
wrote on 19 Apr 2013, 08:58 last edited by
I'm adding the items to the QComboBox via SQL query. Just as below.
while (query.next())
{
ui->comboBox_Version->addItem(query.value(0).toString());
}It is successful.
But the problem is when initially load the window, there is a blank space on top of the items of the QComboBox. And it may cause user to select blank space.
How I avoid that?
Thanks in advance..
P.S. I'm new to Qt. Sometimes this may be a stupid question. :)
-
you need to select an item after you've filled it up.
-
wrote on 19 Apr 2013, 10:56 last edited by
@ raven-worx,
Thank you very much for the reply.
This is due to I read the saved property when loading the Window. Because it is null in the initial state it passes -1 as selected index. And QComboBox display it as a blank space.
So as your answer I set the default value for the property. Now it is working fine.
Thanks again...
1/3