Yaa, sure!
Here, I have pasted the main code.
If you want it in more details then let me know I will drop the complete code.
In QMyToolbar class file.
{
m_action
= addAction
(QIcon(tr
("image.png")),tr
("Start/Stop"));
connect(m_action, SIGNAL(toggled(bool )), this, SIGNAL(workingToggle(bool)));
}
QMyToolbar::QMyToolbar(QWidget *)
{
m_action = addAction(QIcon(tr("image.png")),tr("Start/Stop"));
connect(m_action, SIGNAL(toggled(bool )), this, SIGNAL(workingToggle(bool)));
}
To copy to clipboard, switch view to plain text mode
In MyWidget class file.
QMyToolbar * MyWidget::m_spClockToolbar = NULL;
MyWidget
::MyWidget(QWidget *parent
){
if(m_spClockToolbar == NULL)
{
m_spClockToolbar = new QClockToolBar();
}
connect(m_spClockToolbar, SIGNAL(workingToggle(bool)), this, SLOT(startWork(bool )));
}
QMyToolbar * MyWidget::m_spClockToolbar = NULL;
MyWidget::MyWidget(QWidget *parent)
{
if(m_spClockToolbar == NULL)
{
m_spClockToolbar = new QClockToolBar();
}
connect(m_spClockToolbar, SIGNAL(workingToggle(bool)), this, SLOT(startWork(bool )));
}
To copy to clipboard, switch view to plain text mode
m_spClockToolbar is a static member;
Bookmarks