[Interest] Custom QPushButton

William Hallatt goblincoding at gmail.com
Fri Nov 22 06:32:35 CET 2013


Hi Graham,

I'm pretty sure you should be able to do that by setting the correct values
in QPushButton:pressed, e.g.

QPushButton:pressed
{
  color: rgb(150, 150, 150);
  background-color: rgb(150, 150, 150);
  border-style: none;
}

http://qt-project.org/doc/qt-4.8/stylesheet-reference.html

http://qt-project.org/doc/qt-4.8/stylesheet-reference.html#border-style

If this doesn't work, I'm afraid I'm stumped...





On 21 November 2013 19:11, Graham Labdon
<Graham.Labdon at avalonsciences.com>wrote:

>  Hi William
>
> Thanks for that
>
> Say I have a push button for which I have set an icon and set the text to
> an empty string.
>
> When this is displayed all I see is the Icon, which is what I want.
>
> However when the button is clicked the rectangular background for the
> button is displayed in the background color.
>
> Any idea how I can stop this happening
>
>
>
> Thanks
>
>
>
> *From:* williamhallatt at gmail.com [mailto:williamhallatt at gmail.com] *On
> Behalf Of *William Hallatt
> *Sent:* 21 November 2013 17:00
> *To:* Graham Labdon
> *Cc:* interest at qt-project.org
> *Subject:* Re: [Interest] Custom QPushButton
>
>
>
> Hi Graham,
>
> If I remember correctly, you should be able to do that with stylesheets
> also, e.g if you don't want the button to change, ever, you could do
> something like this:
>
> QPushButton
> {
>
> // content is the same as all the others
>
> }
>
> QPushButton:hover
> {
> // content is the same as all the others
> }
>
> QPushButton:pressed
> {
> // content is the same as all the others
> }
>
> QPushButton:default
> {
> // content is the same as all the others
> }
>
> QPushButton:disabled
> {
> // content is the same as all the others
> }
>
> Hope that makes sense.
>
> William.
>
>
>
> On 21 November 2013 18:49, Graham Labdon <Graham.Labdon at avalonsciences.com>
> wrote:
>
> Hi
>
> How can I stop the appearance of a QPushButton changing when it is hovered
> over or pressed.
>
> I know how to change the background colour for these events by setting the
> appropriate stylesheet, but cannot see how I can stop them changing at all.
>
> I would appreciate some help in getting this working
>
>
>
> Thanks
>
>
>
>
>
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131122/3403b76b/attachment.html>


More information about the Interest mailing list