Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. what caused the top line font color seemed so ugly??
Forum Updated to NodeBB v4.3 + New Features

what caused the top line font color seemed so ugly??

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 72 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • nicker playerN Offline
    nicker playerN Offline
    nicker player
    wrote last edited by nicker player
    #1

    e912c591-d65e-4a41-8800-03d803b22d7c-image.png
    the top line of the image above what looks like there's a double shadow.I just set the widgetitem by using the setFontForecolor.heres the codes.so how to make it to looks normally?

    QWidgetItem * obj =  new QWidgetItem();
    QString t_fontfamily; 
    int t_fontsize;
    QString t_fontcolor;
    int t_fontbold;
    
    QString t_fontstyle; 
    QFont t_font;
    
    if(t_style.contains("font-family")){
            t_fontfamily = t_style.find("font-family").value().toString();
            t_font.setFamily(t_fontfamily);
        }
        if(t_style.contains("font-size")){
            t_fontsize = t_style.find("font-size").value().toInt();
            t_font.setPixelSize(t_fontsize);
        }
        if(t_style.contains("font-bold")){
            t_fontbold = t_style.find("font-bold").value().toInt();
            if(t_fontbold==1)t_font.setBold(true);
    }
    
    if(t_style.contains("font-family") || t_style.contains("font-size")){
            obj->setFont(t_font);
    }
    
    if(t_style.contains("font-color")){
            t_fontcolor = t_style.find("font-color").value().toString();
            QColor t_color = toColor(t_fontcolor);
            obj->setForeground(QBrush(t_color));
    }
     
    if(t_style.contains("background-color")){
            QString t_backgroundcolor = t_style.find("background-color").value().toString();
            QColor t_color = toColor(t_backgroundcolor);
            obj->setBackground(QBrush(t_color));
    }
    

    It happend when the item was selected by the user.
    I just set the defaultstyle and looks not very good.
    "DefaultStyle":{
    "font-size":12,
    "font-bold":0,
    "font-color":"#484848"
    },
    "BoldStyle":{
    "font-size":12,
    "font-bold":1,
    "font-color":"#2D2D2D"
    },

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote last edited by
      #2

      Hi,

      Please provide a complete minimal reproducer so people can test your issue.
      Also:

      • Which version of Qt ?
      • On which platform ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • nicker playerN Offline
        nicker playerN Offline
        nicker player
        wrote last edited by
        #3

        the version is 5.14.1 msvc and on the windows 11,the high dpi was enabled.
        and by the the top line what looks like only happened when it was repained by the ui thread.
        for example ,when i resize the ui interface or minimum then maxmum the dialog.

        1 Reply Last reply
        0
        • Axel SpoerlA Offline
          Axel SpoerlA Offline
          Axel Spoerl
          Moderators
          wrote last edited by Axel Spoerl
          #4

          I am sorry to say, but you haven’t responded to @SGaist: please provide a minimal compilable reproducer.
          I am also sorry to say that I do not understand anything in your reply. If you use translating software, that may be the reason.

          The code you posted is neither formatted correctly, nor enough to compile. Also Qt 5.14 has been EOL for a long time.

          Software Engineer
          The Qt Company, Oslo

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved