I am facing an issue where I need to create different styles for QPushButton. For instance, I have two QPushButtons:
QPushButton *next;
QPushButton *prev;
I want the "next" button to have a green background and the "prev" button to have a blue background. So, I added the following code in my .qss file:
//.qss file
QPushButton:nth-child(1)
{
background-color: green;
}
QPushButton:nth-child(2)
{
background-color: blue;
}
However, when I compile it, all elements of QPushButtons end up being green. Is there a way to make each button have its own unique color?
This is just a basic example illustrating my problem.