Qt fix: cvAddText ticket #561
This commit is contained in:
parent
178899be8a
commit
54ba887432
@ -721,21 +721,36 @@ GuiReceiver::~GuiReceiver()
|
|||||||
delete timer;
|
delete timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiReceiver::putText(void* arg1, QString text, QPoint org, void* arg2)
|
void GuiReceiver::putText(void* arr, QString text, QPoint org, void* arg2)
|
||||||
{
|
{
|
||||||
CV_Assert(arg1)
|
CV_Assert(arr)
|
||||||
|
|
||||||
IplImage* img = (IplImage*)arg1;
|
CvMat * mat, stub;
|
||||||
|
int origin=0;
|
||||||
|
|
||||||
|
if( CV_IS_IMAGE_HDR( arr ))
|
||||||
|
origin = ((IplImage*)arr)->origin;
|
||||||
|
|
||||||
|
mat = cvGetMat(arr, &stub);
|
||||||
|
|
||||||
|
int nbChannelOriginImage = cvGetElemType(mat);
|
||||||
|
|
||||||
|
|
||||||
|
if (nbChannelOriginImage!=CV_8UC3) return;//for now, font works only with 8UC3
|
||||||
|
|
||||||
|
//CvMat* image2Draw_mat = cvCreateMat( mat->rows, mat->cols, CV_8UC3 );
|
||||||
|
QImage qimg = QImage(mat->data.ptr, mat->cols,mat->rows, mat->step,QImage::Format_RGB888);
|
||||||
|
|
||||||
|
|
||||||
|
//IplImage* img = (IplImage*)arg1;
|
||||||
|
|
||||||
//for now, only support QImage::Format_RGB888
|
//for now, only support QImage::Format_RGB888
|
||||||
if (img->depth !=IPL_DEPTH_8U || img->nChannels != 3)
|
//if (img->depth !=IPL_DEPTH_8U || img->nChannels != 3)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
CvFont* font = (CvFont*)arg2;
|
CvFont* font = (CvFont*)arg2;
|
||||||
|
|
||||||
|
//QImage qimg((uchar*) img->imageData, img->width, img->height,QImage::Format_RGB888);
|
||||||
|
|
||||||
QImage qimg((uchar*) img->imageData, img->width, img->height,QImage::Format_RGB888);
|
|
||||||
QPainter qp(&qimg);
|
QPainter qp(&qimg);
|
||||||
if (font)
|
if (font)
|
||||||
{
|
{
|
||||||
@ -750,6 +765,8 @@ void GuiReceiver::putText(void* arg1, QString text, QPoint org, void* arg2)
|
|||||||
}
|
}
|
||||||
qp.drawText (org, text );
|
qp.drawText (org, text );
|
||||||
qp.end();
|
qp.end();
|
||||||
|
|
||||||
|
//cvReleaseMat(&image2Draw_mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiReceiver::saveWindowParameters(QString name)
|
void GuiReceiver::saveWindowParameters(QString name)
|
||||||
@ -1464,6 +1481,7 @@ CvWindow::CvWindow(QString arg, int arg2)
|
|||||||
setObjectName(param_name);
|
setObjectName(param_name);
|
||||||
|
|
||||||
resize(400,300);
|
resize(400,300);
|
||||||
|
setMinimumSize(1,1);
|
||||||
|
|
||||||
//1: create control panel
|
//1: create control panel
|
||||||
if (!global_control_panel)
|
if (!global_control_panel)
|
||||||
@ -1483,7 +1501,6 @@ CvWindow::CvWindow(QString arg, int arg2)
|
|||||||
//4: shortcuts and actions
|
//4: shortcuts and actions
|
||||||
createActions();
|
createActions();
|
||||||
createShortcuts();
|
createShortcuts();
|
||||||
//createActionsandShortcuts();
|
|
||||||
|
|
||||||
//5: toolBar and statusbar
|
//5: toolBar and statusbar
|
||||||
if (param_gui_mode == CV_GUI_EXPANDED)
|
if (param_gui_mode == CV_GUI_EXPANDED)
|
||||||
@ -1688,6 +1705,7 @@ void CvWindow::createToolBar()
|
|||||||
myToolBar = new QToolBar(this);
|
myToolBar = new QToolBar(this);
|
||||||
myToolBar->setFloatable(false);//is not a window
|
myToolBar->setFloatable(false);//is not a window
|
||||||
myToolBar->setFixedHeight(28);
|
myToolBar->setFixedHeight(28);
|
||||||
|
myToolBar->setMinimumWidth(1);
|
||||||
|
|
||||||
foreach (QAction *a, vect_QActions)
|
foreach (QAction *a, vect_QActions)
|
||||||
myToolBar->addAction(a);
|
myToolBar->addAction(a);
|
||||||
@ -1698,6 +1716,7 @@ void CvWindow::createStatusBar()
|
|||||||
myStatusBar = new QStatusBar(this);
|
myStatusBar = new QStatusBar(this);
|
||||||
myStatusBar->setSizeGripEnabled(false);
|
myStatusBar->setSizeGripEnabled(false);
|
||||||
myStatusBar->setFixedHeight(20);
|
myStatusBar->setFixedHeight(20);
|
||||||
|
myStatusBar->setMinimumWidth(1);
|
||||||
myStatusBar_msg = new QLabel;
|
myStatusBar_msg = new QLabel;
|
||||||
|
|
||||||
|
|
||||||
@ -1718,6 +1737,7 @@ void CvWindow::createGlobalLayout()
|
|||||||
myGlobalLayout->setContentsMargins(0, 0, 0, 0);
|
myGlobalLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
myGlobalLayout->setSpacing(0);
|
myGlobalLayout->setSpacing(0);
|
||||||
myGlobalLayout->setMargin(0);
|
myGlobalLayout->setMargin(0);
|
||||||
|
setMinimumSize(1,1);
|
||||||
|
|
||||||
if (param_flags == CV_WINDOW_AUTOSIZE)
|
if (param_flags == CV_WINDOW_AUTOSIZE)
|
||||||
myGlobalLayout->setSizeConstraint(QLayout::SetFixedSize);
|
myGlobalLayout->setSizeConstraint(QLayout::SetFixedSize);
|
||||||
@ -2103,6 +2123,7 @@ ViewPort::ViewPort(CvWindow* arg, int arg2, int arg3)
|
|||||||
|
|
||||||
//setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
//setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||||
setContentsMargins(0,0,0,0);
|
setContentsMargins(0,0,0,0);
|
||||||
|
setMinimumSize(1,1);
|
||||||
|
|
||||||
setObjectName(QString::fromUtf8("graphicsView"));
|
setObjectName(QString::fromUtf8("graphicsView"));
|
||||||
timerDisplay = new QTimer(this);
|
timerDisplay = new QTimer(this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user