VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
levelBar.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include <QStyledItemDelegate>
12 #include <QProgressBar>
13 
15 namespace makVrf
16 {
17  namespace makVrfGuiObjectInformationQt
18  {
22  {
23  public:
24  DtLevelBar(QWidget* parent = 0);
25 
26  ~DtLevelBar();
27 
29  virtual void setText(const QString& text);
30 
32  virtual QString text() const;
33 
34  protected:
35 
37  QString myText;
38  };
39 
40  typedef QString (*DtLevelBarTextFunction)(double level, double max);
41  typedef void (*DtLevelBarValuesFunction)(int& outLevel, int& outMax, double level, double max);
43 
47  {
48  public:
49 
50  DtLevelBarDelegate(QWidget *parent = 0);
52 
53  void paint(QPainter *painter, const QStyleOptionViewItem &option,
54  const QModelIndex &index) const;
55  QSize sizeHint(const QStyleOptionViewItem &option,
56  const QModelIndex &index) const;
57 
62 
64  virtual void setText(DtLevelBar& bar, double level, double max) const;
65 
71 
73  virtual void setValues(DtLevelBar& bar, double level, double max) const;
74 
79 
81  virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
82  const QModelIndex &index) const { return 0; }
83  virtual void setEditorData(QWidget *editor, const QModelIndex &index) const {}
84  virtual void setModelData(QWidget *editor, QAbstractItemModel *model,
85  const QModelIndex &index) const {}
86 
87  protected:
88 
90  static QString defaultTextFunction(double level, double max);
91 
93  static void defaultValuesFunction(int& outLevel, int& outMax, double level, double max);
94 
98  };
99  }
100 }
101 
virtual void setValues(DtLevelBar &bar, double level, double max) const
Sets the values for the given bar.
static void defaultValuesFunction(int &outLevel, int &outMax, double level, double max)
Sets values as doubles rounded to the nearest whole integer.
virtual void setText(DtLevelBar &bar, double level, double max) const
Sets the text for the given bar.
DT_DLL_VRVCORE DtTaitBryan level(const DtCoordinateSystem &cs, const DtVector &localOrigin, double topoHeading)
Returns a level orientation with the topographic heading.
QString(* DtLevelBarTextFunction)(double level, double max)
Definition: levelBar.h:40
A special progress bar widget to use by DtLevelBarDelegate.
Definition: levelBar.h:21
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
There is no editing allowed.
Definition: levelBar.h:81
void(* DtLevelBarValuesFunction)(int &outLevel, int &outMax, double level, double max)
Definition: levelBar.h:41
void setTextFunction(DtLevelBarTextFunction func)
Overrides the function that creates the standard text that is displayed on the level bar...
void setValuesFunction(DtLevelBarValuesFunction func)
QProgressBar (and by extension DtLevelBar) only functions on int values.
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
Definition: levelBar.h:84
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const
Definition: levelBar.h:83
DtLevelBarValuesFunction myValuesFunction
Definition: levelBar.h:96
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
DtLevelBarTextFunction myTextFunction
Definition: levelBar.h:95
QString myText
Text to display.
Definition: levelBar.h:37
#define DT_DLL_VRFGUIOBJECTINFORMATIONQT
Contains DLL export macros.
Definition: vrfGuiObjectInformationQt.h:25
A QStyledItemDelegate which displays a bar indicating the current level out of some maximum...
Definition: levelBar.h:46
static QString defaultTextFunction(double level, double max)
Sets text as a string of &quot;&lt;level&gt; / &lt;maxLevel&gt;&quot;.
void setToolTipFunction(DtLevelBarTextFunction func)
Sets a function that will be called to change the tool tip text for the level bar.
DtLevelBarTextFunction DtLevelBarToolTipFunction
Definition: levelBar.h:42
DtLevelBarToolTipFunction myToolTipFunction
Definition: levelBar.h:97

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)