2

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;
Mohammad Kanan
  • 4,452
  • 10
  • 23
  • 47
BUY
  • 705
  • 1
  • 11
  • 30

1 Answers1

3

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

QCommonStyle style;
ui->pushButton->setIcon(style.standardIcon(QStyle::SP_ArrowBack));
Mohammad Kanan
  • 4,452
  • 10
  • 23
  • 47
  • Thank you so much for your help. I could managed to create my arrow shaped button but you have shown me another way at doing this. It worked and now I know how to set icons too. – BUY May 21 '18 at 20:20