attempt to fix problems with chat styles

This commit is contained in:
csoler 2017-03-02 20:30:54 +01:00
parent af1c22a4d5
commit d053400914

View file

@ -71,12 +71,13 @@ static QString loadStyleInfo(ChatStyle::enumStyleType type, QComboBox *style_CB,
ChatStyle::getAvailableStyles(type, styles); ChatStyle::getAvailableStyles(type, styles);
while(style_CB->count()) while(style_CB->count())
style_CB->removeItem(0) ; whileBlocking(style_CB)->removeItem(0) ;
int n=0; int n=0;
for (style = styles.begin(); style != styles.end(); ++style,++n) for (style = styles.begin(); style != styles.end(); ++style,++n)
{ {
style_CB->insertItem(n,style->styleName); whileBlocking(style_CB)->insertItem(n,style->styleName);
style_CB->setItemData(n, qVariantFromValue(*style),Qt::UserRole); style_CB->setItemData(n, qVariantFromValue(*style),Qt::UserRole);
if (style->stylePath == stylePath) { if (style->stylePath == stylePath) {
@ -84,16 +85,17 @@ static QString loadStyleInfo(ChatStyle::enumStyleType type, QComboBox *style_CB,
} }
} }
style_CB->setCurrentIndex(activeItem); whileBlocking(style_CB)->setCurrentIndex(activeItem);
/* now the combobox should be filled */ /* now the combobox should be filled */
int index = comboBox->findText(styleVariant); int index = comboBox->findText(styleVariant);
if (index != -1) { if (index != -1) {
comboBox->setCurrentIndex(index); whileBlocking(comboBox)->setCurrentIndex(index);
} else { } else {
if (comboBox->count()) { if (comboBox->count()) {
comboBox->setCurrentIndex(0); whileBlocking(comboBox)->setCurrentIndex(0);
} }
} }
return stylePath; return stylePath;