From 3a564d1ae897c662c118236283550f6112954b74 Mon Sep 17 00:00:00 2001 From: Alexander Reshetnikov Date: Fri, 30 Mar 2012 19:58:44 +0000 Subject: [PATCH] Updated displayOverlay's implementation & documentation (ticket #903) --- modules/highgui/doc/qt_new_functions.rst | 16 ++++++++-------- modules/highgui/include/opencv2/highgui/highgui.hpp | 4 ++-- modules/highgui/include/opencv2/highgui/highgui_c.h | 4 ++-- modules/highgui/src/window_QT.cpp | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/highgui/doc/qt_new_functions.rst b/modules/highgui/doc/qt_new_functions.rst index 8fcb050..9970f2e 100644 --- a/modules/highgui/doc/qt_new_functions.rst +++ b/modules/highgui/doc/qt_new_functions.rst @@ -195,35 +195,35 @@ displayOverlay ------------------ Displays a text on a window image as an overlay for a specified duration. -.. ocv:function:: void displayOverlay(const string& name, const string& text, int delay) +.. ocv:function:: void displayOverlay(const string& name, const string& text, int delayms CV_DEFAULT(0)) -.. ocv:cfunction:: void cvDisplayOverlay(const char* name, const char* text, int delay) +.. ocv:cfunction:: void cvDisplayOverlay(const char* name, const char* text, int delayms CV_DEFAULT(0)) :param name: Name of the window. :param text: Overlay text to write on a window image. - :param delay: The period (in milliseconds), during which the overlay text is displayed. If this function is called before the previous overlay text timed out, the timer is restarted and the text is updated. If this value is zero, the text never disappears. + :param delayms: The period (in milliseconds), during which the overlay text is displayed. If this function is called before the previous overlay text timed out, the timer is restarted and the text is updated. If this value is zero, the text never disappears. Optional - default 0. -The function ``displayOverlay`` displays useful information/tips on top of the window for a certain amount of time *delay*. The function does not modify the image, displayed in the window, that is, after the specified delay the original content of the window is restored. +The function ``displayOverlay`` displays useful information/tips on top of the window for a certain amount of time *delayms*. The function does not modify the image, displayed in the window, that is, after the specified delay the original content of the window is restored. displayStatusBar -------------------- Displays a text on the window statusbar during the specified period of time. -.. ocv:function:: void displayStatusBar(const string& name, const string& text, int delay) +.. ocv:function:: void displayStatusBar(const string& name, const string& text, int delayms CV_DEFAULT(0)) -.. ocv:cfunction:: void cvDisplayStatusBar(const char* name, const char* text, int delayms) +.. ocv:cfunction:: void cvDisplayStatusBar(const char* name, const char* text, int delayms CV_DEFAULT(0)) :param name: Name of the window. :param text: Text to write on the window statusbar. - :param delay: Duration (in milliseconds) to display the text. If this function is called before the previous text timed out, the timer is restarted and the text is updated. If this value is zero, the text never disappears. + :param delayms: Duration (in milliseconds) to display the text. If this function is called before the previous text timed out, the timer is restarted and the text is updated. If this value is zero, the text never disappears. Optional - default 0. The function ``displayOverlay`` displays useful information/tips on top of the window for a certain amount of time -*delay* +*delayms* . This information is displayed on the window statubar (the window must be created with the ``CV_GUI_EXPANDED`` flags). createOpenGLCallback diff --git a/modules/highgui/include/opencv2/highgui/highgui.hpp b/modules/highgui/include/opencv2/highgui/highgui.hpp index 4057de4..726707f 100644 --- a/modules/highgui/include/opencv2/highgui/highgui.hpp +++ b/modules/highgui/include/opencv2/highgui/highgui.hpp @@ -142,8 +142,8 @@ CV_EXPORTS CvFont fontQt(const string& nameFont, int pointSize=-1, int style=CV_STYLE_NORMAL, int spacing=0); CV_EXPORTS void addText( const Mat& img, const string& text, Point org, CvFont font); -CV_EXPORTS void displayOverlay(const string& winname, const string& text, int delayms); -CV_EXPORTS void displayStatusBar(const string& winname, const string& text, int delayms); +CV_EXPORTS void displayOverlay(const string& winname, const string& text, int delayms CV_DEFAULT(0)); +CV_EXPORTS void displayStatusBar(const string& winname, const string& text, int delayms CV_DEFAULT(0)); CV_EXPORTS void saveWindowParameters(const string& windowName); CV_EXPORTS void loadWindowParameters(const string& windowName); diff --git a/modules/highgui/include/opencv2/highgui/highgui_c.h b/modules/highgui/include/opencv2/highgui/highgui_c.h index 7f27d3f..c9fa801 100644 --- a/modules/highgui/include/opencv2/highgui/highgui_c.h +++ b/modules/highgui/include/opencv2/highgui/highgui_c.h @@ -73,8 +73,8 @@ CVAPI(CvFont) cvFontQt(const char* nameFont, int pointSize CV_DEFAULT(-1), CvSca CVAPI(void) cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont *arg2); -CVAPI(void) cvDisplayOverlay(const char* name, const char* text, int delayms); -CVAPI(void) cvDisplayStatusBar(const char* name, const char* text, int delayms); +CVAPI(void) cvDisplayOverlay(const char* name, const char* text, int delayms CV_DEFAULT(0)); +CVAPI(void) cvDisplayStatusBar(const char* name, const char* text, int delayms CV_DEFAULT(0)); CVAPI(void) cvSaveWindowParameters(const char* name); CVAPI(void) cvLoadWindowParameters(const char* name); diff --git a/modules/highgui/src/window_QT.cpp b/modules/highgui/src/window_QT.cpp index 33244f0..d0eb08d 100755 --- a/modules/highgui/src/window_QT.cpp +++ b/modules/highgui/src/window_QT.cpp @@ -927,7 +927,7 @@ void GuiReceiver::displayInfo(QString name, QString text, int delayms) { QPointer w = icvFindWindowByName(name); - if (w && delayms > 0) + if (w) w->displayInfo(text, delayms); } @@ -936,7 +936,7 @@ void GuiReceiver::displayStatusBar(QString name, QString text, int delayms) { QPointer w = icvFindWindowByName(name); - if (w && delayms > 0) + if (w) w->displayStatusBar(text, delayms); } @@ -2407,7 +2407,7 @@ void DefaultViewPort::startDisplayInfo(QString text, int delayms) stopDisplayInfo(); infoText = text; - timerDisplay->start(delayms); + if (delayms > 0) timerDisplay->start(delayms); drawInfo = true; } -- 2.7.4