Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
qplanetosm
提交
1cbcaffa
qplanetosm
项目概览
colorEagleStdio
/
qplanetosm
通知
118
Star
10
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
qplanetosm
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1cbcaffa
编写于
2月 13, 2016
作者:
丁劲犇
😸
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1. replace geomarker's send_event to post_event.
2. individually update tableView instead of at one time.
上级
ec59f4e4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
62 addition
and
72 deletion
+62
-72
qtvplugin_geomarker/geographicsscene.cpp
qtvplugin_geomarker/geographicsscene.cpp
+5
-2
qtvplugin_geomarker/geographicsscene.h
qtvplugin_geomarker/geographicsscene.h
+9
-8
qtvplugin_geomarker/qtvplugin_geomarker.cpp
qtvplugin_geomarker/qtvplugin_geomarker.cpp
+9
-11
qtvplugin_geomarker/qtvplugin_geomarker.h
qtvplugin_geomarker/qtvplugin_geomarker.h
+11
-11
qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp
qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp
+28
-40
未找到文件。
qtvplugin_geomarker/geographicsscene.cpp
浏览文件 @
1cbcaffa
...
...
@@ -123,7 +123,10 @@ namespace QTVP_GEOMARKER{
QList
<
geoItemBase
*>
geoGraphicsScene
::
geo_items
()
{
return
m_map_items
.
values
();
return
std
::
move
(
m_map_items
.
values
());
}
QList
<
QString
>
geoGraphicsScene
::
geo_item_names
()
{
return
std
::
move
(
m_map_items
.
keys
());
}
}
qtvplugin_geomarker/geographicsscene.h
浏览文件 @
1cbcaffa
...
...
@@ -59,15 +59,16 @@ namespace QTVP_GEOMARKER{
void
removeItem
(
QGraphicsItem
*
item
){
return
QGraphicsScene
::
removeItem
(
item
);}
public
:
//for many items, we just change level coords in timer, batch mode.
bool
deal_level_queue
();
double
progress_queue
()
{
return
1
-
m_queue_level_change
.
size
()
*
1.0
/
m_map_items
.
size
();}
bool
deal_level_queue
();
double
progress_queue
()
{
return
1
-
m_queue_level_change
.
size
()
*
1.0
/
m_map_items
.
size
();}
//For mutithread opertaions, you should call lock_scene first, and call unlock scene when over
bool
addItem
(
geoItemBase
*
item
,
int
/*reserved*/
);
void
removeItem
(
geoItemBase
*
item
,
int
/*reserved*/
);
geoItemBase
*
geoitem_by_name
(
const
QString
&
name
);
void
adjust_item_coords
(
int
currentLevel
);
QList
<
geoItemBase
*>
geo_items
();
int
total_items
()
{
return
m_map_items
.
count
();}
bool
addItem
(
geoItemBase
*
item
,
int
/*reserved*/
);
void
removeItem
(
geoItemBase
*
item
,
int
/*reserved*/
);
geoItemBase
*
geoitem_by_name
(
const
QString
&
name
);
void
adjust_item_coords
(
int
currentLevel
);
QList
<
geoItemBase
*>
geo_items
();
QList
<
QString
>
geo_item_names
();
int
total_items
()
{
return
m_map_items
.
count
();}
};
}
#endif // GEOGRAPHICSSCENE_H
qtvplugin_geomarker/qtvplugin_geomarker.cpp
浏览文件 @
1cbcaffa
...
...
@@ -356,7 +356,8 @@ bool qtvplugin_geomarker::cb_mouseDoubleClickEvent(QMouseEvent * e)
if
(
m_bVisible
&&
pwig
&&
too_many_items
()
==
false
)
{
// Convert and deliver the mouse event to the scene.
QGraphicsSceneMouseEvent
mouseEvent
(
QEvent
::
GraphicsSceneMouseDoubleClick
);
QGraphicsSceneMouseEvent
*
pmouseEvent
=
new
QGraphicsSceneMouseEvent
(
QEvent
::
GraphicsSceneMouseDoubleClick
);
QGraphicsSceneMouseEvent
&
mouseEvent
=
*
pmouseEvent
;
mouseEvent
.
setWidget
(
pwig
);
mouseEvent
.
setButtonDownScenePos
(
mouse_button
,
mouse_scene_pt
);
mouseEvent
.
setButtonDownScreenPos
(
mouse_button
,
mouse_screen_pt
);
...
...
@@ -368,10 +369,8 @@ bool qtvplugin_geomarker::cb_mouseDoubleClickEvent(QMouseEvent * e)
mouseEvent
.
setButton
(
e
->
button
());
mouseEvent
.
setModifiers
(
e
->
modifiers
());
mouseEvent
.
setAccepted
(
false
);
QApplication
::
sendEvent
(
m_pScene
,
&
mouseEvent
);
bool
isAccepted
=
mouseEvent
.
isAccepted
();
e
->
setAccepted
(
isAccepted
);
return
isAccepted
;
QApplication
::
postEvent
(
m_pScene
,
&
mouseEvent
);
scheduleUpdateMap
();
}
return
false
;
}
...
...
@@ -405,7 +404,8 @@ bool qtvplugin_geomarker::cb_mousePressEvent(QMouseEvent * e)
if
(
m_bVisible
&&
pwig
&&
too_many_items
()
==
false
)
{
// Convert and deliver the mouse event to the scene.
QGraphicsSceneMouseEvent
mouseEvent
(
QEvent
::
GraphicsSceneMousePress
);
QGraphicsSceneMouseEvent
*
pmouseEvent
=
new
QGraphicsSceneMouseEvent
(
QEvent
::
GraphicsSceneMouseDoubleClick
);
QGraphicsSceneMouseEvent
&
mouseEvent
=
*
pmouseEvent
;
mouseEvent
.
setWidget
(
pwig
);
mouseEvent
.
setButtonDownScenePos
(
mouse_button
,
mouse_scene_pt
);
mouseEvent
.
setButtonDownScreenPos
(
mouse_button
,
mouse_screen_pt
);
...
...
@@ -417,11 +417,8 @@ bool qtvplugin_geomarker::cb_mousePressEvent(QMouseEvent * e)
mouseEvent
.
setButton
(
e
->
button
());
mouseEvent
.
setModifiers
(
e
->
modifiers
());
mouseEvent
.
setAccepted
(
false
);
QApplication
::
sendEvent
(
m_pScene
,
&
mouseEvent
);
bool
isAccepted
=
mouseEvent
.
isAccepted
();
e
->
setAccepted
(
isAccepted
);
//return isAccepted;
return
true
;
QApplication
::
postEvent
(
m_pScene
,
&
mouseEvent
);
scheduleUpdateMap
();
}
return
false
;
...
...
@@ -472,6 +469,7 @@ void qtvplugin_geomarker::scheduleRefreshMarks()
//BAD performence will arise if so.
//We will set a flag and refresh the ui in timerEvent Instead.
m_bNeedRefresh
=
true
;
m_items_to_insert
.
clear
();
}
void
qtvplugin_geomarker
::
scheduleUpdateMap
()
{
...
...
qtvplugin_geomarker/qtvplugin_geomarker.h
浏览文件 @
1cbcaffa
...
...
@@ -110,14 +110,16 @@ private:
//UI refreshing functions
private:
void
scheduleRefreshMarks
();
void
scheduleUpdateMap
();
void
refreshItemUI
(
QString
markname
);
void
refreshProps
(
QTVP_GEOMARKER
::
geoItemBase
*
itm
);
QColor
string2color
(
const
QString
&
s
);
QString
color2string
(
const
QColor
&
c
);
void
refreshIconModel
();
QList
<
QString
>
m_items_to_insert
;
void
scheduleRefreshMarks
();
void
scheduleUpdateMap
();
void
refreshItemUI
(
QString
markname
);
void
refreshProps
(
QTVP_GEOMARKER
::
geoItemBase
*
itm
);
QColor
string2color
(
const
QString
&
s
);
QString
color2string
(
const
QColor
&
c
);
void
refreshIconModel
();
void
loadTranslations
();
bool
too_many_items
();
//Geo mark updating functions
private:
//update methopd for UI
...
...
@@ -166,10 +168,8 @@ protected:
bool
cb_mouseDoubleClickEvent
(
QMouseEvent
*
);
bool
cb_event
(
const
QMap
<
QString
,
QVariant
>
);
void
timerEvent
(
QTimerEvent
*
e
);
void
timerEvent
(
QTimerEvent
*
e
);
QMap
<
QString
,
QVariant
>
call_func
(
const
QMap
<
QString
,
QVariant
>
&
/*paras*/
);
void
loadTranslations
();
bool
too_many_items
();
//ui slots
protected
slots
:
void
on_pushButton_update_clicked
();
...
...
qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp
浏览文件 @
1cbcaffa
...
...
@@ -18,50 +18,38 @@ void qtvplugin_geomarker::timerEvent(QTimerEvent * e)
{
if
(
e
->
timerId
()
==
m_nTimerID_refreshUI
&&
m_bNeedRefresh
)
{
m_bNeedRefresh
=
false
;
killTimer
(
m_nTimerID_refreshUI
);
m_nTimerID_refreshUI
=
-
1
;
if
(
m_items_to_insert
.
empty
()
==
true
)
{
m_items_to_insert
=
m_pScene
->
geo_item_names
();
m_pGeoItemModel
->
clear
();
}
//refersh
int
rowCount
=
m_pGeoItemModel
->
rowCount
();
QList
<
QTVP_GEOMARKER
::
geoItemBase
*>
items
=
m_pScene
->
geo_items
();
int
c
=
0
;
foreach
(
QTVP_GEOMARKER
::
geoItemBase
*
item
,
items
)
int
ct
=
0
;
//we do not use geoItemsBase pointer, because a geoItemsBase pointer may be invalid when delayed ipdate approach is taking place.
while
(
++
ct
<
2048
&&
m_items_to_insert
.
empty
()
==
false
)
{
if
(
c
<
rowCount
)
{
m_pGeoItemModel
->
setData
(
m_pGeoItemModel
->
index
(
c
,
0
),
item
->
item_name
()
);
m_pGeoItemModel
->
setData
(
m_pGeoItemModel
->
index
(
c
,
1
),
QTVP_GEOMARKER
::
item_name_by_enum
(
item
->
item_type
())
);
m_pGeoItemModel
->
setData
(
m_pGeoItemModel
->
index
(
c
,
2
),
item
->
prop_counts
()
);
}
else
{
m_pGeoItemModel
->
appendRow
(
new
QStandardItem
(
item
->
item_name
()));
m_pGeoItemModel
->
setData
(
m_pGeoItemModel
->
index
(
c
,
1
),
QTVP_GEOMARKER
::
item_name_by_enum
(
item
->
item_type
())
);
m_pGeoItemModel
->
setData
(
m_pGeoItemModel
->
index
(
c
,
2
),
item
->
prop_counts
()
);
QString
keyname
=
m_items_to_insert
.
first
();
m_items_to_insert
.
pop_front
();
QTVP_GEOMARKER
::
geoItemBase
*
item
=
m_pScene
->
geoitem_by_name
(
keyname
);
if
(
!
item
)
continue
;
int
c
=
m_pGeoItemModel
->
rowCount
();
m_pGeoItemModel
->
appendRow
(
new
QStandardItem
(
item
->
item_name
()));
m_pGeoItemModel
->
setData
(
m_pGeoItemModel
->
index
(
c
,
1
),
QTVP_GEOMARKER
::
item_name_by_enum
(
item
->
item_type
())
);
m_pGeoItemModel
->
setData
(
m_pGeoItemModel
->
index
(
c
,
2
),
item
->
prop_counts
()
);
}
++
c
;
}
if
(
c
<
rowCount
)
m_
pGeoItemModel
->
removeRows
(
c
,
rowCount
-
c
)
;
m_nTimerID_refreshUI
=
startTimer
(
2
000
);
if
(
m_items_to_insert
.
empty
()
==
true
)
m_
bNeedRefresh
=
false
;
m_nTimerID_refreshUI
=
startTimer
(
2
17
);
}
else
if
(
m_nTimerID_refreshMap
==
e
->
timerId
()
&&
m_bNeedUpdateView
==
true
)
{
...
...
@@ -69,7 +57,7 @@ void qtvplugin_geomarker::timerEvent(QTimerEvent * e)
killTimer
(
m_nTimerID_refreshMap
);
m_nTimerID_refreshMap
=
-
1
;
m_pVi
->
UpdateWindow
();
m_nTimerID_refreshMap
=
startTimer
(
100
);
m_nTimerID_refreshMap
=
startTimer
(
97
);
}
else
if
(
m_nTimerID_levelQueue
==
e
->
timerId
())
{
...
...
@@ -82,7 +70,7 @@ void qtvplugin_geomarker::timerEvent(QTimerEvent * e)
if
(
m_pScene
->
progress_queue
()
<
0.999
)
m_pVi
->
UpdateWindow
();
}
m_nTimerID_levelQueue
=
startTimer
(
1
00
);
m_nTimerID_levelQueue
=
startTimer
(
1
19
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录