本文整理汇总了C++中ImageItem::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageItem::remove方法的具体用法?C++ ImageItem::remove怎么用?C++ ImageItem::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageItem
的用法示例。
在下文中一共展示了ImageItem::remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddImage
void ImageModel::AddImage(const cv::Mat image, const QString fileName)
{
QFileInfo fileInfo(fileName);
QString name = fileInfo.fileName();
// find image if already in list and remove before append new one;
ImageItem* child = this->findImage(fileName);
if(child)
{
child->remove();
}
int channelsCount = image.channels();
if(channelsCount>1)
{
ImageItem* multichannelImage = new ImageItem(name, fileName);
vector<cv::Mat> imageChannels;
cv::split(image, imageChannels);
QHash<int, QString> ChannelsStrings;
ChannelsStrings[0] = QString("Red");
ChannelsStrings[1] = QString("Green");
ChannelsStrings[2] = QString("Blue");
ChannelsStrings[3] = QString("Alpha");
for(int i = 0; i<channelsCount; i++)
{
ImageItem* child = new ImageItem(imageChannels[i], name+QString(" ")+ChannelsStrings[i], fileName, i);
multichannelImage->appendChild(child);
}
this->AddItem(multichannelImage);
}
else
{
ImageItem* item = new ImageItem(image, name, fileName, 0);
this->AddItem(item);
}
}