Maya UI: Qtoolbutton Not Active On Creation

I’m making a QT UI for a Maya tool and trying to use QToolButton for the first time. The problem that I’m encountering is that the QToolButton doesn’t seem to inherit any of it’s properties until it’s clicked once so it doesn’t look like an actual button when launching the initial UI.

image

Above you can see two QToolButtons and a QPushButton. The first QTool has a background color, the second is default, and the QPush also just has default settings. The QPush looks like an actual button out of the box, while the QTools don’t. After I click each of the QTools once, my results look like this:

image

The first QTool now inherits its background color, the second QTool gets its default border(my desired goal). Is there something I have to do to force QToolButtons to be “active” without having been clicked at all?

Unfortunately, nothing jumped right out at me with a look at the docs. My initial guess is it has something to do with how you’re parenting, or dealing with layouts. But unless I see the code, I can’t know.
So, unless somebody else comes along and knows what’s going on here, your best course of action is to make a minimal test case. Get rid of everything but those tool buttons, make sure that they’re still misbehaving, package it up in a script, and post it here.

More often than not, the act of making that little UI will reveal the solution to you. But if not, it greatly lowers the barrier for people to help you.

Oh, and if you do figure out the solution. Don’t forget to post it here :slight_smile:

I’m using QT Designer to make the UI so there’s no code. Creating an empty window file and placing a QToolButton in there and simply loading that basic window up in Maya still produces the same results.

Post the UI file it generates? We still might be able to help with that.

It also may depend how you’re loading/displaying the .ui file in your code.