void AbstractLogWindow::showEvent(QShowEvent *event){ if(parent()) { QPushButton *p = qFindChild<QPushButton *>(parent(), "m_" + m_WinName + "Button"); if(p != 0) { p->setCheckable(true); p->setChecked(true); } QAction *m = qFindChild<QAction *>(parent(), "m_" + m_WinName + "Menu"); if(m != 0) { m->setCheckable(true); m->setChecked(true); } }}
MainForm::MainForm(QWidget *parent) : QWidget(parent){ m_MenuBar = new QMenuBar(this); //************************************************************************** m_FileMenu = new QMenu(tr("&File")); m_FileMenu->addAction(tr("&New"), this, SLOT(newMenu()), Qt::CTRL + Qt::Key_N); m_FileMenu->addSeparator(); m_FileMenu->addAction(tr("E&xit"), this, SLOT(close()), Qt::CTRL + Qt::Key_X); //************************************************************************** m_WindowMenu = new QMenu(tr("&Windows")); m_AzimuthWindowMenu = m_WindowMenu->addAction(tr("Azimuth map"), this, SLOT(showAzimuthMap())); m_AzimuthWindowMenu->setCheckable(true); m_CalculatorWindowMenu = m_WindowMenu->addAction(tr("Calculator"), this, SLOT(showCalculator())); //************************************************************************** m_MenuBar->addMenu(m_FileMenu); m_MenuBar->addMenu(m_WindowMenu);}
QAction* pact = m_pmnuWindows->addAction("Cascade", m_pws, SLOT(cascade()));
m_WindowMenu = new QMenu(tr("&Windows")); m_CalculatorWindowMenu = m_WindowMenu->addAction(tr("Calculator"), this, SLOT(showCalculator())); m_CalculatorWindowMenu->setObjectName("CalculatorWindowMenu");
void AbstractLogWindow::showEvent(QShowEvent *event){ if(parent()) { QAction *m = parentWidget()->findChild<QAction *>(m_WinName + "Menu"); //QAction *m = qFindChild<QAction *>(parent(), m_WinName + "Menu"); if(m != 0) m->setChecked(true); }}
void AbstractLogWindow::showEvent(QShowEvent *event){ if(parent()) { foreach(const QObject *obj, parent()->children()) { qDebug() << obj; } }}
MainForm::MainForm(QWidget *parent) : QWidget(parent){ m_CalculatorWindowMenu = m_WindowMenu->addAction(tr("Calculator"), this, SLOT(showCalculator())); m_CalculatorWindowMenu->setObjectName("CalculatorWindowMenu");