??xml version="1.0" encoding="utf-8" standalone="yes"?>久久se精品一区精品二区国产 ,伊人久久国产免费观看视频 ,九九热久久免费视频http://www.shnenglu.com/cc/category/4796.html半亩方塘 天光云媄zh-cnTue, 13 Nov 2012 16:31:46 GMTTue, 13 Nov 2012 16:31:46 GMT60QtE序Release模式~译http://www.shnenglu.com/cc/archive/2012/11/12/195075.html北风之神007北风之神007Mon, 12 Nov 2012 06:01:00 GMThttp://www.shnenglu.com/cc/archive/2012/11/12/195075.htmlhttp://www.shnenglu.com/cc/comments/195075.htmlhttp://www.shnenglu.com/cc/archive/2012/11/12/195075.html#Feedback0http://www.shnenglu.com/cc/comments/commentRss/195075.htmlhttp://www.shnenglu.com/cc/services/trackbacks/195075.html   在Linux下用Qt开发了一些界面的E序Q编译出来结果比较大Q有的都上百兆,查了之后才知道编译出来的E序不是release模式的,我们需要在pro文g中增加编译指令,用release模式~译Q效率方面没有做试Q不q程序体U只是之前的十分之一Q正怺很多?br />
其实我们要做的不多,只要在pro文g中增加以下的选项卛_Q这样就可以release模式~译了?br />
CONFIG+=  release


北风之神007 2012-11-12 14:01 发表评论
]]>
Linux下QTE序字体讑֮错误造成E序中文qhttp://www.shnenglu.com/cc/archive/2010/09/25/127673.html北风之神007北风之神007Sat, 25 Sep 2010 14:37:00 GMThttp://www.shnenglu.com/cc/archive/2010/09/25/127673.htmlhttp://www.shnenglu.com/cc/comments/127673.htmlhttp://www.shnenglu.com/cc/archive/2010/09/25/127673.html#Feedback0http://www.shnenglu.com/cc/comments/commentRss/127673.htmlhttp://www.shnenglu.com/cc/services/trackbacks/127673.html   最q在Linux环境下写QT的程序,在我的测试机器上面QTE序Q在启动的时候设定了字符集ؓGBKQ中文都是显C正常的Q没有Q何问题,然后同学在他的虚拟机上面也写了QTE序Q可以怎么弄中文都是ؕ码,什么GBKQUTF-8{等的编码都讑֮了,可是依然qQ分析这U情况应该不是程序的问题Q很可能是QT字体的问题,于是在命令行输入qtconfigQ其他了qt配置E序Q在其中讑֮了其他的字体Q发现程序的中文p正常昄了?br>
  因此Q有时候程序没有问题了Q但是QT的字体设定错误也会造成中文q现象Q我们可以不通过qtconfigE序改变默认qtE序的字体,q可以在E序中强制设定程序本w所用的默认字体Q这样也是可以的Q这里只介绍q样的思\Q代码就不脓了,希望大家见的时候有个参考?/span>


北风之神007 2010-09-25 22:37 发表评论
]]>
QT Designer中安装QWT插ghttp://www.shnenglu.com/cc/archive/2008/09/05/60987.html北风之神007北风之神007Fri, 05 Sep 2008 04:54:00 GMThttp://www.shnenglu.com/cc/archive/2008/09/05/60987.htmlhttp://www.shnenglu.com/cc/comments/60987.htmlhttp://www.shnenglu.com/cc/archive/2008/09/05/60987.html#Feedback0http://www.shnenglu.com/cc/comments/commentRss/60987.htmlhttp://www.shnenglu.com/cc/services/trackbacks/60987.html  QWT是一套非怸错的开发库Q它能结合QT开发,做出非常好的曲线Q刻度,表盘{效果来?br>
  qwt的下载以及动态链接库的编译等q里׃做介l了。在源码目录下可以找到designer目录Q其中有插g的源码,~译完之后就会生成qwtplugin.dll和qwtplugin.libQ把他们拯?font face=Arial>$(QTDIR)\plugins\designer目录下,重新启动QT DesignerQ就会看到ToolBox面板中多ZQwtc,如下图所C。以上在QT3.3.4下测试通过Q?a style="COLOR: red" href="http://www.shnenglu.com/Files/cc/qwtplugin.rar">qwtplugin.dll和qwtplugin.lib下蝲


