分类目录归档:未分类

在Qt中绘制字符串,哪种效率最高

一共提供了三种绘制方式:

》基于QPoint的绘制
》基于QRectangle的绘制
》基于QStaticText的绘制
》基于QTextLayout的绘制

从下图的执行堆栈可见,除QPoint方式外,其它方式均会转化来QTextLine进行绘制,在转化之前,均会检查换行符、Tab符、边界等的检查及格式化。

腾迅Docker加速

因为docker版本比较旧,故需要加入新的源:
第一步:yum-config-manager --add-repo   http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

第二步:yum install docker-ce -y

[root@VM-24-8-centos ~]# cat /etc/docker/daemon.json
{
    "registry-mirrors": [
        "https://mirror.ccs.tencentyun.com"
    ]
}

CMake的64脚本编译

call “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat” amd64
call “E:\Qt\Qt5.12.12\5.12.12\msvc2017_64\bin\qtenv2.bat”

set path_script=%~dp0

cd /D %path_script%
rd /s/q “%path_script%\build”
rd /s/q “%path_script%\winx”

md “%path_script%\build”
cd /D “%path_script%\build”

cmake -G “Visual Studio 15 2017″ -A x64 -DCMAKE_DEBUG_POSTFIX=”d” -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=%path_script%/winx ../qmqtt-1.0.2
cmake –build . –config Debug && cmake –build ./ –config Debug –target install
cmake –build . –config Release && cmake –build ./ –config Release –target install

真彩色测试

awk 'BEGIN{
    s="/\\/\\/\\/\\/\\"; s=s s s s s s s s;
    for (colnum = 0; colnum<77; colnum++) {
        r = 255-(colnum*255/76);
        g = (colnum*510/76);
        b = (colnum*255/76);
        if (g>255) g = 510-g;
        printf "\033[48;2;%d;%d;%dm", r,g,b;
        printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
        printf "%s\033[0m", substr(s,colnum+1,1);
    }
    printf "\n";
}'

==========================
#!/bin/bash
# Based on: https://gist.github.com/XVilka/8346728 and https://unix.stackexchange.com/a/404415/395213

awk -v term_cols="${width:-$(tput cols || echo 80)}" -v term_lines="${height:-1}" 'BEGIN{
    s="/\\";
    total_cols=term_cols*term_lines;
    for (colnum = 0; colnum<total_cols; colnum++) {
        r = 255-(colnum*255/total_cols);
        g = (colnum*510/total_cols);
        b = (colnum*255/total_cols);
        if (g>255) g = 510-g;
        printf "\033[48;2;%d;%d;%dm", r,g,b;
        printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
        printf "%s\033[0m", substr(s,colnum%2+1,1);
        if (colnum%term_cols==term_cols) printf "\n";
    }
    printf "\n";
}'