swift
coordinatedialog.cpp
1 // SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
4 #include "coordinatedialog.h"
5 
6 #include <QPushButton>
7 
8 #include "ui_coordinatedialog.h"
9 
10 using namespace swift::misc;
11 using namespace swift::misc::geo;
12 using namespace swift::gui::editors;
13 
14 namespace swift::gui::components
15 {
16  CCoordinateDialog::CCoordinateDialog(QWidget *parent) : QDialog(parent), ui(new Ui::CCoordinateDialog)
17  {
18  ui->setupUi(this);
19  ui->editor_Coordinate->showSetButton(false);
20  this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
21  this->noDefaultButtons();
22  connect(this, &QDialog::accepted, this, &CCoordinateDialog::changedCoordinate);
23  }
24 
26 
27  CCoordinateGeodetic CCoordinateDialog::getCoordinate() const { return ui->editor_Coordinate->getCoordinate(); }
28 
30  {
31  ui->editor_Coordinate->setCoordinate(coordinate);
32  }
33 
34  void CCoordinateDialog::setReadOnly(bool readonly) { ui->editor_Coordinate->setReadOnly(readonly); }
35 
36  void CCoordinateDialog::setSelectOnly() { ui->editor_Coordinate->setSelectOnly(); }
37 
38  void CCoordinateDialog::showElevation(bool show) { ui->editor_Coordinate->showElevation(show); }
39 
41  {
42  return ui->editor_Coordinate->validate(nested);
43  }
44 
45  void CCoordinateDialog::noDefaultButtons()
46  {
47  QPushButton *okBtn = ui->bb_CoordinateDialog->button(QDialogButtonBox::Ok);
48  okBtn->setAutoDefault(true);
49  okBtn->setDefault(true);
50 
51  QPushButton *caBtn = ui->bb_CoordinateDialog->button(QDialogButtonBox::Cancel);
52  caBtn->setAutoDefault(false);
53  caBtn->setDefault(false);
54  }
55 } // namespace swift::gui::components
void showElevation(bool show)
Show elevation.
swift::misc::geo::CCoordinateGeodetic getCoordinate() const
Get the coordinate.
void setSelectOnly()
Read only, but entity can be selected (normally used in mapping). Use setReadOnly to reset this very ...
void changedCoordinate()
Change coordinate.
void setCoordinate(const swift::misc::geo::ICoordinateGeodetic &coordinate)
Set the coordinate.
void setReadOnly(bool readonly)
Set editable.
swift::misc::CStatusMessageList validate(bool nested=false) const
Validate, empty list means OK.
Status messages, e.g. from Core -> GUI.
Geodetic coordinate, a position in 3D space relative to the reference geoid.
High level reusable GUI components.
Definition: aboutdialog.cpp:13
Free functions in swift::misc.