I'm working on button properties similar to Start/Pause & Stop.
The scenario is like this:
1. Two Buttons: Start/Pause & Stop which is related to a process
2. On click of play, pause icon is shown and Stop button is enabled.
3. On click of pause, start icon is shown, and stop button is enabled.
4. I get one signal from other process - start: pause icon is shown & stop button should be enabled.
My button properties are like this
m_pbScan
->setIcon
(QIcon(":/imgs/scanStart.png"));
m_pbScan->setCheckable(true);
connect(m_pbScan, SIGNAL(clicked(bool)), this, SLOT(onScanBtnClicked(bool)));
// SLOT:
void CStatusPage::onScanBtnClicked(bool click)
{
qDebug() << click;
if(click)
{
emit scanBtnClicked();
m_pbScan
->setIcon
(QIcon(":/imgs/scanPause.png"));
}
else
{
m_pbScan
->setIcon
(QIcon(":/imgs/scanStart.png"));
emit pauseBtnClicked();
}
m_pbScanStop->setEnabled(true);
}
m_pbScan = new QPushButton(this);
m_pbScan->setIcon(QIcon(":/imgs/scanStart.png"));
m_pbScan->setCheckable(true);
connect(m_pbScan, SIGNAL(clicked(bool)), this, SLOT(onScanBtnClicked(bool)));
// SLOT:
void CStatusPage::onScanBtnClicked(bool click)
{
qDebug() << click;
if(click)
{
emit scanBtnClicked();
m_pbScan->setIcon(QIcon(":/imgs/scanPause.png"));
}
else
{
m_pbScan->setIcon(QIcon(":/imgs/scanStart.png"));
emit pauseBtnClicked();
}
m_pbScanStop->setEnabled(true);
}
To copy to clipboard, switch view to plain text mode
When I get a signal from some other event promptin for start, then I'm calling this function -
void CStatusPage::scanOn()
{
m_pbScan->setChecked(true);
}
void CStatusPage::scanOn()
{
m_pbScan->setChecked(true);
}
To copy to clipboard, switch view to plain text mode
My doubt is, will the setChecked(true); automatically invoke connect and set icon to pauseIcon?
I trying to implement a logic that works with above mentioned scenarios.
Thank you.
Bookmarks