2017-12-09 4 views
0

QPushButton 클래스를 사용하고 있으며 스타일 시트를 설정 한 후 QGraphicsProxyWidget에 개체를 추가하고 있습니다. 그러나 border-radius을 설정하면 background-color이 여전히 테두리와 겹칩니다. 이걸 어떻게 없앨까요?QPushButton 배경색 테두리가 겹치다

예 : (levelOneEasyProxy은 QGrpahicsProxyWidget)

QPushButton* levelOneEasyButton = new QPushButton(); 
levelOneEasyButton->setGeometry(QRect(sceneRect().width()*0.05, sceneRect().height()*0.2, 70, 50)); 
levelOneEasyButton->setText("1"); 
levelOneEasyButton->setStyleSheet("QPushButton {" 
            "background-color: rgb(92, 249, 158);" 
            "color: white;" 
            "font-size: 16px;" 
            "border-style: solid;" 
            "border-width: 2px;" 
            "border-radius: 10px;" 
            "}" 
            "QPushButton:pressed {" 
            "background-color: rgb(66, 191, 118);" 
            "}"); 
levelOneEasyProxy = addWidget(levelOneEasyButton); 
levelOneEasyProxy->setZValue(10.0); 

현재 결과 :

enter image description here

답변

0

내가 위의 코드를 사용하면 border-radius하지만 배경 요구 사항을 설정합니다 것을 발견을 사용하여 translucent으로 설정하십시오. QPushButton의이것은 다음 코드로 수행 할 수 있습니다

qPushButtonObject->setAttribute(Qt::WA_TranslucentBackground); 

이 중복 background-color의 제거 얻을 것이다.