bibhukalyana
23rd September 2014, 14:13
Hi everyone,
I am trying to remove the dotted line during focus for QPushButton.
QPushButton:focus {outline: 0;}
This is not working(qt 4.7, windows).
Can anybody help me ?
Thanks.
bibhukalyana
24th September 2014, 06:50
Ok fine. I got it.
Instead of stylesheet I am using style.
Check here (https://stackoverflow.com/questions/9795791/removing-dotted-border-without-setting-nofocus-in-windows-pyqt/10021345#10021345?newreg=eb18f6cff2c14a1abe520d171 7940d23&newUserTooltips=true).
class NoFocusProxyStyle : public QProxyStyle
{
public:
NoFocusProxyStyle(QStyle *baseStyle = 0) : QProxyStyle(baseStyle)
{
}
void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
QPainter *painter, const QWidget *widget) const
{
if(element == QStyle::PE_FrameFocusRect)
{
return;
}
QProxyStyle::drawPrimitive(element,option,painter, widget);
}
};
[code]
pushButton->setStyle(new NoFocusProxyStyle());
[/code
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.