Home > Mobile >  Questions about QLabel icon on the left is a dot
Questions about QLabel icon on the left is a dot

Time:04-23

Everybody, excuse me if QLabel left is dot, how to make dots centered relative to the words on the right side?
The code is as follows:
M_labelTip1=new QLabel (" do not... ", this);
M_labelTip1 - & gt; SetAlignment (Qt: : AlignLeft);
M_labelTip1 - & gt; SetStyleSheet QLabel (" {background - image: url (:/res/sets/point. The PNG);"
Background - position: top left; ""
Background - origin: content; ""
Background - repeat: no - repeat; ""
"Border - the radius: 0 px; border:none; Color: # 003 da6; The font: 14 px "" SimHei" "; } ");
Screenshots are as follows:

CodePudding user response:

Two ways, one is in two label, put a dot to put a word; The second is overloaded QWidget, painting herself on the paintEvent dot and text

CodePudding user response:

reference 1/f, mango black response:
two ways, one is in two label, put a dot to put a word; The second is overloaded QWidget, dot and text in a paintEvent himself drew

Thank you for your bosses to give directions, I'll give it a try,

CodePudding user response:


Add
SetAlignment (Qt: : AlignVCenter); At the same time guarantee the origin in the PNG image itself in the middle of the picture,
Or the setText (QString (" low "). Append (STR));

Demand is not high, not have to be a point, you can also use the QSS linear gradient at the same time, set the Label padding - left and border - the top - left - radius border - top - right - the radius,

It is better to paint again

CodePudding user response:

According to the above, a common dot, completely can be done with character, simple and convenient, unicode has a heap of emoj, see if there are any suitable pattern
  •  Tags:  
  • Qt
  • Related