deciduoustiger
deciduoustiger

Reputation: 45

How to make circle-shaped button in Qt Creator

I'm creating a gui in Qt Creator in ubuntu, and I have a big rectangular button that I'm trying to turn into a circle or oval. It won't let me edit the code in edit mode, I can only change how it looks in design mode I think, which isn't helping me. How do I do this?

Upvotes: 4

Views: 5091

Answers (1)

Bigwave
Bigwave

Reputation: 2206

The look of buttons (and other widgets) is controlled by "style sheets".

I don't have Qt creator in front of me at the moment, but if you select the button in the designer and look at the properties there is something there that opens a dialog that let's you enter "css" to control the look of the button.

After looking at QtCreator, the property to edit is called "styleSheet".

Example:

QPushButton {
  border-color: rgb(66, 69, 183);
  border-width: 3px;        
  border-style: solid;
  border-radius: 40px;
  margin:30px;
  padding:30px;
}

Gives

enter image description here

Upvotes: 6

Related Questions