Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
a3582b47
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a3582b47
编写于
8月 18, 2010
作者:
Y
Yannick Verdie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Qt Python binding -- #512
上级
0816b49a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
102 addition
and
6 deletion
+102
-6
modules/highgui/src/window_QT.cpp
modules/highgui/src/window_QT.cpp
+95
-5
modules/highgui/src/window_QT.h
modules/highgui/src/window_QT.h
+7
-1
未找到文件。
modules/highgui/src/window_QT.cpp
浏览文件 @
a3582b47
...
...
@@ -547,10 +547,23 @@ CV_IMPL void cvResizeWindow(const char* name, int width, int height )
}
//TODO: implement the real one, not a wrapper
CV_IMPL
int
cvCreateTrackbar2
(
const
char
*
name_bar
,
const
char
*
window_name
,
int
*
val
,
int
count
,
CvTrackbarCallback2
on_notify
,
void
*
userdata
)
{
return
cvCreateTrackbar
(
name_bar
,
window_name
,
val
,
count
,
(
CvTrackbarCallback
)
on_notify
);
if
(
!
guiMainThread
)
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
"addSlider2"
,
Qt
::
AutoConnection
,
Q_ARG
(
QString
,
QString
(
name_bar
)),
Q_ARG
(
QString
,
QString
(
window_name
)),
Q_ARG
(
void
*
,
(
void
*
)
val
),
Q_ARG
(
int
,
count
),
Q_ARG
(
void
*
,
(
void
*
)
on_notify
),
Q_ARG
(
void
*
,
(
void
*
)
userdata
)
);
return
1
;
//dummy value
}
CV_IMPL
int
cvStartWindowThread
()
...
...
@@ -1016,6 +1029,34 @@ void GuiReceiver::addButton(QString button_name, int button_type, int initial_bu
b
->
addButton
(
button_name
,(
CvButtonCallback
)
on_change
,
userdata
,
button_type
,
initial_button_state
);
}
void
GuiReceiver
::
addSlider2
(
QString
bar_name
,
QString
window_name
,
void
*
value
,
int
count
,
void
*
on_change
,
void
*
userdata
)
{
QBoxLayout
*
layout
=
NULL
;
QPointer
<
CvWindow
>
w
;
if
(
window_name
!=
""
)
{
w
=
icvFindWindowByName
(
window_name
.
toLatin1
().
data
()
);
if
(
!
w
)
return
;
}
else
{
if
(
global_control_panel
)
layout
=
global_control_panel
->
myLayout
;
}
QPointer
<
CvTrackbar
>
t
=
icvFindTrackbarByName
(
bar_name
.
toLatin1
().
data
()
,
window_name
.
toLatin1
().
data
(),
layout
);
if
(
t
)
//trackbar exists
return
;
if
(
!
value
)
CV_Error
(
CV_StsNullPtr
,
"NULL value pointer"
);
if
(
count
<=
0
)
//count is the max value of the slider, so must be bigger than 0
CV_Error
(
CV_StsNullPtr
,
"Max value of the slider must be bigger than 0"
);
CvWindow
::
addSlider2
(
w
,
bar_name
,(
int
*
)
value
,
count
,(
CvTrackbarCallback2
)
on_change
,
userdata
);
}
void
GuiReceiver
::
addSlider
(
QString
bar_name
,
QString
window_name
,
void
*
value
,
int
count
,
void
*
on_change
)
{
...
...
@@ -1051,8 +1092,25 @@ int GuiReceiver::start()
return
qApp
->
exec
();
}
CvTrackbar
::
CvTrackbar
(
CvWindow
*
arg
,
QString
name
,
int
*
value
,
int
count
,
CvTrackbarCallback2
on_change
,
void
*
data
)
{
callback
=
NULL
;
callback2
=
on_change
;
userdata
=
data
;
construc_trackbar
(
arg
,
name
,
value
,
count
);
}
CvTrackbar
::
CvTrackbar
(
CvWindow
*
arg
,
QString
name
,
int
*
value
,
int
count
,
CvTrackbarCallback
on_change
)
{
callback
=
on_change
;
callback2
=
NULL
;
userdata
=
NULL
;
construc_trackbar
(
arg
,
name
,
value
,
count
);
}
void
CvTrackbar
::
construc_trackbar
(
CvWindow
*
arg
,
QString
name
,
int
*
value
,
int
count
)
{
type
=
type_CvTrackbar
;
myparent
=
arg
;
...
...
@@ -1060,7 +1118,6 @@ CvTrackbar::CvTrackbar(CvWindow* arg, QString name, int* value, int count, CvTra
setObjectName
(
name_bar
);
dataSlider
=
value
;
callback
=
on_change
;
slider
=
new
QSlider
(
Qt
::
Horizontal
);
slider
->
setFocusPolicy
(
Qt
::
StrongFocus
);
slider
->
setMinimum
(
0
);
...
...
@@ -1135,7 +1192,16 @@ void CvTrackbar::update(int myvalue)
*
dataSlider
=
myvalue
;
if
(
callback
)
{
callback
(
myvalue
);
return
;
}
if
(
callback2
)
{
callback2
(
myvalue
,
userdata
);
return
;
}
}
void
CvTrackbar
::
setLabel
(
int
myvalue
)
...
...
@@ -1422,8 +1488,6 @@ CvWindow::CvWindow(QString arg, int arg2)
CvWindow
::~
CvWindow
()
{
printf
(
"delete w
\n
"
);
QLayoutItem
*
child
;
if
(
myGlobalLayout
)
...
...
@@ -1664,6 +1728,32 @@ void CvWindow::setMouseCallBack(CvMouseCallback m, void* param)
myview
->
setMouseCallBack
(
m
,
param
);
}
//addSlider2 is static
void
CvWindow
::
addSlider2
(
CvWindow
*
w
,
QString
name
,
int
*
value
,
int
count
,
CvTrackbarCallback2
on_change
,
void
*
userdata
)
{
QPointer
<
CvTrackbar
>
t
=
new
CvTrackbar
(
w
,
name
,
value
,
count
,
on_change
,
userdata
);
t
->
setAlignment
(
Qt
::
AlignHCenter
);
QPointer
<
QBoxLayout
>
myLayout
;
if
(
w
)
{
myLayout
=
w
->
myBarLayout
;
}
else
{
myLayout
=
global_control_panel
->
myLayout
;
//if first one, enable control panel
if
(
myLayout
->
count
()
==
0
)
guiMainThread
->
enablePropertiesButtonEachWindow
();
}
myLayout
->
insertLayout
(
myLayout
->
count
(),
t
);
}
//addSlider is static
void
CvWindow
::
addSlider
(
CvWindow
*
w
,
QString
name
,
int
*
value
,
int
count
,
CvTrackbarCallback
on_change
)
{
...
...
modules/highgui/src/window_QT.h
浏览文件 @
a3582b47
...
...
@@ -127,6 +127,7 @@ public slots:
void
destroyWindow
(
QString
name
);
void
destroyAllWindow
();
void
addSlider
(
QString
trackbar_name
,
QString
window_name
,
void
*
value
,
int
count
,
void
*
on_change
);
void
addSlider2
(
QString
trackbar_name
,
QString
window_name
,
void
*
value
,
int
count
,
void
*
on_change
,
void
*
userdata
);
void
moveWindow
(
QString
name
,
int
x
,
int
y
);
void
resizeWindow
(
QString
name
,
int
width
,
int
height
);
void
showImage
(
QString
name
,
void
*
arr
);
...
...
@@ -229,7 +230,8 @@ class CvTrackbar : public CvBar
{
Q_OBJECT
public:
CvTrackbar
(
CvWindow
*
parent
,
QString
name
,
int
*
value
,
int
count
,
CvTrackbarCallback
on_change
=
NULL
);
CvTrackbar
(
CvWindow
*
parent
,
QString
name
,
int
*
value
,
int
count
,
CvTrackbarCallback
on_change
);
CvTrackbar
(
CvWindow
*
parent
,
QString
name
,
int
*
value
,
int
count
,
CvTrackbarCallback2
on_change
,
void
*
data
);
~
CvTrackbar
();
//QString trackbar_name;
...
...
@@ -241,10 +243,13 @@ private slots:
private:
void
setLabel
(
int
myvalue
);
void
construc_trackbar
(
CvWindow
*
arg
,
QString
name
,
int
*
value
,
int
count
);
QString
createLabel
();
QPointer
<
QPushButton
>
label
;
CvTrackbarCallback
callback
;
CvTrackbarCallback2
callback2
;
//look like it is use by python binding
int
*
dataSlider
;
void
*
userdata
;
};
...
...
@@ -281,6 +286,7 @@ public:
CvWindow
(
QString
arg2
,
int
flag
=
CV_WINDOW_NORMAL
);
~
CvWindow
();
static
void
addSlider
(
CvWindow
*
w
,
QString
name
,
int
*
value
,
int
count
,
CvTrackbarCallback
on_change
CV_DEFAULT
(
NULL
));
static
void
addSlider2
(
CvWindow
*
w
,
QString
name
,
int
*
value
,
int
count
,
CvTrackbarCallback2
on_change
CV_DEFAULT
(
NULL
),
void
*
userdata
CV_DEFAULT
(
0
));
void
setMouseCallBack
(
CvMouseCallback
m
,
void
*
param
);
void
updateImage
(
void
*
arr
);
void
displayInfo
(
QString
text
,
int
delayms
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录