Ref T225, coordinate dialog

This commit is contained in:
Klaus Basan
2018-01-18 14:40:51 +01:00
parent fc84bf6579
commit a764ea7534
3 changed files with 241 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
/* Copyright (C) 2018
* swift project Community / Contributors
*
* This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "coordinatedialog.h"
#include "ui_coordinatedialog.h"
#include <QPushButton>
using namespace BlackMisc;
using namespace BlackMisc::Geo;
using namespace BlackGui::Editors;
namespace BlackGui
{
namespace Components
{
CCoordinateDialog::CCoordinateDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::CCoordinateDialog)
{
ui->setupUi(this);
ui->editor_Coordinate->showSetButton(false);
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
this->noDefaultButtons();
connect(ui->editor_Coordinate, &CCoordinateForm::changedCoordinate, this, &CCoordinateDialog::changedCoordinate);
}
CCoordinateDialog::~CCoordinateDialog()
{ }
CCoordinateGeodetic CCoordinateDialog::getCoordinate() const
{
return ui->editor_Coordinate->getCoordinate();
}
void CCoordinateDialog::setCoordinate(const ICoordinateGeodetic &coordinate)
{
ui->editor_Coordinate->setCoordinate(coordinate);
}
void CCoordinateDialog::setReadOnly(bool readonly)
{
ui->editor_Coordinate->setReadOnly(readonly);
}
void CCoordinateDialog::setSelectOnly()
{
ui->editor_Coordinate->setSelectOnly();
}
void CCoordinateDialog::showElevation(bool show)
{
ui->editor_Coordinate->showElevation(show);
}
CStatusMessageList CCoordinateDialog::validate(bool nested) const
{
return ui->editor_Coordinate->validate(nested);
}
void CCoordinateDialog::noDefaultButtons()
{
QPushButton *okBtn = ui->bb_CoordinateDialog->button(QDialogButtonBox::Ok);
okBtn->setAutoDefault(true);
okBtn->setDefault(true);
QPushButton *caBtn = ui->bb_CoordinateDialog->button(QDialogButtonBox::Cancel);
caBtn->setAutoDefault(false);
caBtn->setDefault(false);
}
} // ns
} // ns

View File

@@ -0,0 +1,70 @@
/* Copyright (C) 2018
* swift project Community / Contributors
*
* This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKGUI_COMPONENTS_COORDINATEDIALOG_H
#define BLACKGUI_COMPONENTS_COORDINATEDIALOG_H
#include "blackgui/blackguiexport.h"
#include "blackgui/editors/coordinateform.h"
#include <QDialog>
#include <QScopedPointer>
namespace Ui { class CCoordinateDialog; }
namespace BlackGui
{
namespace Components
{
//! Coordinate form as dialog
//! \sa BlackGui::Editors::CCoordinateForm
class BLACKGUI_EXPORT CCoordinateDialog : public QDialog
{
Q_OBJECT
public:
//! Constructor
explicit CCoordinateDialog(QWidget *parent = nullptr);
//! Destructor
virtual ~CCoordinateDialog();
//! \copydoc BlackGui::Editors::CCoordinateForm::getCoordinate
BlackMisc::Geo::CCoordinateGeodetic getCoordinate() const;
//! \copydoc BlackGui::Editors::CCoordinateForm::setCoordinate
void setCoordinate(const BlackMisc::Geo::ICoordinateGeodetic &coordinate);
//! \copydoc BlackGui::Editors::CCoordinateForm::setReadOnly
void setReadOnly(bool readonly);
//! \copydoc BlackGui::Editors::CCoordinateForm::setSelectOnly
void setSelectOnly();
//! \copydoc BlackGui::Editors::CCoordinateForm::showElevation
void showElevation(bool show);
//! \copydoc BlackGui::Editors::CCoordinateForm::validate
BlackMisc::CStatusMessageList validate(bool nested = false) const;
signals:
//! \copydoc BlackGui::Editors::CCoordinateForm::changedCoordinate
void changedCoordinate();
private:
QScopedPointer<Ui::CCoordinateDialog> ui;
//! disable default buttons
void noDefaultButtons();
};
} // ns
} // ns
#endif // guard

View File

@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CCoordinateDialog</class>
<widget class="QDialog" name="CCoordinateDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>150</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>500</width>
<height>150</height>
</size>
</property>
<property name="windowTitle">
<string>Coordinates</string>
</property>
<layout class="QVBoxLayout" name="vl_CoordinateDialog">
<item alignment="Qt::AlignTop">
<widget class="BlackGui::Editors::CCoordinateForm" name="editor_Coordinate">
<property name="minimumSize">
<size>
<width>0</width>
<height>75</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="bb_CoordinateDialog">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>BlackGui::Editors::CCoordinateForm</class>
<extends>QFrame</extends>
<header>blackgui/editors/coordinateform.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>bb_CoordinateDialog</sender>
<signal>accepted()</signal>
<receiver>CCoordinateDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>bb_CoordinateDialog</sender>
<signal>rejected()</signal>
<receiver>CCoordinateDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>