main form without the title bar, and use a fillet (setMask () method , while the background using a background image ( rounded png)
in a custom label field , in the above text and images embedded using QLabel
36 pixel shift appears after following this effect:
Please note that fields marked left corner area of the white corner
Meanwhile, arranged starting from the back label also has this white corner area
These are implemented using the stylesheet :
title text :
pLabelTitle-> setStyleSheet ("margin-left: 36px;");
Right title text :
pLabelVersion-> setStyleSheet ("QLabel {margin-right: 10px;}");
I ask you:
I do not know how to remove the title bar of the white corners ??
------ Solution ----------------------- ---------------------
that is not the picture of the background Yeah, it should be painted background picture transparent
----- - Solution --------------------------------------------
main Forms set fillets, for the main form of it ?
stylesheet settings if you do not explicitly set , there will be the same as the subform style .
------ Solution ------------------------------------ --------
Sure enough , the background image is attached to the bar with style sheets ? Sub- label to be set independently.
------ Solution ---------------------------------------- ----
pLabelTitle-> setStyleSheet ("margin-left: 36px; background-color: transparent;"); directly add a transparent background to try:
------ eference ---------------------------------- -----
main window paintEvent event generates the main window fillet:
void MainWindow :: paintEvent (QPaintEvent *)
{
/ / generate fillets
/ / generate a map
QBitmap objmap (size ());
/ / Load the brush on top
QPainter painter (& objmap);
/ / fill a rectangle with a white fill
painter.fillRect (rect (), Qt :: white);
/ / black brush
painter.setBrush (QColor (0,0,0));
/ / draw the bitmap rounded rectangle , fill it with black
painter.drawRoundedRect (this-> rect (), 10,10);
/ / filter
this-> setMask (objmap);
}
problem is TitleBar class ,
question left is : QLabel * m_pLabelTitle;
the right question is : QLabel * m_pLabelVersion;
------ eference ----------------------- ----------------
another effect is that I made reference to this post :
http://www.cnblogs.com/appsucc/archive/2012/03/28/2421225.html
------ eference ------------- --------------------------
Sure enough , the background image is attached to the bar with style sheets ? Sub- label to be set independently.
these also set which ? set what style ?
title text :
pLabelTitle-> setStyleSheet ("margin-left: 36px;");
Right title text :
pLabelVersion-> setStyleSheet ("QLabel {margin-right: 10px;}");
title bar :
TitleBar * m_pTitleBar ( inherit QWidget)
------ eference -------------------------- -------------
test has no effect
If the margin-left set to 0 , looks normal ,
But right QLabel * m_pLabelVersion not remove
------ eference ---------------------- -----------------
idea is this, but found elsewhere with background: transparent; to meet the requirements of the
------ eference --------------- ------------------------
your main window's background is how set ? used to set the style sheet or directly setPixmap?
没有评论:
发表评论