示例#1
0
void ColorCombo::insertItems(ColorList& list)
{
	ColorListBox* clb = dynamic_cast<ColorListBox*>(view());
	if (!clb)
		return;

	clb->insertItems(list);
}
示例#2
0
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 );
}
示例#3
0
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);
	}
}
示例#4
0
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);
}
示例#5
0
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);
}
示例#6
0
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 );
}
示例#7
0
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);
	}
}
示例#8
0
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 );
}