北风之神007 2008-09-05 12:54 发表评论
]]>
QT中求取中文字W串的长?/title><link>http://www.shnenglu.com/cc/archive/2007/10/16/34371.html</link><dc:creator>北风之神007</dc:creator><author>北风之神007</author><pubDate>Tue, 16 Oct 2007 12:40:00 GMT</pubDate><guid>http://www.shnenglu.com/cc/archive/2007/10/16/34371.html</guid><wfw:comment>http://www.shnenglu.com/cc/comments/34371.html</wfw:comment><comments>http://www.shnenglu.com/cc/archive/2007/10/16/34371.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/cc/comments/commentRss/34371.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cc/services/trackbacks/34371.html</trackback:ping><description><![CDATA[<p style="FONT-SIZE: 14pt">   在用QT~程的时候,我们处理字符串一般都使用的QT自带的QStringcdQ这个类型类gSTL中的stringcdQ还是非常好用的。不qQT的编码方式用UnicodeQ我猜测真是׃q个原因Q再使用QString的length()Ҏq回字符串长度的时候就会出现偏差,对于一般的西文字母是没有问题的Q但是对于中文字W却有问题了Q它把一个中文字W当作一个字节来处理了,所以像字符?#8220;你好QT”的长度返回的?Q而不??br><br>问题出现了,那么我们需要怎么解决呢,思\很简单,是转换~码Q然后再q行长度的求取,QT的文档里面有好多函数Q试验了半天Q终于找C个合适的函数Q顺利的完成了我的要求。该函数是fromLocal8Bit ( const char * local8Bit, int len = -1 )<br><br><span style="FONT-SIZE: 14pt"><strong><em>QCString QString::local8Bit () const <br>以本地指定的格式q回字符丌Ӏ在X11pȝ中,使用QTextCodec::codecForLocale()?在Windowspȝ中,它是一U系l指定的~码方式。在Mac OS X中,使用uft8作ؓ~码方式?br></em></strong><br> 有了上面的铺垫,下面问题就好办了,要想求取带中文的字符串的长度Q只需要稍微多C步而已。假设有字符串str="QT你好",那么我们主要q行str.local8Bit().length(),q样l果是6Q符合我们的要求了,事情是q样Q此文完Q?/span></p><img src ="http://www.shnenglu.com/cc/aggbug/34371.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cc/" target="_blank">北风之神007</a> 2007-10-16 20:40 <a href="http://www.shnenglu.com/cc/archive/2007/10/16/34371.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【{帖】常见的几个Qt~程问题的处?/title><link>http://www.shnenglu.com/cc/archive/2007/09/27/33041.html</link><dc:creator>北风之神007</dc:creator><author>北风之神007</author><pubDate>Thu, 27 Sep 2007 10:21:00 GMT</pubDate><guid>http://www.shnenglu.com/cc/archive/2007/09/27/33041.html</guid><wfw:comment>http://www.shnenglu.com/cc/comments/33041.html</wfw:comment><comments>http://www.shnenglu.com/cc/archive/2007/09/27/33041.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/cc/comments/commentRss/33041.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cc/services/trackbacks/33041.html</trackback:ping><description><![CDATA[Q、如果在H体关闭前自行判断是否可关闭<br>{:重新实现q个H体的closeEvent()函数Q加入判断操?br> <h6 class=quote>Quote:</h6> <blockquote><br>void MainWindow::closeEvent(QCloseEvent *event)<br>{<br>      if (maybeSave())<br>      {<br>              writeSettings();<br>              <span style="COLOR: blue">event->accept();</span><br>      }<br>      else<br>      {<br>              <span style="COLOR: blue">event->ignore();</span><br>      }<br>}<br></blockquote><br><br>Q、如何用打开和保存文件对?br>{:使用QFileDialog<br> <h6 class=quote>Quote:</h6> <blockquote><br>              <span style="COLOR: blue">QString fileName = QFileDialog::getOpenFileName(this);<br>              if (!fileName.isEmpty())</span><br>              {<br>                    loadFile(fileName);<br>              }<br></blockquote><br><br> <h6 class=quote>Quote:</h6> <blockquote><br>      <span style="COLOR: blue">QString fileName = QFileDialog::getSaveFileName(this);<br>      if (fileName.isEmpty())</span><br>      {<br>              return false;<br>      }<br></blockquote><br><br>Q、如果创建Actions(可在菜单和工h里用这些Action)<br>{:<br> <h6 class=quote>Quote:</h6> <blockquote><br>newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this);<br>        newAct->setShortcut(tr("Ctrl+N"));<br>        newAct->setStatusTip(tr("Create a new file"));<br>        connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));<br><br>        openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this);<br>        openAct->setShortcut(tr("Ctrl+O"));<br>        openAct->setStatusTip(tr("Open an existing file"));<br>        connect(openAct, SIGNAL(triggered()), this, SLOT(open()));<br><br>        saveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this);<br>        saveAct->setShortcut(tr("Ctrl+S"));<br>        saveAct->setStatusTip(tr("Save the document to disk"));<br>        connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));<br><br>        saveAsAct = new QAction(tr("Save &As..."), this);<br>        saveAsAct->setStatusTip(tr("Save the document under a new name"));<br>        connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));<br><br>        exitAct = new QAction(tr("E&xit"), this);<br>        exitAct->setShortcut(tr("Ctrl+Q"));<br>        exitAct->setStatusTip(tr("Exit the application"));<br>        connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));<br><br>        cutAct = new QAction(QIcon(":/images/cut.png"), tr("Cu&t"), this);<br>        cutAct->setShortcut(tr("Ctrl+X"));<br>        cutAct->setStatusTip(tr("Cut the current selection's contents to the "<br>                                "clipboard"));<br>        connect(cutAct, SIGNAL(triggered()), textEdit, SLOT(cut()));<br><br>        copyAct = new QAction(QIcon(":/images/copy.png"), tr("&Copy"), this);<br>        copyAct->setShortcut(tr("Ctrl+C"));<br>        copyAct->setStatusTip(tr("Copy the current selection's contents to the "<br>                                "clipboard"));<br>        connect(copyAct, SIGNAL(triggered()), textEdit, SLOT(copy()));<br><br>        pasteAct = new QAction(QIcon(":/images/paste.png"), tr("&Paste"), this);<br>        pasteAct->setShortcut(tr("Ctrl+V"));<br>        pasteAct->setStatusTip(tr("Paste the clipboard's contents into the current "<br>                                  "selection"));<br>        connect(pasteAct, SIGNAL(triggered()), textEdit, SLOT(paste()));<br><br>        aboutAct = new QAction(tr("&About"), this);<br>        aboutAct->setStatusTip(tr("Show the application's About box"));<br>        connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));<br><br>        aboutQtAct = new QAction(tr("About &Qt"), this);<br>        aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));<br>        connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));<br></blockquote><br>Q、如果创Z菜单<br>{:采用上面的QAction的帮助,创徏主菜?br> <h6 class=quote>Quote:</h6> <blockquote><br>      fileMenu = menuBar()->addMenu(tr("&File"));<br>        fileMenu->addAction(newAct);<br>        fileMenu->addAction(openAct);<br>        fileMenu->addAction(saveAct);<br>        fileMenu->addAction(saveAsAct);<br>        fileMenu->addSeparator();<br>        fileMenu->addAction(exitAct);<br><br>        editMenu = menuBar()->addMenu(tr("&Edit"));<br>        editMenu->addAction(cutAct);<br>        editMenu->addAction(copyAct);<br>        editMenu->addAction(pasteAct);<br><br>        menuBar()->addSeparator();<br><br>        helpMenu = menuBar()->addMenu(tr("&Help"));<br>        helpMenu->addAction(aboutAct);<br>        helpMenu->addAction(aboutQtAct);<br></blockquote><br><br>Q、如果创建工h<br>{:采用上面的QAction的帮助,创徏工具?br> <h6 class=quote>Quote:</h6> <blockquote><br>      fileToolBar = addToolBar(tr("File"));<br>        fileToolBar->addAction(newAct);<br>        fileToolBar->addAction(openAct);<br>        fileToolBar->addAction(saveAct);<br><br>        editToolBar = addToolBar(tr("Edit"));<br>        editToolBar->addAction(cutAct);<br>        editToolBar->addAction(copyAct);<br>        editToolBar->addAction(pasteAct);<br></blockquote><br>Q、如何用配|文件保存配|?br>{:使用QSettingsc?br> <h6 class=quote>Quote:</h6> <blockquote><br>      QSettings settings("Trolltech", "Application Example");<br>        QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();<br>        QSize size = settings.value("size", QSize(400, 400)).toSize();<br></blockquote><br><br> <h6 class=quote>Quote:</h6> <blockquote><br>      QSettings settings("Trolltech", "Application Example");<br>        settings.setValue("pos", pos());<br>        settings.setValue("size", size());<br></blockquote><br><br>Q、如何用警告、信息等对话?br>{:使用QMessageBoxcȝ静态方?br> <h6 class=quote>Quote:</h6> <blockquote><br>int ret = QMessageBox::warning(this, tr("Application"),<br>                        tr("The document has been modified.\n"<br>                            "Do you want to save your changes?"),<br>                        QMessageBox::Yes | QMessageBox::Default,<br>                        QMessageBox::No,<br>                        QMessageBox::Cancel | QMessageBox::Escape);<br>            if (ret == QMessageBox::Yes)<br>                return save();<br>            else if (ret == QMessageBox::Cancel)<br>                return false;<br></blockquote><br><br>Q、如何通用对话框中文化<br>{:对话框的中文?br>比如_QColorDialog的与文字相关的部分,主要在qcolordialog.cpp文g中,我们可以从qcolordialog.cpp?lupdate生成一个ts文gQ然后用自定义这个ts文g的翻译,再用lrelease生成一?qm文gQ当然了Q主E序p改变要支持多国语a了,使用q个.qm文g可以了?br><br>另外Q还有一个更快的ҎQ在源代码解开后有一个目录translationsQ下面有一?ts, .qm文gQ我们拷贝一个:<br> <h6 class=quote>Quote:</h6> <blockquote><br>cp src/translations/qt_untranslated.ts ./qt_zh_CN.ts<br></blockquote><br>然后Q我们就用Linguist打开q个qt_zh_CN.tsQ进行翻译了Q翻译完成后Q保存后Q再用lrelease命o生成qt_zh_CN.qmQ这P我们把它加入到我们的qt project中,那些pȝ的对话框Q菜单等{其它的默认是英文的东西p昄成中文了?br><br>Q、在Windows下Qt里ؓ什么没有终端输出?<br>{:把下面的配置加入到.pro文g?br> <h6 class=quote>Quote:</h6> <blockquote><br>win32:CONFIG += console<br></blockquote><br><br>10、Qt 4 for X11 OpenSource版如何静态链接?<br>{:~译安装的时候加?static选项<br> <h6 class=quote>Quote:</h6> <blockquote>./configure -static  Q/一定要加static选项<br>gmake<br>gmake install<br></blockquote><br>然后Q在Makefile文g中加 static 选项或者在.pro文g中加上QMAKE_LFLAGS += -staticQ就可以q接静态库了?br><br>11、想在源代码中直接用中文,而不使用tr()函数q行转换Q怎么办?<br>{:在main函数中加入下面三条语句,但ƈ不提?br> <h6 class=quote>Quote:</h6> <blockquote>    QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));<br>QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));<br>QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));<br></blockquote><br>或?br> <h6 class=quote>Quote:</h6> <blockquote>    QTextCodec::setCodecForLocale(QTextCodec::codecForName("GBK"));<br>QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GBK"));<br>QTextCodec::setCodecForTr(QTextCodec::codecForName("GBK"));<br></blockquote><br>使用GBKq是使用UTF-8Q依源文件中汉字使用的内码而定<br>q样Q就可在源文件中直接使用中文Q比如:<br> <h6 class=quote>Quote:</h6> <blockquote>QMessageBox::information(NULL, "信息", "关于本Y件的演示信息", QMessageBox::Ok, QMessageBox::NoButtons);<br></blockquote><br><br>12、ؓ什么将开发的使用数据库的E序发布到其它机器就q接不上数据库?<br>{:q是׃E序找不到数据库插g而致Q可照如下解x法:<br>在main函数中加入下面语句:<br> <h6 class=quote>Quote:</h6> <blockquote>QApplication::addLibraryPath(strPluginsPath");<br></blockquote><br>strPluginsPath是插件所在目录,比如此目录ؓ/myapplication/plugins<br>则将需要的sql驱动Q比如qsqlmysql.dll, qsqlodbc.dll或对应的.so文g攑ֈ<br>/myapplication/plugins/sqldrivers/<br>目录下面p?br>q是一U解x法,q有一U通用的解x法,卛_可执行文件目录下写qt.conf文gQ把pȝ相关的一些目录配|写到qt.conf文g里,详细情况情参考Qt Document Reference里的qt.conf部分<br><br><br>13、如何创建QT使用的DLL(.so)以及如何使用此DLL(.so)<br>{:创徏DLL时其工程使用lib模板<br> <h6 class=quote>Quote:</h6> <blockquote>TEMPLATE=lib<br></blockquote><br>而源文g则和使用普通的源文件一P注意把头文g和源文g分开Q因为在其它E序使用此DLL旉要此头文?br>在用此DLLӞ则在此工E源文g中引入DLL头文Ӟq在.pro文g中加入下面配|项Q?br> <h6 class=quote>Quote:</h6> <blockquote>LIBS += -Lyourdlllibpath -lyourdlllibname<br></blockquote><br>Windows下和Linux下同PWindows下生成的DLL文g名ؓyourdlllibname.dll而在Linux下生成的为libyourdlllibname.so<br><br>14、如何启动一个外部程?br>{:可用QProcess和QThreadq两个类l合使用的方法来处理Q以防止在主U程中调用而导致阻塞的情况<br>先从QThreadl承一个类Q重新实现run()函数Q?br> <h6 class=quote>Quote:</h6> <blockquote><br>class MyThread : public QThread<br>{<br>public:<br>    void run();<br>};<br><br>void MyThread::run()<br>{<br>    QProcess::execute("notepad.exe");<br>}<br></blockquote><br>q样Q在使用的时候则可定义一个MyThreadcd的成员变量,使用时调用其start()ҎQ?br> <h6 class=quote>Quote:</h6> <blockquote><br>class ...............<br>{...........<br>MyThread thread;<br>............<br>};<br><br>.....................<br>thread.start();<br></blockquote><br><br>15、如何打印报?br>{:Qt目前Ҏ表打印支持的库还很少Q不q有U变通的ҎQ就是用XML+XSLT+XSL-FO来进行报表设计,XML输出数据Q用XSLTXML数据转换为XSL-FO格式的报表,׃现在的浏览器不直接支持XSL-FO格式的显C,所以暂时可用工?Apache FOP, Java做的)XSL-FO转换为PDF文档来进行打华ͼ转换和打印由FOP来做Q生成XSL-FO格式的报表可以由Qt来生成,也可以由其它内容转换q来Q比如有工具(html2fo)HTML转换为XSL-FO?br><br>16、如何在pȝ托盘区显C图?br>{:?.2及其以上版本中用QSystemTrayIconcL实现<br><br>17、怎样日志输出到文g?br>{:Qmyer提供Q?br> <h6 class=quote>Quote:</h6> <blockquote><br>void myMessageOutput( QtMsgType type, const char *msg )<br>{<br>    switch ( type ) {<br>        case QtDebugMsg:<br>            //写入文gQ?br>            break;<br>        case QtWarningMsg:<br>            break;<br>        case QtFatalMsg:<br>            abort();<br>    }<br>}<br><br>int main( int argc, char** argv )<br>{<br>    QApplication app( argc, argv );<br>    qInstallMsgHandler( myMessageOutput );<br>    ......<br>    return app.exec();<br>}<br></blockquote><br>qDebug(), qWarning(), qFatal()分别对应以上三种type?br><br>18、如何将囑փ~译到可执行E序中去<br>{:使用.qrc文g<br>?qrc文gQ例如:<br>res.qrc<br> <h6 class=quote>Quote:</h6> <blockquote><br><!DOCTYPE RCC><RCC version="1.0"><br><qresource><br>    <file>images/copy.png</file><br>    <file>images/cut.png</file><br>    <file>images/new.png</file><br>    <file>images/open.png</file><br>    <file>images/paste.png</file><br>    <file>images/save.png</file><br></qresource><br></RCC><br></blockquote><br>然后?pro中加入下面代码:<br> <h6 class=quote>Quote:</h6> <blockquote><br>RESOURCES    = res.qrc<br></blockquote><br><br>在程序中使用Q?br> <h6 class=quote>Quote:</h6> <blockquote><br>...<br>:images/copy.png<br>...<br></blockquote><br><br>19、如何制作不规则形状的窗体或部g<br>{:请参考下面的帖子<br><a target=_blank><font color=#2f5fa1>http://www.qtcn.org/bbs/read.php?tid=8681</font></a><img src ="http://www.shnenglu.com/cc/aggbug/33041.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cc/" target="_blank">北风之神007</a> 2007-09-27 18:21 <a href="http://www.shnenglu.com/cc/archive/2007/09/27/33041.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>QTd中文文ghttp://www.shnenglu.com/cc/archive/2007/08/25/30824.html北风之神007北风之神007Sat, 25 Aug 2007 12:28:00 GMThttp://www.shnenglu.com/cc/archive/2007/08/25/30824.htmlhttp://www.shnenglu.com/cc/comments/30824.htmlhttp://www.shnenglu.com/cc/archive/2007/08/25/30824.html#Feedback1http://www.shnenglu.com/cc/comments/commentRss/30824.htmlhttp://www.shnenglu.com/cc/services/trackbacks/30824.html   虽然C++标准中有了文件读取的相关c,也很好用Q但是在涉及到QT~程的时候却用v来不方便了,因ؓQT本n很多lg都是兌的自w的QStringcd的字W串Q所以再用C++本nStringcd的时候就不是那么方便了,需要进行{化,q样l程序带来了复杂度,同时也带来了转化的开销Q所以如果用QT开发,可以q它本w所带的q些cdq行处理QŞ成一个系l,便于数据在程序之中的交互和共用?br>   QT很好Q但是在处理中文或者其他语a的时候要注意~码格式Q如果没有注意,d文g的时候可能读出来的就是ؕ码或者干脆程序就L了,q是我们所不愿意看到的Q下面就讲讲怎么样通过QT的类来读取中文文件?/span>

