예제 #1
0
/**
 * Called when the user activates (highlights) a layer.
 */
void QG_LayerWidget::slotActivated(QModelIndex layerIdx /*const QString& layerName*/) {
    if (!layerIdx.isValid() || layerList==NULL) {
        return;
    }

    RS_Layer * lay = layerModel->getLayer( layerIdx.row() );
    if (lay == 0)
        return;

    if (layerIdx.column() == QG_LayerModel::NAME) {
        lastLayer = layerList->getActive();
        layerList->activate(lay);
        lastLayer = layerList->getActive();
        layerList->activate(lay, true);
        return;
    }

    RS_Layer* l = layerList->getActive();
    layerList->activate(lay, true);
    switch(layerIdx.column()){
    case QG_LayerModel::VISIBLE:
        actionHandler->slotLayersToggleView();
        break;
    case QG_LayerModel::LOCKED:
        actionHandler->slotLayersToggleLock();
        break;
    case QG_LayerModel::ConstructionLayer:
        actionHandler->slotLayersTogglePrint();
        break;
    default:
        activateLayer(l);
        return;
    }
    activateLayer(l, false);
}
예제 #2
0
/**
 * Updates the layer box from the layers in the graphic.
 */
void QG_LayerWidget::update() {

    RS_DEBUG->print("QG_LayerWidget::update() begin");

    if (!layerView) {
        RS_DEBUG->print(RS_Debug::D_ERROR, "QG_LayerWidget::update: nullptr layerView");
        return;
    }
    int yPos = layerView->verticalScrollBar()->value();
    layerView->resizeRowsToContents();
    layerView->verticalScrollBar()->setValue(yPos);

    if (!layerList) {
        RS_DEBUG->print(RS_Debug::D_ERROR, "QG_LayerWidget::update: nullptr layerList");
        return;
    }
    layerModel->setLayerList(layerList);

    RS_DEBUG->print("QG_LayerWidget::update: reactivating current layer");

    RS_Layer* activeLayer = layerList->getActive();
    if (!activeLayer) {
        RS_DEBUG->print(RS_Debug::D_ERROR, "QG_LayerWidget::update: nullptr activeLayer");
        return;
    }
    activateLayer(activeLayer);

    if (!lastLayer) {
        RS_DEBUG->print(RS_Debug::D_WARNING, "QG_LayerWidget::update: nullptr lastLayer");
        lastLayer = activeLayer;
    }

    RS_DEBUG->print("QG_LayerWidget::update(): OK");
}
예제 #3
0
/**
 * Updates the layer box from the layers in the graphic.
 */
void QG_LayerWidget::update() {
    RS_DEBUG->print("QG_LayerWidget::update() begin");

    int yPos = layerView->verticalScrollBar()->value();

    RS_Layer* activeLayer;
    if (layerList) {
        activeLayer = layerList->getActive();
    } else {
        activeLayer = NULL;
    }

    layerModel->setLayerList(layerList);

    if (layerList==NULL) {
        RS_DEBUG->print("QG_LayerWidget::update() abort");
        return;
    }

    RS_DEBUG->print("QG_LayerWidget::update() reactivating current layer");

    RS_Layer* l = lastLayer;
    activateLayer(activeLayer);
    lastLayer = l;
    layerView->resizeRowsToContents();
    layerView->verticalScrollBar()->setValue(yPos);

    RS_DEBUG->print("QG_LayerWidget::update() end");
}
예제 #4
0
/**
 * Called when the user activates (highlights) a layer.
 */
void QG_LayerWidget::slotActivated(QModelIndex layerIdx /*const QString& layerName*/) {
    if (!layerIdx.isValid() || layerList==NULL) {
        return;
    }

    RS_Layer * lay = layerModel->getLayer( layerIdx.row() );
    if (lay == 0)
        return;

    if (layerIdx.column() == QG_LayerModel::NAME) {
        lastLayer = layerList->getActive();
        layerList->activate(lay);
        lastLayer = layerList->getActive();
        layerList->activate(lay);
        return;
    }

    RS_Layer* l = layerList->getActive();
    layerList->activate(lay);
    if (layerIdx.column() == QG_LayerModel::VISIBLE) {
        actionHandler->slotLayersToggleView();
    }
    if (layerIdx.column() == QG_LayerModel::LOCKED) {
        actionHandler->slotLayersToggleLock();
    }
    activateLayer(l);



}