void OptionsDialog::slotColDefaultBtnClicked() { ColorListItem *colorItem; for(int i=0; i < global->colorCount(); i++) { colorItem=static_cast<ColorListItem*>(c_List->item(i)); colorItem->setColor(global->defaultColor(i)); } c_List->triggerUpdate(true); c_List->repaint(true); }
/** * Commits settings changes to the configuration object. */ void PrefColor::apply() { ColorListItem* pItem; // Create a list item for every GUI element for (pItem = (ColorListItem*)m_pList->firstChild(); pItem != NULL; pItem = (ColorListItem*)pItem->nextSibling()) { Config().setColor(pItem->getElement(), pItem->getColor()); } }
/** * Displays a colour selection dialogue when an item is selected. * If the user chooses a new colour, it is set to the selected item. * This slot is connected to both the doubleClicked() and the returnPressed() * signals of the list view. * @param pItem The selected item */ void PrefColor::slotItemSelected(QListViewItem* pItem) { ColorListItem* pClrItem; QColor clr; pClrItem = (ColorListItem*)pItem; if (KColorDialog::getColor(clr, pClrItem->getColor()) == QDialog::Accepted) { pClrItem->setColor(clr); emit modified(); } }
// show color dialog for the entry void OptionsDialog::slotColItemSelected(QListBoxItem *it) { if (it) { ColorListItem *colorItem = static_cast<ColorListItem*>(it); QColor col = colorItem->color(); int result = KColorDialog::getColor(col,this); if (result == KColorDialog::Accepted) { colorItem->setColor(col); c_List->triggerUpdate(false); slotChanged(); } } }