Home > Mobile >  On style single color loaded questions
On style single color loaded questions

Time:04-21

You, could you tell me why QLineEdit setStyleSheet in the style sheet set after the color of color, the clues will be a lot lighter than the actual? Is there a way to make it according to the original color?

QLineEdit * m_editFirst=new QLineEdit (this);
M_editFirst - & gt; SetStyleSheet (" QLineEdit {background: transparent; Border - image: url (/res/lineEditBkg. PNG); Border - style: solid; Color: # 003 da6; Padding - left: + 8 px; Border - color: # 232423; The font, "" SimHei" "; The font - size: 11 px; } ");
The following screenshots:

Screenshots of the clues of the color in the color than the actual QLineEdit stylesheets: # 003 da6 this color light a lot, is there a way to let it show the original colors?

CodePudding user response:

Color is set to type when the color of the display, Qt default placeholder color is added to the color of 128 alpha transparency
From the stylesheet document look like no place to set PlaceholderText
You really want to set with QPalette (see QPalette document 5.12 previous versions or a death, can be set after 5.12)

CodePudding user response:

reference 1st floor mideum response:
color is set to type when the color of the display, Qt default placeholder color is added to the color of 128 alpha transparency
From the stylesheet document look like no place to set PlaceholderText
You really should set with QPalette (see QPalette document 5.12 previous versions or a death, can be set after 5.12)

Ok, I'll give it a try, thank you for your advice.

CodePudding user response:

reference 1st floor mideum response:
color is set to type when the color of the display, Qt default placeholder color is added to the color of 128 alpha transparency
From the stylesheet document look like no place to set PlaceholderText
You really should set with QPalette (see QPalette document 5.12 previous versions or a death, can be set after 5.12)

Just tried QPalette
QBrush myBrush;
QPalette the palette.
MyBrush=QBrush (QColor (0, 61, 166, 120), Qt: : SolidPattern);
The palette. SetBrush (QPalette: : ToolTipText, myBrush);
M_editFirst - & gt; SetPalette (palette);
But the effect is still the same, or very thank you for your answer,

CodePudding user response:

Do you use after 5.12 version, is not ToolTipText PlaceholderText
In addition the palette with stylesheet color may have a conflict, as far as possible in a single
And at the time of initial preferably QPalette palette=m_editFirst - & gt; The palette () to get the original of the palette and then set up

CodePudding user response:

reference 5 floor mideum reply:
do you use any later version 5.12, is not ToolTipText PlaceholderText
In addition the palette with stylesheet color may have a conflict, as far as possible in a single
And at the time of initial preferably QPalette palette=m_editFirst - & gt; The palette () to get the original of the palette and then set the

I am using 5.14.1, PlaceholderText this is used for displaying the clues, isn't it? I, when I was in use the palette this will remove the stylesheet color,
Ok, I try again, thank you for your advice,
  •  Tags:  
  • Qt
  • Related