QGroupBox设置边框

一、setStyleSheet

QGroupBox {
    border-width:1px;   //线的粗细
   border-style:solid;
  border-color:lightGray;   //颜色,
  margin-top: 0.5ex;  //文字在方框中位置的偏离度
}
QGroupBox::title {
     subcontrol-origin: margin;
     subcontrol-position: top left;
   left:25px;       //线的偏离度
     margin-left: 0px;
     padding:0 1px;   //文字在方框中位置的偏离度
}
QGroupBox::title {
     subcontrol-origin: margin;
     position: relative;
     left: 12px;
}
ui->groupBox->setStyleSheet("background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E0E0E0, stop: 1 #FFFFFF);"
                                " border-radius: 5px; margin-top: 1ex; ");//border: 2px solid gray;

 

posted @ 2013-05-10 21:16  wiessharling  阅读(4244)  评论(0编辑  收藏  举报