3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
10 // JLH = James L. Hammons <jlhamm@acm.org>
13 // --- ---------- -----------------------------------------------------------
14 // JLH 06/10/2010 Created this file. :-)
17 #include "snapdistoptions.h"
19 //#include "actionmodifytrimamount.h"
20 //#include "actioninterface.h"
21 //#include "rs_debug.h"
25 SnapDistOptions::SnapDistOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
26 QWidget(parent, flags),
27 lDist(new QLabel(tr("Distance:"))),
28 leDist(new QLineEdit(this))
30 QHBoxLayout * layout = new QHBoxLayout(this);
31 layout->setContentsMargins(0, 0, 0, 0);
33 leDist->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
35 layout->addWidget(lDist);
36 layout->addWidget(leDist);
38 connect(leDist, SIGNAL(textChanged(QString)), this, SLOT(updateDist(QString)));
40 // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
41 // nothing will show up on the screen. :-)
43 parent->addWidget(this);
46 SnapDistOptions::~SnapDistOptions()
48 settings.beginGroup("Snap");
49 settings.setValue("Distance", leDist->text());
53 void SnapDistOptions::setDist(double * d)
57 settings.beginGroup("Snap");
58 QString r = settings.value("Distance", "1.0").toString();
64 void SnapDistOptions::updateDist(const QString & d)
67 *dist = RS_Math::eval(d, 1.0);