Beispiel #1
0
EXPORT void saveToolbar(QToolBar *bar, Data state[8])
{
    memset(state, 0, sizeof(state));
    if (bar == NULL)
        return;
    QMainWindow *main = NULL;
    for (QWidget *w = bar->parentWidget(); w; w = w->parentWidget()){
        if (w->inherits("QMainWindow")){
            main = static_cast<QMainWindow*>(w);
            break;
        }
    }
    if (main == NULL)
        return;
    QMainWindow::ToolBarDock dock;
    int  index;
    bool nl;
    int  extraOffset;
    main->getLocation(bar, dock, index, nl, extraOffset);
    state[0].value = 1;
    state[1].value = (long)dock;
    state[2].value = index;
    state[3].value = nl ? 1 : 0;
    state[4].value = extraOffset;
    if (dock == QMainWindow::TornOff){
        QPoint pos = bar->geometry().topLeft();
        state[5].value = pos.x();
        state[6].value = pos.y();
    }
}