PDA

View Full Version : QToolButton show()&hide() not correct



daiheitan
13th March 2010, 12:02
I have three QToolButtons in a HBoxLayout.The Pointers are Btn1,Btn2,Btn3.
At first,they are all hidden;

void initButtonStates(){
Btn1->hide();
Btn2->hide();
Btn3->hide();
}

And there are following functions:

void showBtnA(){
initButtonStates();
Btn1->show();
}
void showBtnB()....
void showBtnC()....

However,with the following code:

showBtnA();
showBtnB();
showBtnC();

BtnA is always there,and no BtnB&C
But When Using qDebug(),it shows that BtnA is not visible.But it's just there:crying:.
That's really strange.

p.s. each of the Buttons has a Stylesheet to give it a border-image(normal,hover,pressed,etc)

Thanks To any reply and i'm just waiting online.

Lykurg
13th March 2010, 12:44
Sure you use the right pointer in showBtnB and showBtnC? You seen behaviour can only be the result of a wrong pointer use or something else in your code. So provide a little bit more code or make a small compilable demo which illustrate you problem.