void QG_SnapToolBar::actionTriggered() { actionHandler->slotSetSnaps(getSnaps()); //save the current snap mode after any mode change, instead of relying // on the dtor to save the mode, in order to avoid segfault at closing saveSnapMode(); }
void QG_SnapToolBar::saveSnapMode() { //@write default snap mode from prefrences. unsigned int snapFlags=RS_Snapper::snapModeToInt(getSnaps()); RS_SETTINGS->beginGroup("/Snap"); RS_SETTINGS->writeEntry("/SnapMode",QString::number(snapFlags)); RS_SETTINGS->endGroup(); // no need to delete child widgets, Qt does it all for us }
void QG_SnapToolBar::setSnaps ( RS_SnapMode const& s ) { if(getSnaps()==s) return; snapFree->setChecked(s.snapFree); snapGrid->setChecked(s.snapGrid); snapEnd->setChecked(s.snapEndpoint); snapOnEntity->setChecked(s.snapOnEntity); snapCenter->setChecked(s.snapCenter); snapMiddle->setChecked(s.snapMiddle); snapDistance->setChecked(s.snapDistance); snapIntersection->setChecked(s.snapIntersection); restrictHorizontal->setChecked(s.restriction==RS2::RestrictHorizontal || s.restriction==RS2::RestrictOrthogonal); restrictVertical->setChecked(s.restriction==RS2::RestrictVertical || s.restriction==RS2::RestrictOrthogonal); restrictOrthogonal->setChecked(s.restriction==RS2::RestrictOrthogonal); restrictNothing->setChecked(s.restriction==RS2::RestrictNothing); }
void QG_SnapToolBar::actionTriggered() { actionHandler->slotSetSnaps(getSnaps()); }