10 qRegisterMetaType<QImage>(
"QImage");
11 qRegisterMetaType<ROIRectList>(
"ROIRectList");
13 #if defined (INCLUDE_AJACC)
14 for (
unsigned ndx (0); ndx < 15; ndx++)
15 _captionStrings [ndx] = QString (32, QChar (32));
16 #endif // defined (INCLUDE_AJACC)
23 QPainter painter (
this);
25 const int offsetX (_pixmap.width() < width() ? (width() - _pixmap.width()) / 2 : 0);
26 const int offsetY (_pixmap.height() < height() ? (height() - _pixmap.height()) / 2 : 0);
28 painter.drawPixmap (offsetX, offsetY, _pixmap);
29 for (
int i (0); i < _roiList.size(); i++)
31 const ROIStruct & roiRectInfo (_roiList [i]);
33 const double hScale (
double (_pixmap.width()) / double (_unscaledImageSize.width()));
34 const double vScale (
double (_pixmap.height()) / double (_unscaledImageSize.height()));
39 currentPen.setWidth (4);
40 painter.setPen (currentPen);
42 currentRect.setLeft (
double(offsetX) + roiRectInfo.
roiRect.left() * hScale);
43 currentRect.setRight (
double(offsetX) + roiRectInfo.
roiRect.right() * hScale);
44 currentRect.setTop (
double(offsetY) + roiRectInfo.
roiRect.top() * vScale);
45 currentRect.setBottom (
double(offsetY) + roiRectInfo.
roiRect.bottom() * vScale);
47 painter.drawRect (currentRect);
54 painter.setPen (qRgba (255, 255, 255, 255));
55 painter.drawText (30, 40, _statusString);
57 #if defined (INCLUDE_AJACC)
58 QFont captionFont (
"Courier");
59 captionFont.setPointSize (24);
60 QFontMetrics metrics (captionFont);
61 const int offX (width() / 2 - 32 * metrics.averageCharWidth() / 2);
62 const int offY (height() / 2 - 15 * (metrics.height() + metrics.leading()) / 2);
63 setFont (captionFont);
64 painter.setPen (qRgba (255, 255, 255, 0));
65 for (
unsigned ndx (0); ndx < 15; ndx++)
66 painter.drawText (offX, offY + ndx * (metrics.height() + metrics.leading()), _captionStrings [ndx]);
67 #endif // defined (INCLUDE_AJACC)
76 _unscaledImageSize.setHeight(image.height());
77 _unscaledImageSize.setWidth(image.width());
84 QMetaObject::invokeMethod(
this,
"renderFrame", Qt::QueuedConnection);
92 _statusString = statusString;
93 _unscaledImageSize.setHeight(image.height());
94 _unscaledImageSize.setWidth(image.width());
101 QMetaObject::invokeMethod(
this,
"renderFrame", Qt::QueuedConnection);
108 _unscaledImageSize.setHeight (image.height());
109 _unscaledImageSize.setWidth (image.width());
116 QMetaObject::invokeMethod(
this,
"renderFrame", Qt::QueuedConnection);
127 _statusString = statusString;
130 #if defined (INCLUDE_AJACC)
131 void AJAPreviewWidget::updateCaptionScreen (
const ushort * pInScreen)
133 const ushort * pCell (pInScreen);
136 _captionStrings [row-1].
replace (col-1, 1, QChar (*pCell++));
138 #endif // defined (INCLUDE_AJACC)
140 void AJAPreviewWidget::renderFrame ()
143 if (_image.width() > this->width())
144 _pixmap = QPixmap::fromImage(_image.scaledToWidth(this->width(), Qt::SmoothTransformation), Qt::ImageConversionFlags());
145 else if (_image.height() > this->height())
146 _pixmap = QPixmap::fromImage(_image.scaledToHeight(this->height(), Qt::SmoothTransformation), Qt::ImageConversionFlags());
148 _pixmap = QPixmap::fromImage(_image, Qt::ImageConversionFlags());
150 setAttribute(Qt::WA_OpaquePaintEvent, _clear ?
false :
true);
157 if (ev->mimeData()->hasFormat(
"text/uri-list"))
158 ev->acceptProposedAction();
160 ev->setAccepted(
false );
166 QList<QUrl> urls = ev->mimeData()->urls();
170 QString fileName = urls.first().toLocalFile();
171 if (fileName.isEmpty())
174 QImage imageFile(fileName);
175 if ( !imageFile.isNull())