我试图将当前小部件的边角圆化,但它不起作用,为什么?
PopupWindow::PopupWindow() : QWidget(0) {
setWindowFlags(
Qt::Tool |
Qt::FramelessWindowHint |
Qt::WindowSystemMenuHint |
Qt::WindowStaysOnTopHint
);
this->resize(300, 100);
setStyleSheet(".PopupWindow {border-style: outset;border-width: 10px;border-radius:10px;}");
QPushButton *hello = new QPushButton("Hello world!");
hello->setFont(QFont("Times", 18, QFont::Bold));
hello->setGeometry(10, 40, 180, 40);
hello->setStyleSheet("");
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(hello);
setLayout(layout);
}
最佳答案
QWidget 不支持
border-radius
(border-style
和 border-width
支持)。查看the documentation .不同的小部件支持不同的 CSS 属性子集。
关于c++ - 我怎样才能圆一个 QWidgets 的角落?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9370517/