I think its because you never call ludzikN->setVisible(false). When you show ludzikN, call setVisible(false) on each ludzik_N+1, ludzik_N+2 etc:
switch (liczbaLudzi1)
{
case 1:
ludzik1->setVisible(true); update();
// call setVisible(false) on ludzik2 and ludzik3 here
break;
case 2:
ludzik2->setVisible(true); update();
// same here for ludzik3
break;
case 3:
ludzik3->setVisible(true); update();break;
}
switch (liczbaLudzi1)
{
case 1:
ludzik1->setVisible(true); update();
// call setVisible(false) on ludzik2 and ludzik3 here
break;
case 2:
ludzik2->setVisible(true); update();
// same here for ludzik3
break;
case 3:
ludzik3->setVisible(true); update();break;
}
To copy to clipboard, switch view to plain text mode
Another thing is that you can call "setVisible()" immediately when the liczbaLudzi1 value is changed, paintEvent() should only display the actual widget state, not change it.
Bookmarks