39 QDialog (&mainWindow),
40 m_modelCoords (modelCoords),
41 m_modelGeneral (modelGeneral),
42 m_modelMainWindow (modelMainWindow)
46 QVBoxLayout *layout =
new QVBoxLayout;
49 setCursor (QCursor (Qt::ArrowCursor));
51 setWindowTitle (tr (
"Edit Axis Point"));
53 createScaleLength (layout);
55 createOkCancel (layout);
67void DlgEditScale::createHint (QVBoxLayout *layoutOuter)
72 QWidget *widget =
new QWidget;
73 layoutOuter->addWidget (widget, 0, Qt::AlignCenter);
75 QHBoxLayout *layout =
new QHBoxLayout;
76 widget->setLayout (layout);
79 QString hint = QString (
"%1: %2")
80 .arg (tr (
"Number format"))
82 QLabel *label =
new QLabel (hint);
83 layout->addWidget (label);
86void DlgEditScale::createOkCancel (QVBoxLayout *layoutOuter)
88 QWidget *panel =
new QWidget (
this);
89 layoutOuter->addWidget (panel, 0, Qt::AlignCenter);
91 QHBoxLayout *layout =
new QHBoxLayout (panel);
92 panel->setLayout (layout);
94 m_btnOk =
new QPushButton (tr (
"Ok"),
this);
95 layout->addWidget(m_btnOk);
96 connect (m_btnOk, SIGNAL (released ()),
this, SLOT (accept ()));
98 m_btnCancel =
new QPushButton (tr (
"Cancel"),
this);
99 layout->addWidget(m_btnCancel);
100 connect (m_btnCancel, SIGNAL (released ()),
this, SLOT (reject ()));
103void DlgEditScale::createScaleLength (QVBoxLayout *layoutOuter)
106 DlgValidatorFactory dlgValidatorFactory;
107 m_validatorScaleLength = dlgValidatorFactory.
createAboveZero (m_modelMainWindow.locale());
110 QGroupBox *panel =
new QGroupBox (tr (
"Scale Length"),
this);
111 layoutOuter->addWidget (panel);
113 QHBoxLayout *layout =
new QHBoxLayout (panel);
114 panel->setLayout (layout);
117 m_editScaleLength =
new QLineEdit;
119 m_editScaleLength->setAlignment (
ALIGNMENT);
120 m_editScaleLength->setValidator (m_validatorScaleLength);
122 m_editScaleLength->setWhatsThis (tr (
"Enter the scale bar length"));
123 layout->addWidget(m_editScaleLength, 0);
124 connect (m_editScaleLength, SIGNAL (textChanged (
const QString &)),
this, SLOT (slotTextChanged (
const QString &)));
127void DlgEditScale::initializeScaleLength (
const double *scaleLength)
130 m_editScaleLength->setText (QString::number (*
scaleLength));
136 double xTheta, yRadius;
137 const QString DUMMY_Y (
"0");
152void DlgEditScale::slotTextChanged (
const QString &)
157void DlgEditScale::updateControls ()
159 QString textScaleLength = m_editScaleLength->text();
164 m_btnOk->setEnabled (!textScaleLength.isEmpty () &&
165 (m_validatorScaleLength->validate(textScaleLength, posScaleLength) == QValidator::Acceptable));
const Qt::Alignment ALIGNMENT
const int MIN_WIDTH_TO_FIT_STRANGE_UNITS
log4cpp::Category * mainCat
QString QLocaleToString(const QLocale &locale)
DlgEditScale(MainWindow &mainWindow, const DocumentModelCoords &modelCoords, const DocumentModelGeneral &modelGeneral, const MainWindowModel &modelMainWindow, const double *scaleLength=0)
Single constructor.
double scaleLength() const
Return the scale bar length specified by the user. Only applies if dialog was accepted.
DlgValidatorAbstract * createAboveZero(const QLocale &locale) const
Factory method for generating validators for scale length which must be a number greater than zero.
Model for DlgSettingsCoords and CmdSettingsCoords.
Model for DlgSettingsGeneral and CmdSettingsGeneral.
Model for DlgSettingsMainWindow.
QLocale locale() const
Get method for locale.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
#define LOG4CPP_INFO_S(logger)