Qt Creating A Left Arrow Styled Push Button

4.3k views Asked by At

I am creating a Gui application using c++ on Qt Framework.

I have started using Qt a week ago and created a scientific calculator. Now I am creating an application that includes expanding the main window of the application. I have managed to do that. Now I want to use a "Left Arrow" shaped push button. I have searched for ways to do it and now I know that I can do such a thing using the stylesheet of that button, at Qt Designer.

I would be glad if someone could help me with it. It should be a small button that can fit in 40x40 pixels.

I have managed to create a round button but I am not capable of creating a left arrow shaped one. :(

Below is the stylesheet to the round button taken from Lol4t0 from another question.

 background-color: white;
 border-style: solid;
 border-width:1px;
 border-radius:50px;
 border-color: red;
 max-width:100px;
 max-height:100px;
 min-width:100px;
 min-height:100px;
1

There are 1 answers

1
Mohammad Kanan On BEST ANSWER

You could set your push button with standard icons from QStyle::StandardPixmap like:

QCommonStyle style;
ui->pushButton->setIcon(style.standardIcon(QStyle::SP_ArrowBack));