qt中handler的定义


Handler的定义:
主要接受子线程发送的数据, 并用此数据配合主线程更新UI.
解释: 当应用程序启动时 , Android首先会开启一个主线程 (也就是UI线程) , 主线程为管理界面中的UI控件,进行事件分发, 比如说, 你要是点击一个 Button ,Android会分发事件到Button上,来响应你的操作 。如果此时需要一个耗时的操作,例如: 联网读取数据,或者读取本地较大的一个文件的时候,你不能把这些操作放在主线程中 , ,如果你放在主线程中的话,界面会出现假死现象, 如果5秒钟还没有完成的话,会收到Android系统的一个错误提示 "强制关闭". 这个时候我们需要把这些耗时的操作,放在一个子线程中,因为子线程涉及到UI更新,Android主线程是线程不安全的,也就是说,更新UI只能在主线程中更新,子线程中操作是危险的. 这个时候,Handler就出现了.,来解决这个复杂的问题 , 由于Handler运行在主线程中(UI线程中), 它与子线程可以通过Message对象来传递数据, 这个时候,Handler就承担着接受子线程传过来的(子线程用sedMessage()方法传弟)Message对象 , (里面包含数据) , 把这些消息放入主线程队列中,配合主线程进行更新UI 。
Handler 概念解释:
handler类允许你发送消息和处理线程消息队列中的消息及runnable对象 。handler实例都是与一个线程和该线程的消息队列一起使用,一旦创建了一个新的handler实例,系统就把该实例与一个线程和该线程的消息队列捆绑起来,这将可以发送消息和runnable对象给该消息队列,并在消息队列出口处处理它们 。
handler类有两种主要用途:1 。按照时间计划,在未来某时刻,对处理一个消息或执行某个runnable实例 。2 。把一个对另外线程对象的操作请求放入消息队列中,从而避免线程间冲突 。
时间类消息通过如下方法使用: post(Runnable), postAtTime(Runnable, long), postDelayed(Runnable, long), sendEmptyMessage(int), sendMessage(Message), sendMessageAtTime(Message, long), and sendMessageDelayed(Message, long)
methods. post之类函数可以传输一个runnable对象给消息队列 , 并在到达消息队列后被调用 。sendmessage之类函数可以传送一个包含数据的message对象,该message对象可以被Handler类的handleMessage(Message) 方法所处理 。
post之类函数和sendmessage之类的函数都可以指定消息的执行时机,是立即执行、稍后一段时间执行,还是在某个确定时刻执行 。这可以用来实现超时、消息或其他时间相关的操作 。
当一个进程启动时,主线程独立执行一个消息队列 , 该队列管理着应用顶层的对象(如:activities、broadcast receivers等等)和所有创建的窗口 。你可以创建自己的一个线程,并通过handler来与主线程进行通信 。这可以通过在新的线程中调用主线程的handler的post和sendmessage操作来实现 。
HandlerThread/Looper & MessageQueue & Message的关系:
handler 负责将需要传递的信息封装成Message,通过handler 对象的sendMessage()来将消息传递给Looper,由Looper将Message放入MessageQueue中 。当Looper对象看到MessageQueue中含有Message,就将其广播出去 。该handler 对象收到该消息后,调用相应的handler对象的handleMessage()方法对其进行处理 。
Handler一些特点
handler可以分发Message对象和Runnable对象到主线程中, 每个Handler实例,都会绑定到创建他的线程中(一般是位于主线程),
它有两个作用:
(1): 安排消息或Runnable 在某个主线程中某个地方执行,
(2)安排一个动作在不同的线程中执行
Handler中分发消息的一些方法
post(Runnable)
postAtTime(Runnable,long)
postDelayed(Runnable long)
sendEmptyMessage(int)
sendMessage(Message)
sendMessageAtTime(Message,long)
sendMessageDelayed(Message,long)
以上post类方法允许你排列一个Runnable对象到主线程队列中,
sendMessage类方法, 允许你安排一个带数据的Message对象到队列中,等待更新.
HANDLE 还可以怎么解释一、二者的含义不同
1、handle
v. 处理;对待;操作;触;买卖
n. 把手;柄
2、operator
n. 操作员;技工;管理者;报务员;计运算符
二、二者的词性不同
1、handle
可作动词也可作名词 。
2、operator
只能作名词 。
三、二者的用法不同
1、handle
handle主要用作及物动词,宾语可以是人或事物; 偶尔用作不及物动词,其主动形式往往表示被动意义 。
2、operator
用作名词 (n.)
Is this man a teaccher or an operator?
这个男人是老师还是名操作员?
handle
[5hAnd(E)l]
n.柄, 把手, 把柄, 口实, 手感
vt.触摸, 运用, 买卖, 处理, 操作
vi.搬运, 易于操纵
n.[计]句柄
carry on deal in direct feel finger govern manage manipulate regulate run touch trade in use
handle
hand 手-le 后缀
[5hAnd(E)l]
n
柄,把手
把柄
头衔
fly off the handle
发脾气
handle
vt
-dled, -dling
触摸;拿
处理;应付;控制
Ms Hawkins handles the company's accounts.
霍金斯女士管理公司的账目 。
I can't handle children.
我管不住孩子们 。
She handled a difficult argument skilfully.
她巧妙地应付了一场艰难的辩论 。
对待
Handle children kindly, if you want them to trust you.
假如你要孩子们信任你 , 就要对他们和气些 。
The speaker handled his subject concisely.
演讲者对主题作了简要的论述 。
经销;买卖
This shop handles paper and stationery.
这家商店经营纸张文具 。
This bookstore doesn't handle medical books.
这家书店不经销医学类书藉 。
操作
He learnt how to handle an axe.
他学会了怎样使斧头 。
This motorcar handles well.
这摩托车很好驾驶 。
carry on deal in direct feel finger govern manage manipulate regulate run touch trade in use
handle
[5hAndl]
n.
柄, 把手
(摸物时的)手感
把柄, 可乘之机, 口实
[口]称号, 头衔
(赛马等时投下的)赌金总额
ahandleto one's name
[口]头衔(如 Lord, Dr. 等)
handle
vt.
触, 摸, 拿, 弄
运用; 操纵; 驾驭(马)
处理, 指挥, 管理; 讨论; 对待
经销, 买卖
[美]训练(拳击选手)
handle tobacco
经营烟草生意
handle sb. kindly
善待某人
handle a philosophic topic
讨论哲学题目
handle
vi.
(用手)搬运
易于操纵, 举动 H-with care! 小心轻放!
handlebar
n.
(自行车等的)把手; 操纵柄
handle-body
n.
环柄体
fly [go, slip] off the handle
[美口]冒火, 激动; 死, 翘辫子
give a handle for [to]
使人有可乘之机, 给人以口实
handle of the face
[谑]鼻子
have two handles
有两个方面; 有两种解
pump handle
抽水泵的把手
热情的握手
take (sth.) by the best handle
以最好的方法去对待[理解](某事物)
throw the handle after the blade
刀身丢失后连刀柄也扔掉; 破罐子破摔; 孤注一掷
up to the handle
[美]彻底地; 完全地; 极度地
abort handle
紧急停车手柄; 应急把手
adjusting handle
调节手柄
alarm signal handle
报警信号手柄
angle cock handle
折角塞门手把
automatic brake valve handle
自动制动阀手把
binding handle
制动手把
blind pinch handle
窗帘拉手
block handle
闭塞手柄
bolt handle
闩柄; 拉机柄
bottom door operating handle
底门摇把
canopy manual operating handle
座舱盖手控柄
capstan handle
十字手柄
carriage handle
移动刀架手柄
catch handle
闭止把; 键柄
changeover handle
转换手把
chuck handle
卡盘扳手; 钻夹头钥匙
clamping handle
制动柄
clasp handle
键柄
clutch handle
离合器手把
cocket handle
水龙头把手
cocking handle
机柄
combination handle
组合手柄
commode handle
上车扶手
compound rest handle
复式刀架手柄
conflicting route handles
敌对进路手柄
control handle
控制旋钮; 控制[操纵]手柄; 驾驶杆
corner handle
角部扶手
crank handle [lever]
手摇曲柄
cross handle
十字手柄
cross feed screw handle
横向进刀丝杠手柄
cut-out cock handle
遮断塞门手把
dead-man's handle
安全手柄
die handle
板牙架[扳手]
dimming handle
灯光变暗手柄
dipper handle
挖掘机杓斗杆
door handle
门手把
double hexagonal opening box socket wrench with straight handle
直柄梅花扳手
driving handle
【qt中handler的定义】驾驶[操纵]杆
ear handle
耳柄
elevating handle
(火炮)高低机转把
emergency stop handle
紧急停车手柄
engine starting handle
发动机起动手柄
engineer's brake valve handle
司机制动阀手柄
fixed handle
固定柄
firedoor handle
炉门把
flask handle
砂箱把
flat handle
扁平手柄
flush handle
平头手把
focus handle
聚焦手柄[旋钮]
free handle
活动手柄
gear emergency lowering handle
起落架应急释放柄
governor handle
调速器手把
grab handle
握柄; 抓具
hammer handle
锤柄, 链球把手
hand brake handle
手制动手把
hand handle
手感; 手柄
hand wheel handle
手轮柄
hood handle
机罩柄
index handle
分度柄
jamming handle
夹紧装置的手柄; 夹紧手柄
landing gear release handle
起落架释放杆
latch handle
闭止把; 键柄
lever handle
杠杆手柄; 搬把式门拉手
lever latch handle
握柄闭止把
lifting handle
提升螺杆
locking handle
止动柄; 闭锁柄
machine handle
机器手柄
manual cranking handle
手摇起动手柄
manual reversing handle
手动换向(手)把
non-return handle
不返手柄
oil cut -off valve handle
断油阀柄
operating handle
操纵杆; 操作手柄
outdoor handle
外手柄
parking brake handle
停机刹车操纵杆
power regulating handle
功率调节手柄
pull handle
拖曳柄
ram clamping handle
锤头夹持手柄
ratchet handle
棘轮手柄
regeneration handle
再生手柄
regulator handle
调节器手柄
releasing handle
释放柄; 放松柄
removable handle
可拆手柄
removable lifting handle
活络箱把
reset handle
重调手把
returning handle
回动手把
reverse lever handle
回动杆柄; 回动杆把手
reversible handle
可逆[双向]把手
riveting handle
铆叉
rocking handle
摇柄
route handle
进路手柄
safety handle
保险手柄
scutching handles
人工打麻机
shifting handle
移动柄; 开关柄
shutdown handle
停车手柄
signal handle
信号手柄
spider handle
手轮; 小飞轮; 舵轮; 方向盘; 十字手柄
star handle
星形手轮; 小飞轮; 舵轮; 方向盘
starting crank handle
起动手摇曲柄
steering lever handle
转向杆柄
straddling dipper handle
挖土机土斗撑杆
strip handle
起模手柄
switch handle
开关把手
tap handle
丝锥扳手[手柄]
tiller handle
舵杆柄; 手柄端头
towing handle
拖杆, 牵引杆
tuning handle
调谐手柄
valve handle
阀杆
welding handle
焊条夹; 电极夹钳
wiper handle
刮水器柄
handle
AHD:[h瞡背l]
D.J.:[6h#ndl]
K.K.:[6h#ndl]
v.
han.dled; han.dling; han.dles;
handle
v.tr.
To touch, lift, or hold with the hands.
To operate with the hands; manipulate.
To deal with or have responsibility for; conduct:
handles matters of corporate law.
To cope with or dispose of:
handles problems efficiently.
To direct, execute, or dispose of:
handle an investment.
To manage, administer to, or represent:
handle a boxer.
To deal or trade in the purchase or sale of:
a branch office that handles grain exports.
handle
v.intr.
To act or function in a given way while in operation:
a car that handles well in the snow; a boat that handles poorly in rough water.
handle
n.
A part that is designed to be held or operated with the hand.
An opportunity or a means for achieving a purpose.
Slang
A person's name.
Games
The total amount of money bet on an event or over a set period of time.
have a handle on
To achieve an understanding of:
I was finally able to get a handle on the true nature of the problem.
Middle English handelen
fromOld English handlian
handleless
handle manipulate wield plyThese verbs mean to use or operate with or as if with the hands.Handleapplies widely and suggests competence:
He handles an ax like a born woodsman.
She handled the employee's problem with sensitivity and direction. Manipulateconnotes skillful or artful management,as of a tool or an instrument:
The radio operator manipulated the dials and changed the frequency.Whenmanipulate refers to people or personal affairs, it often implies deviousness or the use of improper influence or fraud in gaining an end:
I put forth his suggestion as my own without realizing I had been manipulated. Wieldimplies freedom, skill, and ease in handling physical or figurative tools and implements:
wield a hatchet;
wields a persuasive pen.It also connotes effectiveness in the exercise of intangibles such as authority or influence:
wielded enormous power. Plysuggests industry and persistence, as in the use of tools (
plying a knife and fork with gusto); the term also applies to the regular and diligent engagement in a task or pursuit (
plies the baker's trade).
See Also: touch treat
handle
n.柄,把手 vt.拿,触
[5hAnd(E)l]
handle
汉都广告
http://www.handle.com.cn
handle
AHD:[h瞡背l]
D.J.:[6h#ndl]
K.K.:[6h#ndl]
v.
han.dled; han.dling; han.dles;
handle
v.tr.
To touch, lift, or hold with the hands.
用双手触摸、举起或握住
To operate with the hands; manipulate.
用手操作;操纵
To deal with or have responsibility for; conduct:
处理或负责;管理:
handles matters of corporate law.
处理公司法的事物
To cope with or dispose of:
对付或处理:
handles problems efficiently.
有效地处理问题
To direct, execute, or dispose of:
指示 , 实行,处理:
handle an investment.
进行一项投资
To manage, administer to, or represent:
管理,支配,代表:
handle a boxer.
给拳击手作经纪人
To deal or trade in the purchase or sale of:
经营买卖、经销:
a branch office that handles grain exports.
经营谷物出口的一家分公司
handle
v.intr.
To act or function in a given way while in operation:
操作,操控操作时以指定的方式行动:
a car that handles well in the snow; a boat that handles poorly in rough water.
在雪地里易于驾驶的车子;在急流中难以操控的船
handle
n.
A part that is designed to be held or operated with the hand.
把手设计用来由手握住或操纵的部位
An opportunity or a means for achieving a purpose.
可乘之机实现目的的机会或方式
Slang
俚语
A person's name.
名称,头衔一个人的名字
Games
游戏
The total amount of money bet on an event or over a set period of time.
赌注在一次或一段固定的时间内的用来打赌的钱的总数
have a handle on
To achieve an understanding of:
理解,明白:
I was finally able to get a handle on the true nature of the problem.
最终我能够理解这个问题的实质
Middle English handelen
中古英语 handelen
fromOld English handlian
源自古英语 handlian
handleless
handle manipulate wield plyThese verbs mean to use or operate with or as if with the hands.Handleapplies widely and suggests competence:
He handles an ax like a born woodsman.
他使起斧子就象是一个天生在森林中居住的人 。
She handled the employee's problem with sensitivity and direction. Manipulateconnotes skillful or artful management,as of a tool or an instrument:
她凭直觉处理雇工问题 。Manipulate显示出技巧性和处理问题的艺术性,例如一件工具或仪器:
The radio operator manipulated the dials and changed the frequency.Whenmanipulate refers to people or personal affairs, it often implies deviousness or the use of improper influence or fraud in gaining an end:
无线员操作调度表盘,转换频率 。当 manipulate指人或私人事物时,它经常暗示用不光明正大或借助不正确的影响或欺诈行为以获得结果:
I put forth his suggestion as my own without realizing I had been manipulated. Wieldimplies freedom, skill, and ease in handling physical or figurative tools and implements:
我把他的意见作为我自己的提了出来,丝毫没有意识到我被利用了 。Wield暗示在操纵一些实际的或象征性的工具或仪器时的挥洒自如、技巧和随意:
wield a hatchet;
挥动一柄战斧;
wields a persuasive pen.It also connotes effectiveness in the exercise of intangibles such as authority or influence:
运用具说服力的笔杆子 。它还意味着其中有诸如权威和影响等不可捉摸的东西的效力:
wielded enormous power. Plysuggests industry and persistence, as in the use of tools (
行使极大的权力 。Ply暗示在诸如使用工具时的勤奋和坚持不懈(
plying a knife and fork with gusto); the term also applies to the regular and diligent engagement in a task or pursuit (
以极大的热情起劲地挥舞着刀和叉);这个词还意味着经常性地、勤奋地从事某项任务或活动(
plies the baker's trade).
勤奋经营烤面包业)
See Also: touch treat

    推荐阅读