Exemplo n.º 1
0
void MultiPageLayout::setPages(int from, int to)
{
    if( book->pages()->count() == 0 ||  from < 0 || to >= book->pages()->count() )
        return;

    if( from == 0 )
        to = 0;

//    qDebug() << "MultiPageLayout::setPages" << from << to;


    nFirstPage = from;

    if(from == 0)
        emit backwardEnabled(false);
    if(to == book->pages()->count()-2)
        emit forwardEnabled(false);

    // remove and delete any widgets that might be on the layout already
    removeAndDeleteWidget(1,2);
    removeAndDeleteWidget(1,3);
    removeAndDeleteWidget(2,2);
    removeAndDeleteWidget(2,3);

    if(from==to)
    {
        addPage( book->pages()->at(from), from, SinglePage );

    }
    else
    {
        if(bSwapDirection)
        {
            addPage( book->pages()->at(from), from, DoublePageSecond );
            addPage( book->pages()->at(to), to, DoublePageFirst );
        }
        else
        {
            addPage( book->pages()->at(from), from, DoublePageFirst );
            addPage( book->pages()->at(to), to, DoublePageSecond );
        }
    }

    if( from == 0 )
        emit backwardEnabled(false);
    else
        emit backwardEnabled(true);

    if( to == book->pages()->count()-1)
        emit forwardEnabled(false);
    else
        emit forwardEnabled(true);
}
Exemplo n.º 2
0
void HelpWindowWidget::documentChanged()
{
    // A new help document has been selected, resulting in the previous or next
    // help document becoming either available or not

    QAction *action = qobject_cast<QAction *>(sender());

    if (action == pageAction(QWebPage::Back))
        emit backEnabled(action->isEnabled());
    else if (action == pageAction(QWebPage::Forward))
        emit forwardEnabled(action->isEnabled());
}
Exemplo n.º 3
0
void HelpWindowWidget::loadSettings(QSettings *pSettings)
{
    // Let the user know of a few default things about ourselves by emitting a
    // few signals

    emit notHomePage(false);

    emit backEnabled(false);
    emit forwardEnabled(false);

    emit copyTextEnabled(false);

    emitZoomRelatedSignals();

    // Retrieve the zoom level

    setZoomLevel(pSettings->value(SettingsZoomLevel, DefaultZoomLevel).toInt());
}
Exemplo n.º 4
0
void HelpWidget::documentChanged()
{
    // A new help document has been selected, resulting in the previous or next
    // help document becoming either available or not

    QAction *action = qobject_cast<QAction *>(sender());

    if (action) {
        // The QObject casting was successful, so we can carry on

        if (action == pageAction(QWebPage::Back)) {
            // The current action is to tell us whether the previous help
            // document is available, so send a signal to let the user know
            // about it

            emit backEnabled(action->isEnabled());
        } else if (action == pageAction(QWebPage::Forward)) {
            // The current action is to tell us whether the next help document
            // is available, so send a signal to let the user know about it

            emit forwardEnabled(action->isEnabled());
        }
    }
}