void ColorCombo::insertItems(ColorList& list) { ColorListBox* clb = dynamic_cast<ColorListBox*>(view()); if (!clb) return; clb->insertItems(list); }
ColorCombo::ColorCombo( bool rw, QWidget* parent ) : QComboBox(parent) { #ifdef Q_WS_MAC // setStyle( new ColorCombo::ScMacStyle() ); #endif setEditable(rw); ColorListBox* lb = new ColorListBox(this); setModel( lb->model() ); setItemDelegate( lb->itemDelegate() ); setView( lb ); }
void ColorCombo::insertItems(ColorList& list, ColorCombo::PixmapType pixType) { ColorListBox* clb = dynamic_cast<ColorListBox*>(view()); if ( clb ) { if ( pixType == ColorCombo::fancyPixmaps ) clb->insertItems(list, ColorListBox::fancyPixmap); else if ( pixType == ColorCombo::widePixmaps ) clb->insertItems(list, ColorListBox::widePixmap); else if ( pixType == ColorCombo::smallPixmaps ) clb->insertItems(list, ColorListBox::smallPixmap); } }
void ColorCombo::setPixmapType(ColorCombo::PixmapType type) { ColorListBox* clb = dynamic_cast<ColorListBox*>(view()); if (!clb) return; if (type == ColorCombo::smallPixmaps) clb->setPixmapType(ColorListBox::smallPixmap); else if (type == ColorCombo::widePixmaps) clb->setPixmapType(ColorListBox::widePixmap); else if (type == ColorCombo::fancyPixmaps) clb->setPixmapType(ColorListBox::fancyPixmap); }
void ColorCombo::updateBox(ColorList& list, bool insertNone) { ColorListBox* clb = dynamic_cast<ColorListBox*>(view()); if (!clb) return; clb->clear(); if (insertNone) { clb->addItem(CommonStrings::tr_NoneColor); clb->item(0)->setData(Qt::UserRole, CommonStrings::None); } clb->insertItems(list); }
ColorCombo::ColorCombo(ColorCombo::PixmapType type, QWidget* parent) { #ifdef Q_OS_MAC // setStyle( new ColorCombo::ScMacStyle() ); #endif setEditable(false); ColorListBox::PixmapType clbType = ColorListBox::smallPixmap; if (type == ColorCombo::widePixmaps) clbType = ColorListBox::widePixmap; else if (type == ColorCombo::fancyPixmaps) clbType = ColorListBox::fancyPixmap; ColorListBox* lb = new ColorListBox(clbType, this); setModel( lb->model() ); setItemDelegate( lb->itemDelegate() ); setView( lb ); }
void ColorCombo::updateBox(ColorList& list, ColorCombo::PixmapType pixType , bool insertNone) { ColorListBox* clb = dynamic_cast<ColorListBox*>(view()); if ( clb ) { clb->clear(); if ( insertNone ) { clb->addItem(CommonStrings::tr_NoneColor); clb->item(0)->setData(Qt::UserRole, CommonStrings::None); } if ( pixType == ColorCombo::fancyPixmaps ) clb->insertItems(list, ColorListBox::fancyPixmap); else if ( pixType == ColorCombo::widePixmaps ) clb->insertItems(list, ColorListBox::widePixmap); else if ( pixType == ColorCombo::smallPixmaps ) clb->insertItems(list, ColorListBox::smallPixmap); } }
void ColorCombo::insertFancyItem( const ScColor& col, ScribusDoc* doc, const QString& colName ) { ColorListBox* clb = dynamic_cast<ColorListBox*>(view()); if ( clb ) clb->addItem( new ColorPixmapItem(ColorPixmapValue(col, doc, colName)), ColorListBox::fancyPixmap ); }