EmoticonLabel::EmoticonLabel(const QString &emoticonText, const QString &pixmapPath, QWidget *parent, const char *name)
	: QLabel(parent,name)
{
	mText = emoticonText;
	setMovie( QMovie(pixmapPath) );
	setAlignment(Qt::AlignCenter);
	QToolTip::add(this,emoticonText);
	// Somehow QLabel doesn't tell a reasonable size when you use setMovie
	// although it does it correctly for setPixmap. Therefore here is a little workaround
	// to tell our minimum size.
	QPixmap p(pixmapPath);
    //
    // Some of the custom icons are rather large
    // so lets limit them to a maximum size for this display panel
    //
    if (p.width() > 32 || p.height() > 32)
        p.resize(32, 32);
	setMinimumSize(p.size());
}
示例#2
0
bool EvaImageResource::loadIcon()
{
	QString path = getIconPath() + "/eva.theme";
	QDir d;
	if(!d.exists(path)){
		themePath = ""; // if theme not exist, load default one
		path = getIconPath() + "/eva.theme";
	}
	QFile file( path);
	if(!file.open(IO_ReadOnly)){
		return false;
	}
	
	QTextStream stream(&file);
	QString line, imagePath;
	QStringList lineList;
	
	while(!stream.atEnd()){
		line = stream.readLine().stripWhiteSpace();
			
		lineList = QStringList::split(":", line);
		
		if(lineList.size() != 2)
			continue;
		
		lineList[0].stripWhiteSpace();
		imagePath = getIconPath() + "/" + lineList[1].stripWhiteSpace();
		if(lineList[0] == "LOGIN_MNG"){
			loginMng = QMovie(imagePath);
			continue;
		}
		QPixmap img(imagePath);
		if(!img.isNull()){
			iconList[lineList[0]] = img;
			iconFileNameMap[lineList[0]] = lineList[1].stripWhiteSpace();
		}
	}
	
	file.close();
	return true;  
}
示例#3
0
void BoxContainerItem::setAnimIcon(QLabel *label, const QString &anim)
{
    label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
    label->setMovie(QMovie(anim));
    label->show();
}