设为首页 加入收藏

TOP

QT在嵌入式Linux环境下运行
2014-11-24 03:27:14 来源: 作者: 【 】 浏览:0
Tags:嵌入式 Linux 环境 运行

运行嵌入式程序

在嵌入式QT版本中,程序需要服务器或自己作为服务器程序。服务器程序构造的方法是构造一个QApplication::GuiServe类型的QApplication对象。或者使用-qws命令选项启动程序。


Using a Single Display
使用-qws选项
接下来的程序可以当做客户端来运行,只要不使用-qws选项。那么客户端程序就会自动连接到服务程序中。


using Mutiple Displays
嵌入式版本中运行多个县市同时运行。两种方式可以实现,要么多次运行服务程序,要么使用read-mae Multi screen driver
当多个服务程序运行时,每个程序必须使用-display选项指定显示驱动,或者使用QWS_DISPLAY环境变量来指定。
服务程序运行时:
./mysecondserverapplication -qws -display "QVFb:2"
客户程序运行时:
./myclientapplication -display "QVFb:2"


若想在不同显示器移动应用程序,则只能通过Muti显示器实现。
./myserverapplication -qws -display "Multi: QVFb:0
QVFb:1:offset=0,0 VNC:offset=640,0 :2"


程序启动命令选项:
-fn 定义程序的字体,例如./myapplication -fn helvetica


-bg 设置程序默认背景颜色 例如./myapplication -bg blue,颜色名称必须能被QColor类构造函数识别


-btn 设置默认的按钮颜色,例如./myapplication -btn green 同样颜色必须被认识


-fg 设置foreground颜色,例如./myapplication -fg 'dark blue' 同上需被认识


-name 设置应用程序名字 例如./myapplication -name texteditapplication


