FougTools  0.7.0dev-046fb6a
Handy tools for C++, Qt and OpenCascade
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
abstract_length_editor.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** FougTools
3 ** Copyright Fougue (30 Mar. 2015)
4 ** contact@fougue.pro
5 **
6 ** This software is a computer program whose purpose is to provide utility
7 ** tools for the C++ language and the Qt toolkit.
8 **
9 ** This software is governed by the CeCILL-C license under French law and
10 ** abiding by the rules of distribution of free software. You can use,
11 ** modify and/ or redistribute the software under the terms of the CeCILL-C
12 ** license as circulated by CEA, CNRS and INRIA at the following URL
13 ** "http://www.cecill.info".
14 ****************************************************************************/
15 
16 #pragma once
17 
18 #include "gui.h"
20 #include <QtCore/QVector>
21 
22 namespace qtgui {
23 
25 {
26 public:
28  {
31  MillimeterUnit
32  };
33  static QVector<MetricUnit> allMetricUnits();
34 
36  {
39  YardUnit
40  };
41  static QVector<ImperialUnit> allImperialUnits();
42 
44 
45  double qtyValue() const Q_DECL_OVERRIDE;
46  void setQtyValue(double v) Q_DECL_OVERRIDE;
47 
48  virtual double length() const = 0;
49  virtual void setLength(double v) = 0;
50 
51  MetricUnit preferredMetricUnit() const;
52  virtual void setPreferredMetricUnit(MetricUnit unit);
53 
54  ImperialUnit preferredImperialUnit() const;
55  virtual void setPreferredImperialUnit(ImperialUnit unit);
56 
57  // -- Utilities
58  static QString unitText(MetricUnit unit);
59  static QString unitText(ImperialUnit unit);
60  static double asMetricLength(double len, MetricUnit unit);
61  static double asImperialLength(double len, ImperialUnit unit);
62 
63 private:
64  MetricUnit m_prefMetricUnit;
65  ImperialUnit m_prefImperialUnit;
66 };
67 
68 } // namespace qtgui
69 
70 #include <QtCore/QMetaType>
72 Q_DECLARE_METATYPE(qtgui::AbstractLengthEditor::ImperialUnit)
73 
ImperialUnit
Definition: abstract_length_editor.h:35
Definition: abstract_length_editor.h:29
Definition: abstract_length_editor.cpp:20
Definition: abstract_length_editor.h:30
MetricUnit
Definition: abstract_length_editor.h:27
Definition: abstract_length_editor.h:37
Abstract base class for all length ([L]) editors that are aware of the current measurement system (me...
Definition: abstract_length_editor.h:24
#define QTTOOLS_GUI_EXPORT
Definition: gui.h:27
Definition: abstract_length_editor.h:38
Base abstract class for editor of quantities, works in coordination with QuantityEditorManager.
Definition: abstract_quantity_editor.h:23