介绍部分
   我们需要用到几个头文g中的c:
#include <qstring.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qtextcodec.h>

QString

QStringcL供了一个Unicode文本和经典的C以零l尾的字W数l的抽象?
QString使用隐含׃nQ这使它非常有效率ƈ且很Ҏ使用?
所有的QString的方法都使用const char *参数Qconst char *被解释ؓl典的C风格的以零结ASCII字符丌Ӏ所以const char *参数?是合法的。如果const char *不是以零l尾的,l果是不定的。把l典的C字符串复制到QString的函数将不会复制l尾?字符。QString的QChar数组Q可以通过unicode()q回Q通常不以零结。如果你需要把QString传递到一个需要C的以零结字符Ԍ请用latin1()?
没有分配M东西的QString是零Q也是长度和数据指针都?。引用空字符Ԍ“”Q一个单一?\0'字符Q的QString是空。零和空q两个QString在方法中都是合法的。把(const char *) 0赋值给QStringl定了一个零QString。ؓ了方便,QString::null是一个零QString。当排序的时候,I字W串在最前面Q然后是非空字符Ԍ然后才是零字W串。我们徏议用if ( !str.isNull() )Q而不是if ( !str )来检非零字W串Q关于解释说明也可以参考operator!()?
注意如果你发C正在混合使用QCString、QString和QByteArrayQ这会D很多不必要的复制q且也许会预C着你正在处理的真实自然数据是不定的。如果数据是以零l尾的八位数据,请用QCStringQ如果它是没有结Q也是包含0Q八位数据,请用QByteArrayQ如果它是文本,请用QString?
字符串列表可以用QStringListcL处理。你可以使用QStringList::split()来把一个字W串分割Z个字W串列表Qƈ且可以用QStringList::join()把一个字W串列表q接成一个用随意间隔符的字W串。你也可以用QStringList::grep()从一个字W串列表中获得包含特定子字符串或者包含匹配特定的regex的字W串列表?
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
QFile

