what caused the top line font color seemed so ugly??
-
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"
}, -
Hi,
Please provide a complete minimal reproducer so people can test your issue.
Also:- Which version of Qt ?
- On which platform ?
-
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. -
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.