void ComboBox::hack() { QListView *v = new QListView( this ); v->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); v->setMinimumHeight( 50 ); v->setModel( model() ); setView( v ); }
QWidget *LayoutConfig::makeOptionsTab() { QListView *listView = widget->listOptions; listView->setMinimumHeight(150); listView->setSortColumn(-1); listView->setColumnText(0, i18n("Options")); listView->clear(); connect(listView, SIGNAL(clicked(QListViewItem *)), SLOT(changed())); connect(listView, SIGNAL(clicked(QListViewItem *)), SLOT(updateOptionsCommand())); connect(widget->chkEnableOptions, SIGNAL(toggled(bool)), SLOT(changed())); connect(widget->checkResetOld, SIGNAL(toggled(bool)), SLOT(changed())); connect(widget->checkResetOld, SIGNAL(toggled(bool)), SLOT(updateOptionsCommand())); // Create controllers for all options QDictIterator< char > it(m_rules->options()); OptionListItem *parent; for(; it.current(); ++it) { if(!it.currentKey().contains(':')) { if(it.currentKey() == "ctrl" || it.currentKey() == "caps" || it.currentKey() == "altwin") { parent = new OptionListItem(listView, i18n(it.current()), QCheckListItem::RadioButtonController, it.currentKey()); OptionListItem *item = new OptionListItem(parent, i18n("None"), QCheckListItem::RadioButton, "none"); item->setState(QCheckListItem::On); } else { parent = new OptionListItem(listView, i18n(it.current()), QCheckListItem::CheckBoxController, it.currentKey()); } parent->setOpen(true); m_optionGroups.insert(i18n(it.currentKey().local8Bit()), parent); } } it.toFirst(); for(; it.current(); ++it) { QString key = it.currentKey(); int pos = key.find(':'); if(pos >= 0) { OptionListItem *parent = m_optionGroups[key.left(pos)]; if(parent == NULL) parent = m_optionGroups["misc"]; if(parent != NULL) { // workaroung for mistake in rules file for xkb options in XFree 4.2.0 QString text(it.current()); text = text.replace("Cap$", "Caps."); if(parent->type() == QCheckListItem::RadioButtonController) new OptionListItem(parent, i18n(text.utf8()), QCheckListItem::RadioButton, key); else new OptionListItem(parent, i18n(text.utf8()), QCheckListItem::CheckBox, key); } } } // scroll->setMinimumSize(450, 330); return listView; }