QPushButton 问题
我正在使用以下代码来创建按钮。它运行良好。但我在左上角看到了黄色矩形。为什么?请帮我。提前致谢,
backButton = new QPushButton(tr("Back"));
connect(backButton, SIGNAL(clicked()), this, SLOT(showSearchResultPage()));
backButton->setStyleSheet(
"background-image: url(/Users/aspire/IPhone Development/background_wood_Default.png);"
"border-style: outset;"
"border-width: 2px;"
"border-radius: 10px;"
"border-color: beige;"
"font: bold 16px;"
"color:black;"
"min-width: 10em;"
"min-height: 0.75em;"
" margin: 0 1px 0 1px;"
"color:rgb(255,246,143);"
"padding: 6px;"
);
QGridLayout *layout = new QGridLayout();
layout->addWidget(backButton, 1, 0, 1, 1);
layout->addWidget(detailView, 2, 0, 1, 1);
I am using the following code for create a button. It is working fine. but I got the yellow rectangle at the left corner. Why? Please help me. Thanks in advance,
backButton = new QPushButton(tr("Back"));
connect(backButton, SIGNAL(clicked()), this, SLOT(showSearchResultPage()));
backButton->setStyleSheet(
"background-image: url(/Users/aspire/IPhone Development/background_wood_Default.png);"
"border-style: outset;"
"border-width: 2px;"
"border-radius: 10px;"
"border-color: beige;"
"font: bold 16px;"
"color:black;"
"min-width: 10em;"
"min-height: 0.75em;"
" margin: 0 1px 0 1px;"
"color:rgb(255,246,143);"
"padding: 6px;"
);
QGridLayout *layout = new QGridLayout();
layout->addWidget(backButton, 1, 0, 1, 1);
layout->addWidget(detailView, 2, 0, 1, 1);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相当确定问题不在您发布的代码中(除非,正如 cjhuitt 提到的那样,问题出在背景图像中)。我从谷歌上抓取了一个简单的背景 png 并尝试了以下 python:
它生成的按钮没有您在那里显示的奇怪的小黄色框。
I'm fairly sure the problem is not in the code you posted (unless, as cjhuitt mentions, it's in the background image). I snagged a simple background png off of google and tried the following python:
It produces the button without the odd little yellow box you're showing there.