Have found the solution after writing bug report to nokia. Solution: connect signal currentIndexChanged(int) of the combobox (signal activated(QModelIndex) from QTreeView was not emitted for some reason) and process it in a slot to change parent items color and font when selected:
connect(myCombobox, SIGNAL(currentIndexChanged(int)), myCombobox, SLOT(setupComboboxFont()));
connect(myCombobox, SIGNAL(currentIndexChanged(int)), myCombobox, SLOT(setupComboboxFont()));
To copy to clipboard, switch view to plain text mode
in slot we write:
void KComboboxBox::setupComboboxFont()
{
QFont comboboxFont
= font
();
if(!index.parent().isValid()) // parent index
{
comboboxFont.setBold(true);
comboboxPalette.
setColor(QPalette::Text, Qt
::blue);
comboboxPalette.
setColor(QPalette::WindowText, Qt
::blue);
}
else
{
comboboxFont.setBold(false);
if(parentWidget() != 0)
comboboxPalette = parentWidget()->palette();
}
setFont(comboboxFont);
setPalette(comboboxPalette);
}
void KComboboxBox::setupComboboxFont()
{
QFont comboboxFont = font();
QPalette comboboxPalette = palette();
QModelIndex index = ((QTreeView *)view())->currentIndex();
if(!index.parent().isValid()) // parent index
{
comboboxFont.setBold(true);
comboboxPalette.setColor(QPalette::Text, Qt::blue);
comboboxPalette.setColor(QPalette::WindowText, Qt::blue);
}
else
{
comboboxFont.setBold(false);
if(parentWidget() != 0)
comboboxPalette = parentWidget()->palette();
}
setFont(comboboxFont);
setPalette(comboboxPalette);
}
To copy to clipboard, switch view to plain text mode
That is all!!! Workable!
Bookmarks