QFilecL一个操作文件的输入/输出讑֤?
QFile是用来读写二q制文g和文本文件的输入/输出讑֤。QFile可以自己单独被用,但是如果和QDataStream或QTextStream一起用将更加方便?
文g名通常可以通过构造函数来传递,但也可以使用setName()来设|。你可以通过exists()来检查一个文件是否存在ƈ且可以通过remove()来移M个文件?
文g可以用open()来打开、用close()来关闭、用flush()来刷新。数据通常可以使用QDataStream或者QTextStreamq行dQ但你也可以使用readBlock()和readLine()来读Q用writeBlock()来写。QFile也支持getch()?ungetch()和putch()?
size()可以q回文g的大。你可以通过使用at()函数得到当前文g位置或者移C个新的文件位|。如果你C文g的末,atEnd()q回真。handle()q回文g句柄?
q里是一个用QTextStream来一行一行地d一个文本文件的代码Dc它会把每一行带上一个行h印出来?

    QStringList lines;
    QFile file( "file.txt" );
    if ( file.open( IO_ReadOnly ) ) {
        QTextStream stream( &file );
        QString line;
        int n = 1;
        while ( !stream.eof() ) {
            line = stream.readLine(); // 不包?#8220;\n”的一行文?br>            printf( "%3d: %s\n", n++, line.latin1() );
            lines += line;
        }
        file.close();
    }
 
