本文整理汇总了C++中ImageItem::getImage方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageItem::getImage方法的具体用法?C++ ImageItem::getImage怎么用?C++ ImageItem::getImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageItem
的用法示例。
在下文中一共展示了ImageItem::getImage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotDelete
void ImageItemView::slotDelete() {
QModelIndexList selected = selectedIndexes();
if (selected.isEmpty()) {
return;
}
QStringList names;
for (QModelIndexList::iterator it = selected.begin(); it != selected.end(); it++) {
ImageItem* itm = (ImageItem*) ((ImageItemModel*) model())->itemFromIndex(*it);
if (itm) {
names << tr("Name: %1, ID: %2")
.arg(itm->getImage()->getName())
.arg(itm->getImage()->getId());
}
}
if (QMessageBox::Yes == QMessageBox::warning(this,
tr("Really Delete?"),
tr("Really delete this Images?\n%1")
.arg(names.join(", ")),
QMessageBox::Yes | QMessageBox::No)) {
emit deleteRequest(selected);
}
}
示例2: onStitchClicked
void StitcherWorkspace::onStitchClicked() {
QList<QGraphicsItem *> it = _stitcherView->items();
if(it.size() < 2) {
return;
}
QRectF combined;
for(int i = 0; i < it.size(); i++) {
if(QString("ImageItem") == it[i]->data(0)) {
/* we have an image item */
ImageItem * ii = qgraphicsitem_cast<ImageItem *>(it[i]);
combined = combined.united(ii->sceneBoundingRect());
}
}
/* we're gonna assume they all have the same scaling */
combined = _stitcherView->selectedImage()->mapRectFromScene(combined);
qDebug("Combined with relative positions:");
Image * a = sp_image_alloc(combined.width(),combined.height(),1);
for(int i = 0; i < it.size(); i++) {
if(QString("ImageItem") == it[i]->data(0)) {
QPointF p = it[i]->mapToScene(0,0);
QPointF local_p = _stitcherView->selectedImage()->mapFromScene(p);
qDebug("x = %f y = %f",local_p.x()-combined.x(),local_p.y()-combined.y());
}
}
for(int x = 0; x<sp_image_x(a); x++) {
for(int y = 0; y<sp_image_y(a); y++) {
int mask = 0;
Complex value = sp_cinit(0,0);
QPointF p = _stitcherView->selectedImage()->mapToScene(QPointF(combined.x()+x,combined.y()+y));
for(int i = 0; i < it.size(); i++) {
if(QString("ImageItem") == it[i]->data(0)) {
/* we have an image item */
ImageItem * ii = qgraphicsitem_cast<ImageItem *>(it[i]);
QPointF local_p = it[i]->mapFromScene(p);
if(it[i]->contains(local_p)) {
/* we're in business */
value = sp_cadd(value,sp_image_get(ii->getImage(),local_p.x(),local_p.y(),0));
mask++;
}
}
}
if(mask) {
sp_cscale(value,1.0/mask);
}
a->detector->image_center[0] = -combined.x();
a->detector->image_center[1] = -combined.y();
a->detector->image_center[2] = 0;
sp_image_set(a,x,y,0,value);
sp_image_mask_set(a,x,y,0,mask);
}
}
ImageItem * item = new ImageItem(a,QString(),_stitcherView,NULL);
_stitcherView->addImage(item);
item->update();
}
示例3: slotIndexActivated
void ImageItemView::slotIndexActivated(const QModelIndex& idx) {
if (!idx.isValid()) {
emit currentImageChanged(0);
return;
}
ImageItem* itm = (ImageItem*) (((ImageItemModel*) model())->itemFromIndex(idx));
if (!itm) {
emit currentImageChanged(0);
} else {
emit currentImageChanged(itm->getImage());
}
}