查看完整版本: [-- 【已解决】发贴时怎样贴代码? --]

QTCN开发网 -> 网站管理 -> 【已解决】发贴时怎样贴代码? [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

alexltr 2011-03-14 20:51

【已解决】发贴时怎样贴代码?

发贴时怎样才能像下图一样贴代码?有【复制代码】及框起来的带行号的代码方块。
我发现很多人发的代码都是一连串的。 别人根本看不懂.
请会的人指点一下。 谢谢。


XChinux 2011-03-14 22:23
quote your code with "[ code ] .....[ /code ]"



  1. #include <iostream>
    int main(int argc, char **argv)
    {
        std::cout << "Hello word" << std::endl;
        return 0;
    }


alexltr 2011-03-14 22:36
试一下。果然O了。


  1. int main(int argc,char *argv[])
    {
    QApplication app(argc,argv);

    QTextCodec::setCodecForLocale(QTextCodec::codecForName("GBK"));
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GBK"));
    QTextCodec::setCodecForTr(QTextCodec::codecForName("GBK"));
    QApplication::setFont(QFont("SimSun", 10));
    QApplication::addLibraryPath("../plugins");

alexltr 2011-03-14 22:38
Thanks.

wxj120bw 2011-03-14 22:49
  1. struct header {
        int time;
        short msec;
        short len;
        char chan;
        char reserv;
    } __attribute__((packed));

路过 尝试下 望楼主别介意

alexltr 2011-03-14 23:08
这样好看多了。希望大家都这样发发发!!!

引子 2011-03-15 02:51
[ code ]qDebug()<<files.last();


    playerMediaObject->setCurrentSource(Phonon::MediaSource(files.last()));

    startAction->setEnabled(true);
    stopAction->setEnabled(true);
    pauseAction->setEnabled(true);[ /code ]

ppdayz 2011-03-15 12:33

  1. struct header {
        int time;
        short msec;
        short len;
        char chan;
        char reserv;
    } __attribute__((packed));

路过试试~~~

morriszy 2011-03-16 20:21

  1. struct header {
        int time;
        short msec;
        short len;
        char chan;
        char reserv;
    } __attribute__((packed));

复制的还不行,非要手动key  
  1. .....


三万英尺 2011-03-17 14:50
quote your code with "[ code ] .....[ /code ]"
试下
[code]#include <>
          int main(int argc,char *argv[])
{
QApplication app(argc,argv);
app.exec();
}




三万英尺 2011-03-17 14:51

quote your code with "[ code ] .....[ /code ]"
试下
  1. #include <>
              int main(int argc,char *argv[])
    {
    QApplication app(argc,argv);
    app.exec();
    }

一直往南方开 2021-06-15 14:43
我也试一试
"[ code ]
#include "Viewer.h"
#include <QtWidgets/QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Viewer w;
    w.show();
    return a.exec();
}
[ /code ]"

一直往南方开 2021-06-15 14:45
上面失败了
[ code ]
#include "Viewer.h"
#include <QtWidgets/QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Viewer w;
    w.show();
    return a.exec();
}
[ /code ]


查看完整版本: [-- 【已解决】发贴时怎样贴代码? --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled