Beispiel #1
0
//!Update QGIView's selection state based on Selection made outside Drawing Interface
void MDIViewPage::selectQGIView(App::DocumentObject *obj, const bool isSelected)
{
    App::DocumentObject* objCopy = obj;
    TechDraw::DrawHatch* hatchObj = dynamic_cast<TechDraw::DrawHatch*>(objCopy);
    if (hatchObj) {                                                    //Hatch does not have a QGIV of it's own. mark parent as selected.
        objCopy = hatchObj->getSourceView();                           //possible to highlight subObject?
    }
    QGIView *view = m_view->findQViewForDocObj(objCopy);

    blockSelection(true);
    if(view) {
        bool state = view->isSelected();
        if (state != isSelected) {
            view->setSelected(isSelected);
            view->updateView();
        }
    }
    blockSelection(false);
}
Beispiel #2
0
//Set all QGIViews to unselected state
void MDIViewPage::clearSceneSelection()
{
  blockSelection(true);
  m_sceneSelected.clear();

  std::vector<QGIView *> views = m_view->getViews();

  // Iterate through all views and unselect all
  for (std::vector<QGIView *>::iterator it = views.begin(); it != views.end(); ++it) {
      QGIView *item = *it;
      bool state = item->isSelected();
      if (state) {
          item->setSelected(false);
          item->updateView();
      }
  }

  blockSelection(false);
}