Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Problem with text characters not showing with msvc relases



  • When code below get build with msvc 2015 64 then instead of "████▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬" , is displayed ?????????????????????????????????? , problem does not exist with mingw compiler.
    Other regular text like numbers and regular chars is displayed fine.

     // thread info
        QString info;
        info.append(QString::number(TESTER.threadPtrVec.size())+"\n");
        for(int e=0; e<TESTER.threadPtrVec.size(); e++){
            RUNNER * ptr = TESTER.threadPtrVec[e];
    
            double progress = ptr->L_kaugus/data_size;
    
            QString bar;
    
            if(progress<0.5){
            if(progress<0.05){
                bar="▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬";
            }else if(progress<0.1){
                bar="█▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬";
            }else if(progress<0.15){
                bar="██▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬";
            }else if(progress<0.2){
                bar="███▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬";
            }else if(progress<0.25){
                bar="████▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬";
            }else if(progress<0.3){
                bar="█████▬▬▬▬▬▬▬▬▬▬▬▬▬▬";
            }else if(progress<0.35){
                bar="██████▬▬▬▬▬▬▬▬▬▬▬▬▬";
            }else if(progress<0.4){
                bar="███████▬▬▬▬▬▬▬▬▬▬▬▬";
            }else if(progress<0.45){
                bar="████████▬▬▬▬▬▬▬▬▬▬▬";
            }else if(progress<0.5){
                bar="█████████▬▬▬▬▬▬▬▬▬▬";
            }
            }else{
            if(progress<0.55){
                bar="██████████▬▬▬▬▬▬▬▬▬";
            }else if(progress<0.60){
                bar="███████████▬▬▬▬▬▬▬▬";
            }else if(progress<0.65){
                bar="████████████▬▬▬▬▬▬▬";
            }else if(progress<0.70){
                bar="█████████████▬▬▬▬▬▬";
            }else if(progress<0.75){
                bar="██████████████▬▬▬▬▬";
            }else if(progress<0.80){
                bar="███████████████▬▬▬▬";
            }else if(progress<0.85){
                bar="████████████████▬▬▬";
            }else if(progress<0.90){
                bar="█████████████████▬▬";
            }else if(progress<0.95){
                bar="██████████████████▬";
            }else if(progress>0.95){
                bar="██████████████████▌";
            }
            }
    
    
         //  bar=QString::number((int)(progress*100));
    
            double num = ptr->prev_result;
            QString numQ;
            if(num>0){
                numQ=" "+QString::number(num);
            }else{
                numQ=QString::number(num);
            }
    
             info += bar+" "+numQ +"\n";
    
    
        }
    
        ui->tester_info->setText(info); // tester_info is qlabel
    

  • Qt Champions 2019

    Which characters do you use exactly? Unicode?



  • try declaring the string as wide:

    bar=QString::fromWCharArray(L"██████████████████▌");
    

    http://www.joelonsoftware.com/articles/Unicode.html


  • Moderators

    @Q139
    Since you are using plain strings also make sure you did not save your file in some special encoding.

    Does the problem also occur when you specifying the unicode values for the characters directly?



  • bar=QString::fromWCharArray(L"██████████████████▌"); solved the problem.
    Thanks

    File was saved without obfuscations or any encoding.
    On mingw compiler text displayed correct by default .
    Maybe due to some compiler differences or autofix to problem.


Log in to reply