VR-Forces 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  virtual ~DtLevelBar() override;
27 
29  virtual void setText(const QString& text);
30 
32  virtual QString text() const override;
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);
51  virtual ~DtLevelBarDelegate() override;
52 
53  virtual void paint(
54  QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
55  virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
56 
61 
63  virtual void setText(DtLevelBar& bar, double level, double max) const;
64 
70 
72  virtual void setValues(DtLevelBar& bar, double level, double max) const;
73 
78 
80  virtual QWidget * createEditor(
81  QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override
82  { return 0; }
83  virtual void setEditorData(QWidget* editor, const QModelIndex& index) const override {}
84  virtual void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override
85  {
86  }
87 
88  protected:
89 
91  static QString defaultTextFunction(double level, double max);
92 
94  static void defaultValuesFunction(int& outLevel, int& outMax, double level, double max);
95 
99  };
100  }
101 }
102 
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 QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
There is no editing allowed.
Definition: levelBar.h:80
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
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 QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
DtLevelBarValuesFunction myValuesFunction
Definition: levelBar.h:97
DtLevelBarTextFunction myTextFunction
Definition: levelBar.h:96
QString myText
Text to display.
Definition: levelBar.h:37
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const override
Definition: levelBar.h:83
#define DT_DLL_VRFGUIOBJECTINFORMATIONQT
Contains DLL export macros.
Definition: vrfGuiObjectInformationQt.h:24
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
Definition: levelBar.h:84
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:98
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)