i created a test project like this:
connect(ui.btn, SIGNAL(clicked()), this, SLOT(on_btn_clicked()));
connect(ui.btn_2, SIGNAL(clicked()), this, SLOT(on_btn_2_clicked()));
//...
THIS::on_btn_clicked()
{
ui.btn->setEnabled(false);
ui.btn_2->setEnabled(true);
}
THIS::on_btn_2_clicked()
{
ui.btn_2->setEnabled(false);
ui.btn->setEnabled(true);
}
connect(ui.btn, SIGNAL(clicked()), this, SLOT(on_btn_clicked()));
connect(ui.btn_2, SIGNAL(clicked()), this, SLOT(on_btn_2_clicked()));
//...
THIS::on_btn_clicked()
{
ui.btn->setEnabled(false);
ui.btn_2->setEnabled(true);
}
THIS::on_btn_2_clicked()
{
ui.btn_2->setEnabled(false);
ui.btn->setEnabled(true);
}
To copy to clipboard, switch view to plain text mode
and it works well. my connections are more complicated: like this:
//calendar is a QCalendarWidget, currentPageChanged(int, int ) is it's signal, this signal is //often emitted the same time the QPushButton prevMonth and nextMonth is clicked
//currentPageChagned(int,int ) is not triggered by the buttons' clicking
//on_currentPage_changed(int, int) is my slot
void MyWidget::on_currentPage_changed(int, int)
{
prevMonth->setEnabled(false);
nextMonth->setEnabled(true);
}
//calendar is a QCalendarWidget, currentPageChanged(int, int ) is it's signal, this signal is //often emitted the same time the QPushButton prevMonth and nextMonth is clicked
//currentPageChagned(int,int ) is not triggered by the buttons' clicking
//on_currentPage_changed(int, int) is my slot
void MyWidget::on_currentPage_changed(int, int)
{
prevMonth->setEnabled(false);
nextMonth->setEnabled(true);
}
To copy to clipboard, switch view to plain text mode
Bookmarks