1
/****************************************************************************
3
Construct option widget for equidistant points on entity
5
Copyright (C) 2011 Dongxu Li (dongxuli2011@gmail.com)
6
Copyright (C) 2011 R. van Twisk (librecad@rvt.dds.nl)
8
This program is free software; you can redistribute it and/or
9
modify it under the terms of the GNU General Public License
10
as published by the Free Software Foundation; either version 2
11
of the License, or (at your option) any later version.
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
**********************************************************************/
23
#include "qg_snapmiddleoptions.h"
28
* Constructs a QG_SnapMiddleOptions as a child of 'parent'
29
* and widget flags set to 'f'.
30
*@i, number equidistant points, minimum 1, maximum 99
34
QG_SnapMiddleOptions::QG_SnapMiddleOptions(int& i, QWidget* parent, Qt::WindowFlags fl)
42
* Destroys the object and frees any allocated resources
44
QG_SnapMiddleOptions::~QG_SnapMiddleOptions()
47
// no need to delete child widgets, Qt does it all for us
51
* Sets the strings of the subwidgets using the current
54
void QG_SnapMiddleOptions::languageChange()
59
void QG_SnapMiddleOptions::destroy() {
60
RS_SETTINGS->beginGroup("/Snap");
61
RS_SETTINGS->writeEntry("/MiddlePoints", *middlePoints);
62
RS_SETTINGS->endGroup();
65
void QG_SnapMiddleOptions::setMiddlePoints( int& i, bool initial) {
68
RS_SETTINGS->beginGroup("/Snap");
69
*middlePoints=RS_SETTINGS->readNumEntry("/MiddlePoints", 1);
70
if( !( *middlePoints>=1 && *middlePoints<=99)) {
72
RS_SETTINGS->writeEntry("/MiddlePoints", 1);
74
sbMiddlePoints->setValue(*middlePoints);
75
RS_SETTINGS->endGroup();
77
*middlePoints=sbMiddlePoints->value();
82
void QG_SnapMiddleOptions::updateMiddlePoints() {
83
if (middlePoints != NULL) {
84
*middlePoints = sbMiddlePoints->value();
88
void QG_SnapMiddleOptions::on_sbMiddlePoints_valueChanged(int i)
90
if (middlePoints != NULL) {
92
RS_SETTINGS->beginGroup("/Snap");
93
RS_SETTINGS->writeEntry("/MiddlePoints", *middlePoints);
94
RS_SETTINGS->endGroup();*/