-title 设置应用程序标题。./myapplication -title 'Text Edit'</p><br/><p>-geometry <width>x<height>+<Xoffset>+<Yoffset><br />设置窗口大小, ./myapplication -geometry 300x200+50+50</p><br/><p>-keyboard 启动键盘</p><br/><p>-nokeyboard 关闭键盘</p><br/><p>-mouse 启动鼠标</p><br/><p>-nomouse 关闭鼠标</p><br/><p>-qws 设置为服务程序</p><br/><p>-display 设置显示器驱动</p><br/><p>-decoration<style><br />设置程序的风格,例如./myapplication -decoration windows,只支持windows default styled</p><br/></span></font></td> </tr> </table> <!--//投票--> <table width="98%" border="0" cellspacing="0" cellpadding="0" style='TABLE-LAYOUT: fixed;WORD-WRAP: break-word;' align="center"> <tr> </tr> <tr> <td colspan="2" align="center" class="page" height="25"></td> </tr> <tr align="right"> <td colspan="2" height="25" > <SCRIPT LANGUAGE="JavaScript" src="https://www.cppentry.com/images/default/bencandy.js"></SCRIPT> 【<a href="javascript:doZoom(18)">大</a> <a href="javascript:doZoom(14)">中</a> <a href="javascript:doZoom(12)">小</a>】【<a href="javascript:doPrint()">打印</a>】 <input type=hidden value=1 name="h1" id="h1"> 【<a href="javascript:ft(1)" id="Maiweb1">繁体</a>】【<a href="https://www.cppentry.com/member/post.php?job=postnew&fid=54" target=_blank>投稿</a>】【<a href="https://www.cppentry.com/do/job.php?job=collect&fid=54&id=41821">收藏</a>】 【<a href="https://www.cppentry.com/do/job.php?job=recommend&fid=54&id=41821" target=_blank>推荐</a>】【<a href="https://www.cppentry.com/do/job.php?job=report&fid=54&id=41821" target=_blank>举报</a>】【<a href="https://www.cppentry.com/do/comment.php?fid=54&id=41821" target=_blank>评论</a>】 【<a href="javascript:window.close()">关闭</a>】 【<a href="javascript:window.close()"></a><a href="#">返回顶部</a>】</td> </tr> <tr> <td colspan="2" style="text-align:right"> <div> <div style="float:right"> <div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a><a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a></div> <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"32"},"share":{},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到:","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script> </div> <div style="float:right; font-size:14px">分享到: </div> </div> </td> </tr> <tr class="nextpage"> <td width="50%" align="left"><a href="bencandy.php?fid=54&id=41822" onclick="">上一篇</a>:<a href="bencandy.php?fid=54&id=41822" onclick="" title="Android ProgressDialog自定义方法">Android ProgressDialog自定义方法</a></td> <td width="50%" align="right" height="25"><a href="bencandy.php?fid=54&id=41820" onclick="">下一篇</a>:<a href="bencandy.php?fid=54&id=41820" onclick="" title="编译Linux2.6.x内核步骤及注意事项">编译Linux2.6.x内核步骤及注意事项</a></td> </tr> </table> </td> </tr> <tr> <td class="foot"> <h3 class="L"></h3> <h3 class="R"></h3> </td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" class="dragTable" id="view_article_bbs"> <tr> <td class="head"> <h3 class="L"></h3> <span class="TAG"> </span> <h3 class="R"></h3> </td> </tr> <tr> <td class="middle"> <script type="text/javascript" id="wumiiRelatedItems"></script><div style="display:none"><!--访问统计,这段代码,会加快内容的打开速度,但是会影响右边列表的打开速度,<script src='http://pw.cnzz.com/c.php?id=80674837' language='JavaScript' charset='gb2312'></script>--></div></td> </tr> <tr> <td class="foot"> <h3 class="L"></h3> <h3 class="R"></h3> </td> </tr> </table> <!-- --> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="dragTable" id="commentTable"> <tr> <td class="head"> <h3 class="L"></h3> <span class="TAG">评论</span> <h3 class="R"></h3> </td> </tr> <tr> <td class="middle"> <SCRIPT LANGUAGE="JavaScript"> <!-- document.write('<span id="comment_show"><img alt="内容加载中,请稍候..." src="https://www.cppentry.com/images/default/ico_loading3.gif"></span>'); document.write('<div style="display:none;"><iframe src="https://www.cppentry.com/do/comment_ajax.php?fid=54&aid=41821&iframeID=comment_show" width=0 height=0 name="comment_show"></iframe></div>'); //--> </SCRIPT> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <form name="form_comment" id="form_comment" method="post" target="comment_show" action="https://www.cppentry.com/do/comment_ajax.php?fid=54&aid=41821&iframeID=comment_show"> <tr style="display:" id="comment_username_tr"> <td width="16%"><span class="L">帐  号:</span></td> <td width="84%"><span class="R"> <input type="text" name="username" id="comment_username" size="12"> 密码: <input type="password" name="password" id="comment_password" size="12"> (<a href="https://www.cppentry.com/do/reg.php" target="_blank"><u>新用户注册</u></a>)</span></td> </tr> <tr style="display:" id="comment_yzimg_tr"> <td width="16%"><span class="L">验 证 码:</span></td> <td width="84%"> <input id="yzImgNum" type="text" name="yzimg" size="8"> <SCRIPT LANGUAGE="JavaScript"> <!-- document.write('<img border="0" id="yz_Img" name="imageField" onclick="this.src=this.src+Math.random();" src="https://www.cppentry.com/do/yzimg.php?'+Math.random()+'">'); //--> </SCRIPT> </td> </tr> <tr> <td width="16%"><span class="L">表  情:</span></td> <td width="84%"> <style type="text/css"> <!-- .selected {filter:Alpha(opacity=100);border:1px solid #FF9900} .unselected {filter:Alpha(opacity=50);border:1px solid #EDF8DD} --> </style> <SCRIPT LANGUAGE="JavaScript"> <!-- var prevIcon; function icon(num){ num.className="selected"; if(typeof(prevIcon)!="undefined"){ prevIcon.className="unselected"; }else{ document.all.firstface.className="unselected"; } if(num.className=="unselected"){ num.className="selected"; } prevIcon=num; document.getElementById("commentface").value=num.childNodes(0).id ; } //--> </SCRIPT> <table border=0 cellspacing=0 cellpadding=0> <tr> <td class="selected" onClick="icon(this)" id="firstface" style="cursor:hand"><img src="https://www.cppentry.com/images/default/faceicon/1.gif" width="20" height="20" id="1"></td> <td class="unselected" onClick="icon(this)" style="cursor:hand"><img src="https://www.cppentry.com/images/default/faceicon/2.gif" width="20" height="20" id="2"></td> <td class="unselected" onClick="icon(this)" style="cursor:hand"><img src="https://www.cppentry.com/images/default/faceicon/3.gif" width="20" height="20" id="3"></td> <td class="unselected" onClick="icon(this)" style="cursor:hand"><img src="https://www.cppentry.com/images/default/faceicon/4.gif" width="20" height="20" id="4"></td> <td class="unselected" onClick="icon(this)" style="cursor:hand"><img src="https://www.cppentry.com/images/default/faceicon/5.gif" width="20" height="20" id="5"></td> <td class="unselected" onClick="icon(this)" style="cursor:hand"><img src="https://www.cppentry.com/images/default/faceicon/6.gif" width="20" height="20" id="6"></td> <td class="unselected" onClick="icon(this)" style="cursor:hand"><img src="https://www.cppentry.com/images/default/faceicon/7.gif" width="20" height="20" id="7"></td> <td class="unselected" onClick="icon(this)" style="cursor:hand"><img src="https://www.cppentry.com/images/default/faceicon/8.gif" width="20" height="20" id="8"></td> <td class="unselected" onClick="icon(this)" style="cursor:hand"><img src="https://www.cppentry.com/images/default/faceicon/9.gif" width="20" height="20" id="9"></td> <td class="unselected" onClick="icon(this)" style="cursor:hand"><img src="https://www.cppentry.com/images/default/faceicon/10.gif" width="20" height="20" id="10"></td> <td class="unselected" onClick="icon(this)" style="cursor:hand"><img src="https://www.cppentry.com/images/default/faceicon/11.gif" width="20" height="20" id="11"></td> <td class="unselected" onClick="icon(this)" style="cursor:hand"><img src="https://www.cppentry.com/images/default/faceicon/12.gif" width="20" height="20" id="12"></td> <td class="unselected" onClick="icon(this)" style="cursor:hand"><img src="https://www.cppentry.com/images/default/faceicon/13.gif" width="20" height="20" id="13"></td> <td class="unselected" onClick="icon(this)" style="cursor:hand"><img src="https://www.cppentry.com/images/default/faceicon/14.gif" width="20" height="20" id="14"></td> <td align="center" valign="top"> <input name="commentface" type="hidden" value="1"> </td> </tr> </table> </td> </tr> <tr> <td width="16%"><span class="L">内  容:</span></td> <td width="84%"><span class="R"> <textarea name="content" cols="50" rows="5" id="comment_content" onKeyDown="quickpost(event)"></textarea> </span></td> </tr> <tr> <td width="16%"> <script language="JavaScript"> <!-- cnt = 0; function quickpost(event){ if((event.ctrlKey && event.keyCode == 13)||(event.altKey && event.keyCode == 83)){ cnt++; if (cnt==1){ post_comment(); }else{ alert('内容正在提交...'); } } } function post_comment(){ if(document.getElementById("comment_yzimg_tr").style.display==''){ if(document.getElementById("yzImgNum").value==''){ alert('验证码不能为空!'); return false; } } if(document.getElementById("comment_content").value==''){ alert('内容不能为空!'); return false; } document.getElementById("form_comment").submit(); document.getElementById("comment_content").value=''; if(document.getElementById("yzImgNum")!=null){ document.getElementById("yzImgNum").value=''; document.getElementById("yz_Img").src="https://www.cppentry.com/do/yzimg.php?"+Math.random();; } limitTime=parseInt('5'); limitComment(); } //--> </script> </td> <td width="84%"><span class="R"> <input type="button" id="comment_submit" onclick="post_comment()" name="Submit" value="提交" class="button"> <input type="hidden" name="action" value="post"> </span></td> </tr></form> </table> </td> </tr> <tr> <td class="foot"> <h3 class="L"></h3> <h3 class="R"></h3> </td> </tr> </table> </div> <div class="Side"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="dragTable" id="sonSortName"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3873923678443673" crossorigin="anonymous"></script> <ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-3873923678443673" data-ad-slot="4891716010"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0" > <script>document.write(unescape('%3Cdiv id="hm_t_45532"%3E%3C/div%3E%3Cscript charset="utf-8" src="http://crs.baidu.com/t.js?siteId=238ce0d9669a08cae1971b03e0b2931a&planId=45532&async=0&referer=') + encodeURIComponent(document.referrer) + '&title=' + encodeURIComponent(document.title) + '&rnd=' + (+new Date) + unescape('"%3E%3C/script%3E'));</script> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="dragTable"> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="dragTable"> <script type="text/javascript"> document.write('<a style="display:none!important" id="tanx-a-mm_16790798_2355298_35944706"></a>'); tanx_s = document.createElement("script"); tanx_s.type = "text/javascript"; tanx_s.charset = "gbk"; tanx_s.id = "tanx-s-mm_16790798_2355298_35944706"; tanx_s.async = true; tanx_s.src = "http://p.tanx.com/ex?i=mm_16790798_2355298_35944706"; tanx_h = document.getElementsByTagName("head")[0]; if(tanx_h)tanx_h.insertBefore(tanx_s,tanx_h.firstChild); </script> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="dragTable"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="line-height:180%;">·<A HREF="https://www.cppentry.com/do/bencandy.php?fid=57&id=111653" target='_blank' style=";">常用meta整理 | 菜鸟</a></td> <td align="right" style="line-height:180%;">(2025-12-25 01:21:52)</td> </tr> </table><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="line-height:180%;">·<A HREF="https://www.cppentry.com/do/bencandy.php?fid=57&id=111652" target='_blank' style=";">SQL HAVING 子句:深</a></td> <td align="right" style="line-height:180%;">(2025-12-25 01:21:47)</td> </tr> </table><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="line-height:180%;">·<A HREF="https://www.cppentry.com/do/bencandy.php?fid=57&id=111651" target='_blank' style=";">SQL CREATE INDEX 语</a></td> <td align="right" style="line-height:180%;">(2025-12-25 01:21:45)</td> </tr> </table><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="line-height:180%;">·<A HREF="https://www.cppentry.com/do/bencandy.php?fid=54&id=111650" target='_blank' style=";">Shell 传递参数</a></td> <td align="right" style="line-height:180%;">(2025-12-25 00:50:45)</td> </tr> </table><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="line-height:180%;">·<A HREF="https://www.cppentry.com/do/bencandy.php?fid=54&id=111649" target='_blank' style=";">Linux echo 命令 - </a></td> <td align="right" style="line-height:180%;">(2025-12-25 00:50:43)</td> </tr> </table> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="dragTable"> </table> </div> </div> <div class="cleardiv"></div> <!-- --> <SCRIPT LANGUAGE="JavaScript"> <!--//目的是为了做风格方便 document.write('</div>'); //--> </SCRIPT> <SCRIPT LANGUAGE="JavaScript"> <!-- clickEdit.init(); //--> </SCRIPT> <div id="copyright"> Copyright@https://www.cppentry.com all rights reserved <a href="http://www.miibeian.gov.cn" target="_blank">粤ICP备13067022号-3</a><br> Powered by <a href="http://www.qibosoft.com" target="_blank">qibosoft V7.0</a> Code © 2003-11 <a href="http://bbs.qibosoft.com/" target="_blank">qibosoft</a> <br> </div> </body> </html>