Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoQtColorEditor Class Reference

VSG extension Component that lets you edit a color interactively. More...

#include <Inventor/Qt/SoQtColorEditor.h>

+ Inheritance diagram for SoQtColorEditor:

Public Types

enum  Sliders {
  NONE ,
  INTENSITY ,
  RGB ,
  HSV ,
  RGB_V ,
  RGB_HSV
}
 Sliders. More...
 
enum  UpdateFrequency {
  CONTINUOUS ,
  AFTER_ACCEPT
}
 Update frequency. More...
 
typedef void SoQtColorEditorCB(void *userData, const SbColor *color)
 External change callback functions registered with the color editor should be of this type.
 
- Public Types inherited from SoQtComponent
typedef void SoQtComponentCB(void *userData, SoQtComponent *comp)
 

Public Member Functions

 SoQtColorEditor (QWidget *parent=qApp->activeWindow(), const char *name=NULL, SbBool buildInsideParent=TRUE)
 Constructor.
 
 ~SoQtColorEditor ()
 Destructor.
 
void attach (SoSFColor *color, SoBase *node)
 Attaches the editor to a color node and edits the specified color.
 
void attach (SoMFColor *color, int index, SoBase *node)
 Attaches the editor to a color node and edits the specified color.
 
void attach (SoMFUInt32 *color, int index, SoBase *node)
 Attaches the editor to a color node and edits the color of the given index.
 
void detach ()
 Detaches the editor from a color node.
 
SbBool isAttached ()
 Returns TRUE if the editor is attached.
 
void addColorChangedCallback (SoQtColorEditorCB *f, void *userData=NULL)
 Additional way of using the color editor, by registering a callback which will be called whenever the color changes (check the UpdateFrequency to find when the callbacks will be called).
 
void removeColorChangedCallback (SoQtColorEditorCB *f, void *userData=NULL)
 Removes colorChanged callback.
 
void setColor (const SbColor &color)
 Sets a new color value.
 
const SbColorgetColor ()
 Gets the current color value.
 
void setWYSIWYG (SbBool trueOrFalse)
 Sets the WYSIWYG (what-you-see-is-what-you-get) mode on/off for the colored backgrounds of the sliders.
 
SbBool isWYSIWYG ()
 Gets the WYSIWYG mode.
 
void setCurrentSliders (SoQtColorEditor::Sliders whichSliders)
 Sets which slider(s) should be displayed.
 
SoQtColorEditor::Sliders getCurrentSliders ()
 Gets which slider(s) should be displayed.
 
void setUpdateFrequency (SoQtColorEditor::UpdateFrequency freq)
 Sets the update frequency.
 
SoQtColorEditor::UpdateFrequency getUpdateFrequency ()
 Gets the update frequency.
 
virtual void show ()
 Make the color editor visible.
 
virtual void hide ()
 Hide the color editor.
 
- Public Member Functions inherited from SoQtComponent
SbBool isVisible ()
 Returns TRUE if this component is mapped onto the screen.
 
virtual QWidget * getWidget () const
 This returns the base widget handle for this component.
 
SbBool isTopLevelShell () const
 Returns TRUE if this component is a top level shell component (has its own window).
 
