首页 > 编程知识 正文

qt格式化代码,qt数字转字符串

时间:2023-05-06 19:13:29 阅读:164651 作者:2422

参考: https://www.cn blogs.com/LV dongjie/p/4835196.html

效果:

头文件. h中:

/** * @brief The Color class颜色设置*/classcolor { public : conststaticintdefault; //重置颜色设置const static int BOLD; const static int UN_BOLD; //去粗const static int UNDER_LINE; //下降线const static int GLINT; 闪烁静态输入不可见; //反向颜色const static int BOLD_2; 加粗静态整数; //常规const static int UN_UNDER_LINE; //移除下降线的const static int STOP_GLINT; const static int INVERSE_2; //反色conststaticintfore _ ground _ black; //前景,黑色的const static int FORE_GROUND_RED; //前景,红色conststaticintfore _ ground _ green; //前景,绿色conststaticintfore _ ground _ orange; //前景,黄色const static int FORE_GROUND_BLUE; //前景、篮子颜色conststaticintfore _ ground _ purple; //前景,紫色const static int FORE_GROUND_CYAN; //前景,青色conststaticintfore _ ground _ white; //前景,白色conststaticintback _ ground _ black; //背景,黑色const static int BACK_GROUND_RED; //背景,红色conststaticintback _ ground _ green; //背景,绿色conststaticintback _ ground _ orange; //背景,黄色const static int BACK_GROUND_BLUE; //背景、篮色conststaticintback _ ground _ purple; //背景,紫色的const static int BACK_GROUND_CYAN; //背景,青色conststaticintback _ ground _ white; //背景,白色/** * @brief setConsoleColor设置内容颜色* @param codes字体样式code集合{}设置方式传递参数* @param msg信息* @return颜色正在实现. cpp :

constintcolor :3360 default=0; //重置颜色设置const int Color:BOLD=1; //constintcolor :3360 un _ bold=2; //粗constintcolor :3360 under _ line=4; //下降线const int Color:GLINT=5; //constintcolor :3360 inverse=7; //反色constintcolor :3360 bold _2=21; //constintcolor :3360 normal=22; //普通constintcolor :3360 un _ under _ line=24; //下行剪切constintcolor :3360 stop _ glint=25; //停止闪烁constintcolor :3360 inverse _2=27; //反色constintcolor :3360 fore _ ground _ black=30; //前景,黑色的constintcolor :3360 fore _ ground _ red=31; //前景,红色constintcolor :3360 fore _ ground _ green=32; //前景,绿色constintcolor :3360 fore _ ground _ orange=33; //前景,黄色constintcolor :3360 fore _ ground _ blue=34; //前景,篮色constintcolor :3360 fore _ ground _ purple=35; //前景,紫色constintcolor :3360 fore _ ground _ cyan=36; //前景,青色constintcolor :3360 fore _ ground _ white=37; //前景,白色constintcolor :3360 back _ ground _ black=40; //背景,黑色的constintcolor :3360 back _ ground _ red=41; //背景,红色constintcolor :3360 back _ ground _ green=42; //背景,绿色constintcolor :3360 back _ ground _ orange=43; //背景,黄色constintcolor :3360 back _ ground _ blue=44; //背景,篮色constintcolor :3360 back _ ground _ purple=45; //背景,紫色constintcolor :3360 back _ ground _ cyan=46; //背景,青色constintcolor :3360 back _ ground _ white=47; //背景,白色constqstringcolor :3360 setconsolecolor (STD 3360: initializer _ listintcodes,QString msg ) if ) codes.stistif int i=0; for (autocode :代码) if ) I==0) codestr=qstring 3360:编号代码); } else { codeStr=codeStr ';' 字符串:3360编号(代码); (I ); } return '33 [ ' codestr ' m ' msg '33 [ 0m ' ]; }调用方法:

qtringtxtmessage=color :3360 setconsolecolor ({ color : fore _ ground _ orange,color 3:3: back _ ground stecolor q debug (txt消息;

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。