Exemple #1
0
void WWidgetStack::addWidgetWithControl(QWidget* pWidget, ControlObject* pControl) {
    int index = addWidget(pWidget);
    if (pControl) {
        WidgetStackControlListener* pListener = new WidgetStackControlListener(
            this, pControl, index);
        connect(pListener, SIGNAL(switchToWidget()),
                &m_mapper, SLOT(map()));
        connect(this, SIGNAL(currentChanged(int)),
                pListener, SLOT(onCurrentWidgetChanged(int)));
        m_mapper.setMapping(pListener, index);
        pListener->onCurrentWidgetChanged(currentIndex());
    }
}
Exemple #2
0
void WWidgetStack::addWidgetWithControl(QWidget* pWidget, ControlObject* pControl) {
    int index = addWidget(pWidget);
    if (pControl) {
        WidgetStackControlListener* pListener = new WidgetStackControlListener(
            this, pControl, index);
        m_showMapper.setMapping(pListener, index);
        m_hideMapper.setMapping(pListener, index);
        if (pControl->get() > 0) {
            setCurrentIndex(count()-1);
        }
        pListener->onCurrentWidgetChanged(currentIndex());
        connect(pListener, SIGNAL(switchToWidget()),
                &m_showMapper, SLOT(map()));
        connect(pListener, SIGNAL(hideWidget()),
                &m_hideMapper, SLOT(map()));
        connect(this, SIGNAL(currentChanged(int)),
                pListener, SLOT(onCurrentWidgetChanged(int)));
    }

    if (m_currentPageControl.get() == index) {
        setCurrentIndex(index);
    }
}