写文本也很容易(假设我们有一个行的字W串列表要写Q:

    QFile file( "file.txt" );
    if ( file.open( IO_WriteOnly ) ) {
        QTextStream stream( &file );
        for ( QStringList::Iterator it = lines.begin(); it != lines.end(); ++it )
            stream << *it << "\n";
        file.close();
    }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
QTextStream

QTextStreamcL供了使用QIODeviced文本的基本功能?
文本类的功能界面和标准的C++的iostreamc非常相伹{iostream和QTextStream的不同点是我们的操作在一个很Ҏ被承的QIODevice上,而iostream只能操作一个不能被l承的FILE *指针?
Qt提供了几个和iostream怼的全局函数Q?
bin讄QTextStream来读/写二q制数字
oct讄QTextStream来读/写八q制数字
dec讄QTextStream来读/写十q制数字
hex讄QTextStream来读/写十六进制数?
endl强制换行
flush强制QIODevicehM被缓存的数据
ws作ؓM可用的控制符Q在输入的时候)
reset重新讄QTextStream为它的缺省模式(误reset()Q?
qSetW(int)讄字段宽度作ؓ指定参数
qSetFill(int)讄填充字符作ؓ指定参数
qSetPrecision(int)讄_度作为指定参?
警告Q默认情况下QQTextStream在读取流的时候,会自动地流中的数字是十q制、八q制、十六进制或者二q制格式。具体情冉|Q一个以“0”为开头的数字是八q制的,比如序?#8220;0100”会被解释ؓ64?
QTextStreamc读写文本,它不适合处理二进制数据(而QDataStream是适合的)?
默认情况下,输出的是使用本地8位编码后的Unicode文本Q比如,QStringQ。这些可以用setEncoding()Ҏq行改变。对于输入,QTextStream会自动检标准Unicode“字节序标记?#8221;文本文gQ否则会使用本地8位编码?
QIODevice在构造函C被设|,或者之后在setDevice()中用。如果输入到达了atEnd()Q返回真。数据可以用operator>>()重蝲操作W读到适当cd的变量中Q或者用read()把它作ؓ整个部分d一个单一的字W串中,或者用readLine()把一ơ读一行。用skipWhiteSpace()可以忽略控制W。你可以使用flags()或setf()来设|流的标记。这个流也支持width()、precision()?fill()Q用reset()可以重新恢复默认讄?
也可以参考QDataStream、输?输出和网l和文本相关c?
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

QTextCodec

QTextCodec cL供文本编码之间的转换?br>QT使用Unicode来存储,l制以及操作字符丌Ӏ在很多情况下,你可能想要用不同的~码方式来处理数据。例如大部分的日语文仉被存储在Shift-JIS或?ISO2022的文件中Q而俄|斯的用户常怋用KOI8-R或者CP1251~码方式。QT提供了一个QTextCodec c集合来从Unicode格式转化到相应的格式?/p>

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

代码部分

#include <qstring.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qtextcodec.h>

int main()
{   
 QFile file("test.txt");
 if (file.open(IO_ReadOnly|IO_Raw))
 {
  QTextStream floStream(&file);
  QString line;
  QTextCodec *codec=QTextCodec::codecForName("GBK");
  floStream.setCodec(codec);
 
  while ( floStream.atEnd()==0 )
  {
   line = codec->fromUnicode(floStream.readLine());
   qWarning(line);
  }
  file.close();     
 }
 return 0;
}
代码中的主要改动是黄底的部?br>意思就是创立一个中文GBK~码样式Q然后按照这U方式来把读入的文g进行重新编码,q样中文可以顺利输ZQ不信你可以试一试,哈哈Q先介绍q么多,下次有什么下ơ再写啦?br>



北风之神007 2007-08-25 20:28 发表评论
]]>
VC6.0怎么样用moc~译http://www.shnenglu.com/cc/archive/2007/08/13/29932.html北风之神007北风之神007Mon, 13 Aug 2007 13:32:00 GMThttp://www.shnenglu.com/cc/archive/2007/08/13/29932.htmlhttp://www.shnenglu.com/cc/comments/29932.htmlhttp://www.shnenglu.com/cc/archive/2007/08/13/29932.html#Feedback0http://www.shnenglu.com/cc/comments/commentRss/29932.htmlhttp://www.shnenglu.com/cc/services/trackbacks/29932.html现在在学习QT界面开发,在windows环境下装了vc6和QT3.3.4版本的开发包Q装好之后就可以在VC集成开发环境下产生一个工hq行QT开发了。在学习书上例子的时候,L有些代码中要使用到Q_OBJECT宏,q样才可以用自定义的signalq有slot了,不过试了好多ơ都~译不成功,好像是需要什么moc~译Q真是晕Q书上也没有说这个,那些自带的例子都是可以编译的Q直接用工具栏上面的那个moc也不用Q要是你知道你就告诉我下怎么用?br>
查了下资料,moc是元对象编E?br>
元对象编译器d一个C++源文件。如果它发现其中的一个或多个cȝ声明中含有Q_OBJECT宏,它就会给q个使用Q_OBJECT宏的cȝ成另外一个包含元对象代码的C++源文件。尤其是Q元对象代码对信?槽机制、运行时cd信息和动态属性系l是需要的?
一个被元对象编译器生成的C++源文件必dq个cȝ实现一赯~译和连接(或者它被包含到Q?includeQ这个类的源文g中)?
如果你是用qmake来生成你的Makefile文gQ当需要的时候,~译规则中需要包含调用元对象~译器,所以你不需要直接用元对象~译器?br>
q里提供一U方法:cȝ声明攑֜一个头文gQ?h文gQ中
如果在上q的文gmyclass.h中发现类的声明,元对象编译器的输出文件将会被攑֜一个叫moc_myclass.cpp的文件中。这个文件将会像通常情况一栯~译Q作为对象文件的l果是moc_myclass.oQ在Unix下)或者moc_myclass.objQ在Windows下)。这个对象接着会被包含到一个对象文件列表中Q它们将会在E序的最后连~阶D被q接在一赗?