QWidget * getShellWidget () const
 Returns the topLevelShell widget handle (NULL if the topLevelShell hasn't been created by this component).
 
QWidget * getParentWidget () const
 Returns the parent widget handle.
 
void setSize (const SbVec2s &size)
 Convenience routine on the widget handle.
 
SbVec2s getSize ()
 Convenience routine on the widget handle.
 
virtual SbBool setFullScreen (const SbBool enable)
 Switches the viewer into (or out of) fullscreen mode.
 
SbBool isFullScreen (void) const
 Queries if the viewer is in fullscreen mode.
 
void setFullScreenEnable (const SbBool enable)
 Enables/disables fullscreen mode.
 
SbBool isFullScreenEnable (void) const
 Queries if it is possible to put the viewer in fullscreen mode.
 
SbGlContextHelper::Display getDisplay ()
 On UNIX, returns the X display associated with this components widget.
 
void setTitle (const char *newTitle)
 Sets window title.
 
void setTitle (const SbString &newTitle)
 Sets window title.
 
void setTitle (const QString &newTitle)
 Sets window title.
 
const QString getTitle () const
 Gets window title.
 
void setIconTitle (const QString &newIconTitle)
 Included for portability only.
 
const QString getIconTitle () const
 Included for portability only.
 
SbString getWidgetName () const
 Returns the widget handle name.
 
SbString getClassName () const
 Returns the class name.
 
void setWindowCloseCallback (SoQtComponentCB *func, void *data=NULL)
 Sets which callback to call when the user closes this component (double click in the upper left corner) - by default hide() is called on this component, unless a callback is set to something other than NULL.
 

Public Attributes

SbBool alwaysOnTop
 Boolean indicating if the editor should be always on top of the other windows.
 
- Public Attributes inherited from SoQtComponent
SbString helpFileName
 Name of help file to open when the viewer Help button is pressed.
 

Additional Inherited Members

- Static Public Member Functions inherited from SoQtComponent
static SoQtComponentgetComponent (QWidget *widget)
 Returns the SoQtComponent for this widget handle.
 

Detailed Description

VSG extension Component that lets you edit a color interactively.

The SoQtColorEditor class lets you interactively edit colors using color sliders and a color wheel. You can either use it directly to edit a color field in the database by using the attach()/detach() routines, or use it by registering a callback routine which will get called whenever the color changes (passing an SbColor to that routine).

The editor can currently be attached to only one color at a time. Attaching two different colors will automatically detach the first one before attaching the second.

SEE ALSO

SoQtComponent

Definition at line 89 of file SoQtColorEditor.h.

Member Typedef Documentation

◆ SoQtColorEditorCB

typedef void SoQtColorEditorCB(void *userData, const SbColor *color)

External change callback functions registered with the color editor should be of this type.

Definition at line 57 of file SoQtColorEditor.h.

Member Enumeration Documentation

◆ Sliders

Sliders.

List of possible slider combinations, which is used to specify which sliders should be displayed at any time.

Enumerator
NONE 

Display no sliders.

INTENSITY 

Display intensity slider (default)

RGB 

Display RGB sliders.

HSV 

Display HSV sliders.

RGB_V 

Display RGB and value sliders.

RGB_HSV 

Display RGB and HSV sliders.

Definition at line 99 of file SoQtColorEditor.h.

◆ UpdateFrequency

Update frequency.

UpdateFrequency is how often new values should be sent to the node or the callback routine.

Enumerator
CONTINUOUS 

Send updates with every mouse motion.

AFTER_ACCEPT 

Only send updates after user hits accept button.

Definition at line 131 of file SoQtColorEditor.h.

Constructor & Destructor Documentation

◆ SoQtColorEditor()

SoQtColorEditor::SoQtColorEditor ( QWidget *  parent = qApp->activeWindow(),
const char *  name = NULL,
SbBool  buildInsideParent = TRUE 
)

Constructor.

◆ ~SoQtColorEditor()

SoQtColorEditor::~SoQtColorEditor ( )

Destructor.

Member Function Documentation

◆ addColorChangedCallback()

void SoQtColorEditor::addColorChangedCallback ( SoQtColorEditorCB f,
void *  userData = NULL 
)
inline

Additional way of using the color editor, by registering a callback which will be called whenever the color changes (check the UpdateFrequency to find when the callbacks will be called).

Definition at line 393 of file SoQtColorEditor.h.

◆ attach() [1/3]

void SoQtColorEditor::attach ( SoMFColor color,
int  index,
SoBase node 
)

Attaches the editor to a color node and edits the specified color.

See attach() for details.

◆ attach() [2/3]

void SoQtColorEditor::attach ( SoMFUInt32 color,
int  index,
SoBase node 
)

Attaches the editor to a color node and edits the color of the given index.

See attach() for details.

◆ attach() [3/3]

void SoQtColorEditor::attach ( SoSFColor color,
SoBase node 
)

Attaches the editor to a color node and edits the specified color.

Attaching to the color node increments the reference count of the color node.

The color editor uses a sensor on the color field to automatically update itself when the color is changed externally.

NOTE: The node containing the field needs to also be passed to attach the sensor to it (since field sensors are not yet supported).

NOTE: The color editor can only be attached to either a single field or a multiple field at any given time. Even when attached to a multiple field, only a single color from that field is edited, as specified by index.

◆ detach()

void SoQtColorEditor::detach ( )

Detaches the editor from a color node.

Detaching from the color node decrements the reference count of the color node.

◆ getColor()

const SbColor & SoQtColorEditor::getColor ( )
inline

Gets the current color value.

Definition at line 213 of file SoQtColorEditor.h.

◆ getCurrentSliders()

SoQtColorEditor::Sliders SoQtColorEditor::getCurrentSliders ( )
inline

Gets which slider(s) should be displayed.

Definition at line 242 of file SoQtColorEditor.h.

◆ getUpdateFrequency()

SoQtColorEditor::UpdateFrequency SoQtColorEditor::getUpdateFrequency ( )
inline

Gets the update frequency.

Definition at line 251 of file SoQtColorEditor.h.

◆ hide()

virtual void SoQtColorEditor::hide ( )
virtual

Hide the color editor.

Reimplemented from SoQtComponent.

◆ isAttached()

SbBool SoQtColorEditor::isAttached ( )
inline

Returns TRUE if the editor is attached.

Definition at line 190 of file SoQtColorEditor.h.

◆ isWYSIWYG()

SbBool SoQtColorEditor::isWYSIWYG ( )
inline

Gets the WYSIWYG mode.

Definition at line 233 of file SoQtColorEditor.h.

◆ removeColorChangedCallback()

void SoQtColorEditor::removeColorChangedCallback ( SoQtColorEditorCB f,
void *  userData = NULL 
)
inline

Removes colorChanged callback.

Definition at line 398 of file SoQtColorEditor.h.

◆ setColor()

void SoQtColorEditor::setColor ( const SbColor color)

Sets a new color value.

NOTE: setColor() will call colorChanged callbacks if the color differs.

◆ setCurrentSliders()

void SoQtColorEditor::setCurrentSliders ( SoQtColorEditor::Sliders  whichSliders)

Sets which slider(s) should be displayed.

◆ setUpdateFrequency()

void SoQtColorEditor::setUpdateFrequency ( SoQtColorEditor::UpdateFrequency  freq)

Sets the update frequency.

See the UpdateFrequency enum declaration.

◆ setWYSIWYG()

void SoQtColorEditor::setWYSIWYG ( SbBool  trueOrFalse)

Sets the WYSIWYG (what-you-see-is-what-you-get) mode on/off for the colored backgrounds of the sliders.

In WYSIWYG mode, the color shown on the slider background beneath the slider pointer is what you get. For example, if R,G,B sliders in WYSIWYG mode are set to (0,1,1), the color beneath each slider pointer will be cyan because (0,1,1) corresponds to cyan.

In non-WYSIWYG mode, the color shown on the slider background reflects only the value of the parameter that the slider controls. For example, the background of the red slider will display only red values, the green slider will display only green values, and so forth.

◆ show()

virtual void SoQtColorEditor::show ( )
virtual

Make the color editor visible.

Reimplemented from SoQtComponent.

Member Data Documentation

◆ alwaysOnTop

SbBool SoQtColorEditor::alwaysOnTop

Boolean indicating if the editor should be always on top of the other windows.

Definition at line 267 of file SoQtColorEditor.h.


The documentation for this class was generated from the following file: