|
only see the landlord in reverse reading landlord posted: 2013-10-22 LCD timeShow Qlcdnumber *m_plcdtime = new Qlcdnumber (this); Set to display several numbers M_plcdtime->setdigitcount (19); Set numberFont: Outline, contour prominent,Color isBackground color, Filled, internal filling type, black color, Flat, flat type M_plcdtime->setsegmentstyle (Qlcdnumber::flat); Palette Qpalette Lcdpat = M_plcdtime->palette (); /* Set color, the overall background color color blue, the first of this functionParameters can be set a variety of. such as text, button button text, multiple */ Lcdpat.setcolor (qpalette::normal,qpalette::windowtext,qt::red); Sets the color palette for the current window M_plcdtime->setpalette (LCDPAT); Set Background color M_plcdtime->setstylesheet (" M_plcdtime->display (Qdatetime::currentdatetime (). toString ("Yyyy-mm-dd hh:mm:ss"));
When setting a number color, be aware that the Flat property is selected in the function Setsegmentstyle (Qlcdnumber::flat), otherwise it does not take effect when the number color is set in SetColor () Set the background color directly with the Setstylesheet () function to set it.
Operating effect:
|
Qlcdnumber setting the background color and displaying the number color