然后?br>
Q?Q在FileView视图?右键点击需要生MOC文g的头文gQ就是类中包含Q_OBJECT宏,如果没有q个宏就不需要生MOC文gQ?br>
Q?Q在右键菜单中选择Setting...

Q?Q选择Custom BuildQ在Commands栏中输入Q?br>%QTDIR%\bin\moc.exe $(InputDir)\$(InputName).h -o $(InputDir)\moc_$(InputName).cpp

Outputs中输入:
$(InputDir)\moc_$(InputName).cpp

Q?Q然后右键这个头文g~译


(5)最后生成一?moc~译产生的cpp源文?br>

q样~译时就会在当前工程目录中自动生成MOC文g?br>
本文参?qt文档以及http://www.qobject.com/read.php?fid=46&tid=2296&toread=1 的文章?br>
谢谢Q?br>




北风之神007 2007-08-13 21:32 发表评论
]]>
Qt中中文处理的单方?/title><link>http://www.shnenglu.com/cc/archive/2007/07/29/28973.html</link><dc:creator>北风之神007</dc:creator><author>北风之神007</author><pubDate>Sun, 29 Jul 2007 08:39:00 GMT</pubDate><guid>http://www.shnenglu.com/cc/archive/2007/07/29/28973.html</guid><wfw:comment>http://www.shnenglu.com/cc/comments/28973.html</wfw:comment><comments>http://www.shnenglu.com/cc/archive/2007/07/29/28973.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/cc/comments/commentRss/28973.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cc/services/trackbacks/28973.html</trackback:ping><description><![CDATA[<span style="COLOR: #020000">    QT是一套很不错的界面开发库Q而且考虑C跨^台的要求Q用也相对比较Ҏ上手。我也刚刚才学习用QT开发,发现它对中文的处理做的不是很好,或者更贴切的是做的不够吧,如果在字W串中输入中文,昄的就会是q?br><br>    下面׃l一个简单的ҎQ让我们的中文正显C出来,先看一D늨序,该程序主要功能就是显CZ个窗口,H口上面的按钮显CZ文?br><br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="COLOR: #008080"> 1</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">qapplication.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">qpushbutton.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">qfont.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">qvbox.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">qtextcodec.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">qstring.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">qobject.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> argc, </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">**</span><span style="COLOR: #000000">argv)<br></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">    QApplication a(argc,argv);<br></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">    <br></span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000">    QVBox box;<br></span><span style="COLOR: #008080">13</span> <span style="COLOR: #000000">    box.resize(</span><span style="COLOR: #000000">200</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">120</span><span style="COLOR: #000000">);<br></span><span style="COLOR: #008080">14</span> <span style="COLOR: #000000">    QPushButton quit(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">退?/span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">box)</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">15</span> <span style="COLOR: #000000">    quit.setFont( QFont( </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Times</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">18</span><span style="COLOR: #000000">, QFont::Bold ) );</span><span style="COLOR: #008080"></span><span style="COLOR: #000000"></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">16</span> <span style="COLOR: #000000">    QObject::connect(</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">quit,SIGNAL(clicked()),</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">a,SLOT(quit()));<br></span><span style="COLOR: #008080">17</span> <span style="COLOR: #000000">    a.setMainWidget(</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">box);<br></span><span style="COLOR: #008080">18</span> <span style="COLOR: #000000">    box.show();<br></span><span style="COLOR: #008080">19</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> a.exec();<br></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">}<br></span><span style="COLOR: #008080"></span><span style="COLOR: #000000"></span></div> <br><span style="COLOR: #040000">在vc6.0下面~译q行E序之后我们会见到界面如下,但是上面的按钮却是ؕ码了?br><br></span></span> <div style="TEXT-ALIGN: center"><span style="COLOR: #020000"><img height=127 alt="" src="http://www.shnenglu.com/images/cppblog_com/cc/2007_7/lm.png" width=208></span><br><span style="COLOR: #020000"></span></div> <span style="COLOR: #020000"><br style="COLOR: #040000"><span style="COLOR: #040000">那我们该怎么办呢Q别着急,其实Ҏ很简单,主要思\是l应用设定一个字W集Qƈ且把要显C的字符做适当的{化处理就可以了,说v来好像还有些复杂Q但是看看代码你很快明白了?/span><br><br><br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="COLOR: #008080"> 1</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">qapplication.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">qpushbutton.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">qfont.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">qvbox.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">qtextcodec.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">qstring.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">qobject.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> argc, </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">**</span><span style="COLOR: #000000">argv)<br></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">    QApplication a(argc,argv);<br></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000; BACKGROUND-COLOR: yellow">    a.setDefaultCodec(QTextCodec::codecForName(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">GBK</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">));<br></span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000">    QVBox box;<br></span><span style="COLOR: #008080">13</span> <span style="COLOR: #000000">    box.resize(</span><span style="COLOR: #000000">200</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">120</span><span style="COLOR: #000000">);<br></span><span style="COLOR: #008080">14</span> <span style="COLOR: #000000; BACKGROUND-COLOR: yellow">    QPushButton quit(QObject::tr(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">退?/span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">),</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">box);<br></span><span style="COLOR: #008080">15</span> <span style="COLOR: #000000">    quit.setFont( QFont( </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Times</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">18</span><span style="COLOR: #000000">, QFont::Bold ) );<br></span><span style="COLOR: #008080">16</span> <span style="COLOR: #000000">    QObject::connect(</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">quit,SIGNAL(clicked()),</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">a,SLOT(quit()));<br></span><span style="COLOR: #008080">17</span> <span style="COLOR: #000000">    a.setMainWidget(</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">box);<br></span><span style="COLOR: #008080">18</span> <span style="COLOR: #000000">    box.show();<br></span><span style="COLOR: #008080">19</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> a.exec();<br></span><span style="COLOR: #008080">20</span> <span style="COLOR: #000000">}</span></div> <br></span><span style="COLOR: #020000"><br><span style="COLOR: #040000">在vc6.0下面~译q行E序之后我们会见到界面如下,q个时候就昄正常了?/span><br><br></span> <div style="TEXT-ALIGN: center"><span style="COLOR: #020000"><img height=147 alt="" src="http://www.shnenglu.com/images/cppblog_com/cc/2007_7/zc.png" width=208><br><br></span> <div style="TEXT-ALIGN: left">代码分析Q?br>  上面的两D代码基本上是大同小异,没有多大的差别,E序的具体含义这里我不做介绍Q只讲一下两D代码的区别Q见上例中代码的黄色部分Q该部分是Z文显C所做出的改q?br> setDefaultCodec(QTextCodec::codecForName("GBK"));<br>查阅了qt的函数帮助可知,<br>setDefaultCodec的作用如下:<br>void QApplication::setDefaultCodec ( QTextCodec * codec ) <br>讄应用E序的默认编解码器ؓcodec?<br>如果E序中的文字引用文本不是Latin1~码Q这个函数可以用来设|合适的~码。例如,韩国E序员开发的软g在程序中Ҏ有文本可以用eucKRQ这U情况下Qmain()函数可能看v来像q样Q?<br><br>    int main(int argc, char** argv)<br>    {<br>        QApplication app(argc, argv);<br>        ... install any additional codecs ...<br>        app.setDefaultCodec( QTextCodec::codecForName("eucKR") );<br>        ...<br>    }<br>  <br><span style="COLOR: #000000">注意Q这不是用户来选择~码的方式。例如,把一个包含英语字W串的应用程序{换ؓ韩语Q所需要做的一切就是对于所有的p字符串通过tr()传递ƈ且蝲入翻译文件。有兛_际化的详l情况,请参考Qt国际化文档?<br>注意也有一些Qt内置cMؓ不同的字W串调用tr()。这些字W串使用pQ所以对于完整的译Q编解码器将被这些字W串需要?br></span><br><br>QPushButton quit(QObject::tr("退?),&box);<br>tr()函数的说明如下:<br>QString QObject::tr ( const char * sourceText, const char * comment ) const <br>q回sourceText的翻译版本,或者如果没有合适的版本q回sourceText它自己。翻译上下文是comment的QObjectQ默认ؓI)。所有用Q_OBJECT宏的QObject对象有这个函数的重新实现Q把子类名作Z下文?<br>也可以参考trUtf8()、QApplication::translate()和Qt中的国际化?<br>实例Qnetwork/networkprotocol/view.cpp?<br>QString QObject::trUtf8 ( const char * sourceText, const char * comment ) const <br>q回sourceText的翻译版本,或者如果没有合适的版本q回QString::fromUtf8(sourceText)。它是另一Utr(sourceText, comment)?<br>也可以参考tr()和QApplication::translate()?<br><br></div> <div style="TEXT-ALIGN: left"><span style="COLOR: #020000">两个函数的作用一个用来设定字W集一个是用来q行字符串{化,刚好满了前面提到的思\Q事情就是这LQ呵呵,写到这里,希望对你有用?/span><br><span style="COLOR: #020000"></span></div> <span style="COLOR: #020000"></span></div><img src ="http://www.shnenglu.com/cc/aggbug/28973.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cc/" target="_blank">北风之神007</a> 2007-07-29 16:39 <a href="http://www.shnenglu.com/cc/archive/2007/07/29/28973.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>лǵվܻԴȤ</p> <a href="http://www.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.rojie.cn" target="_blank">޾þþһ</a>| <a href="http://www.jianzhuhr.net.cn" target="_blank">ھƷ˾þþþavһ</a>| <a href="http://www.qj119.cn" target="_blank">þõӰһ</a>| <a href="http://www.robuts.com.cn" target="_blank">þۺ˿ձ</a>| <a href="http://www.686t5w.cn" target="_blank">99þۺϹƷ</a>| <a href="http://www.05958.cn" target="_blank">ھƷþþþù</a>| <a href="http://www.girls18.cn" target="_blank">þþƷֻоƷ66</a>| <a href="http://www.omqw.cn" target="_blank">ȾþùþƷ </a>| <a href="http://www.cnmango.cn" target="_blank">ũ帾ŮëƬƷþ</a>| <a href="http://www.bayercas.cn" target="_blank">þùҹAVӰԺ</a>| <a href="http://www.0309999.cn" target="_blank">ҹƷþþþ</a>| <a href="http://www.jfhtgj.cn" target="_blank">ھƷþþþӰԺձ</a>| <a href="http://www.szip8.cn" target="_blank">ھƷ99þ</a>| <a href="http://www.hrwp.net.cn" target="_blank">޹˾ƷŮ˾þþ</a>| <a href="http://www.xibu520.cn" target="_blank">޳ɫwwwþվҹ</a>| <a href="http://www.gbpa.cn" target="_blank">޹Ʒþþþ</a>| <a href="http://www.9xz.com.cn" target="_blank">˾þþƷ鶹</a>| <a href="http://www.58city.cn" target="_blank">ҹҹþ</a>| <a href="http://www.78cbg.cn" target="_blank">þˬ˰</a>| <a href="http://www.zzyes.cn" target="_blank">Ʒһþ</a>| <a href="http://www.ycjtjedu.cn" target="_blank">ۺϾþþƷɫ</a>| <a href="http://www.fanb1688.com.cn" target="_blank">þùƷ</a>| <a href="http://www.jcfw-1.cn" target="_blank">ҹƷþþþ9999</a>| <a href="http://www.czqxj.cn" target="_blank">1000Ʒþþþþþþ</a>| <a href="http://www.gofiv.cn" target="_blank">þþùƵ</a>| <a href="http://www.6105555.cn" target="_blank">þþþAV</a>| <a href="http://www.maichayo.cn" target="_blank">ھƷþù½</a>| <a href="http://www.e8ux.cn" target="_blank">Ʒþþþþù</a>| <a href="http://www.nsom.org.cn" target="_blank">þӰۺ</a>| <a href="http://www.zqyipin.cn" target="_blank">ۺϾƷþ</a>| <a href="http://www.pcb0.cn" target="_blank">ھƷ˾þþþ</a>| <a href="http://www.52maila.cn" target="_blank">޾Ʒһ߾þ</a>| <a href="http://www.licaidazhong.com.cn" target="_blank">þþþƷ޳18վ </a>| <a href="http://www.renshushu.cn" target="_blank">޹ƷþSM</a>| <a href="http://www.funziot.cn" target="_blank">ӰһѾþþþþþþ </a>| <a href="http://www.webfi.cn" target="_blank">99þþƷһѿ </a>| <a href="http://www.zsputian.com.cn" target="_blank">þó˹Ʒ</a>| <a href="http://www.vkgx.cn" target="_blank">žžƷ99þþ㽶</a>| <a href="http://www.lolzk.cn" target="_blank">þþþ޾Ʒ</a>| <a href="http://www.ddvxo.cn" target="_blank">þþþAVۿ</a>| <a href="http://www.xfpz67.cn" target="_blank">˳վ999þþۺ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>