[Qt-interest] Qt example borderlayout, access to widgets from different panels does not work

S. Aguinaga sa_jr at yahoo.com
Wed Jan 20 06:53:36 CET 2010


In the mature example: 
layouts/borderlayout/borderlayout.pro

I have a widget on the 'North' panel of my layout, and want to access it in the central layout, but 
it fails to read the accurate 'state' of the my widget: pushbutton->setCheckable(true);

When read from a Slot in the Central widget (or Panel) it reads that status (isChecked()) is 'false' wen the 
button has been toggled to the 'down' position.

The code to access the status of the push button is:


northCtrlsButtons = new NorthControlsWidget(this);
qDebug() << "Patient Mic pusbutton: " << northCtrlsButtons->patientMic_PB->isChecked();
qDebug() << "Patient Mic pusbutton: " << northCtrlsButtons->patientMic_PB->isDown();

Am I doing this the wrong way?  Has anyone used this successfully?

-+--+--+--+--+--+--+--+--+--+--+--+

from the NorthControlsWidget class definition:

patientMic_PB= new QPushButton(tr("Patient Mic"), this);
patientMic_PB->setCheckable( true );

...
connect( patientMic_PB, SIGNAL(toggled(bool)), this, SLOT( ctrlButtonPressed()  ));
// have also used the signal 'clicked()' with same effect
}
void NorthControlsWidget::ctrlButtonPressed()
{
qDebug() << "Patient Mic pusbutton: " << patientMic_PB->isChecked();
}

The above slot which is still defined in the same file it does read the correct status.

Qt system running on Mac OS, Using Qt version 4.6.0

// Salvador 


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100119/e6da7018/attachment.html 


More information about the Qt-interest-old mailing list