VR-Forces 5.0.2 Developer's Guide
 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 
12 #include <QStyledItemDelegate>
13 #include <QProgressBar>
14 
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. Allows the delegate to use whatever text ...
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. However we have many double ...
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:24
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. The default is no tool tip.
DtLevelBarTextFunction DtLevelBarToolTipFunction
Definition: levelBar.h:42
DtLevelBarToolTipFunction myToolTipFunction
Definition: levelBar.h:97

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)