VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
colorEntryWidget.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2016 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
15 #include <vrfutil/rwColor.h>
16 #include <boost/signals2.hpp>
17 
18 class QLabel;
19 class QHBoxLayout;
20 class QColorDialog;
21 
22 namespace makVrv
23 {
24  class DtColorPushButton;
25 }
26 
27 namespace makVrf
28 {
31  {
32  Q_OBJECT
33 
34  Q_PROPERTY(bool showAlphaChannel READ showAlphaChannel WRITE setShowAlphaChannel)
35  Q_PROPERTY(bool showColorWidget READ showColorWidget WRITE setShowColorWidget)
36  Q_PROPERTY(bool blackIsOne READ blackIsOne WRITE setBlackIsOne)
37 
38  public:
39  DtColorEntryWidget(makVrv::DtDe& de, QWidget* parent, const Qt::WindowFlags& flags = 0, const CreationFlags& cflags = NormalMode);
40 
41  //DTOR
42  virtual ~DtColorEntryWidget() override;
43 
45  virtual void setLabel(const QString&) override;
46  virtual QString label() const override;
47 
49  virtual void setRange(double bottom, double top) override;
50 
52  virtual void setDefaultValue(const std::string&) override;
53 
55  virtual void setVariableData(const QString&) override;
56 
58  virtual DtReaderWriter* createBoundVariable(const std::string& variableName) override;
59 
61  virtual void setupFromBoundVariable(const DtReaderWriter* variableName) override;
62 
64  virtual void setColor(const DtRwColor&);
65  virtual DtRwColor color() const;
66 
67  static makVrv::DtUnicode codeVariableType()
68  {
69  return makVrv::DtUnicode::tr("Color: rgba");
70  }
71 
74  virtual void setBlackIsOne(bool);
75  virtual bool blackIsOne() const;
76 
78  boost::signals2::signal<void ()> signal_changed;
80  boost::signals2::signal<void()> signal_accepted;
82  boost::signals2::signal<void()> signal_done;
83 
84  virtual DtTaskSetVariableWidgetExtensionInterface* parameterContents(
85  QWidget* parent, const Qt::WindowFlags& flags = 0) const override;
86 
88  virtual void setShowColorWidget(bool);
89  bool showColorWidget() const { return myColorWidgetShown; }
90 
92  virtual void setShowAlphaChannel(bool);
93  bool showAlphaChannel() const { return myShowAlphaChannel; };
94 
95  static std::string designerGroup()
96  {
97  return tr("VR-Forces Data Entry").toUtf8().constData();
98  }
99 
100  static std::string headerFile()
101  {
102  return tr("<vrfGuiDataEntryWidgets/colorEntryWidget.h>").toUtf8().constData();
103  }
104 
105  static std::string variableName()
106  {
107  return tr("color").toUtf8().constData();
108  }
109 
110  protected:
111  virtual std::string variableDataFromUiDesigner(
112  const QDomElement& element, const DtScriptedTaskVariableLayoutConverter& converter) const override;
113 
114  protected slots:
115  virtual void onColorChanged();
116  virtual void onColorAccepted();
117  virtual void onColorRejected();
118 
119 
120  public:
123  QHBoxLayout* myContentLayout;
125 
126  protected:
130  };
131 
133 
136  {
137  Q_OBJECT
138 
139  public:
140  DtColorVariableWidgetExtension(makVrv::DtDe&, QWidget* w, const Qt::WindowFlags& f = 0);
141  virtual ~DtColorVariableWidgetExtension() override;
142  };
143 }
bool myBlackIsOne
Definition: colorEntryWidget.h:129
QLabel * myColorLabel
Definition: colorEntryWidget.h:121
QHBoxLayout * myContentLayout
Definition: colorEntryWidget.h:123
DtTaskSetVariableWidgetCreator< DtColorEntryWidget > DtColorEntryWidgetCreator
Definition: colorEntryWidget.h:132
boost::signals2::signal< void()> signal_accepted
Signal sent when color change is accepted.
Definition: colorEntryWidget.h:80
CreationFlags
Definition: taskSetVariableWidget.h:118
A push-button that displays a current color and pops up a color picker dialog when pressed...
Definition: DtColorPushButton.h:26
bool showAlphaChannel() const
Definition: colorEntryWidget.h:93
This class will parse the UI file for known scripted task variable types and pull out specified scrip...
Definition: scriptedTaskVariableLayoutConverter.h:32
bool showColorWidget() const
Definition: colorEntryWidget.h:89
Definition: readerWriter.h:85
static std::string variableName()
Definition: colorEntryWidget.h:105
Simple string variable widget extension. Hides top/bottom items as they are not needed.
Definition: colorEntryWidget.h:135
boost::signals2::signal< void()> signal_changed
Signal sent when anything about the color has changed.
Definition: colorEntryWidget.h:78
Widget that allows for the selection of a color value.
Definition: colorEntryWidget.h:30
Basic implementation that has a label at the top.
Definition: taskSetVariableWidget.h:231
Reader-Writer color specified by red, green, blue components.
Definition: rwColor.h:19
static DtUnicode tr(const char *ascii)
Ascii translation function, used to be compatible with Qt&#39;s translation tools. This will simply call ...
Definition: DtUnicode.h:92
Definition: taskSetVariableWidget.h:422
#define DT_DLL_VRFGUIDATAENTRYWIDGETS
Definition: vrfGuiDataEntryWidgets.h:22
static std::string designerGroup()
Definition: colorEntryWidget.h:95
boost::signals2::signal< void()> signal_done
Signal sent when color change is rejected/cancelled.
Definition: colorEntryWidget.h:82
QColorDialog * myColorDialog
Definition: colorEntryWidget.h:124
bool myShowAlphaChannel
Definition: colorEntryWidget.h:127
static std::string headerFile()
Definition: colorEntryWidget.h:100
makVrv::DtColorPushButton * myColor
Definition: colorEntryWidget.h:122
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
Simple general extension widget that provides a default value and range. Subclasses can supply additi...
Definition: simpleVariableWidget.h:183
Extension interface for contents for definition of variables in the scripted task meta data variable ...
Definition: taskSetVariableWidget.h:83
bool myColorWidgetShown
Definition: colorEntryWidget.h:128

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)