walberla::gui::DisplayPropertiesItem Class Reference

Detailed Description

Represents on line in a QTreeWidget.

Provides a combobox, and optional color/gradient selection.

A FieldTreeWidgetItem can be added to a QTreeWidget. In its first column text can be displayed, in the second column a combobox is shown with user defined entries. The context menu (right click) of the item provides color and colormap selection ( if enabled )

This class is used to configure the display options of a waLBerla::field

  • combobox is used to select display style ( color, arrow ... )
  • the color selectors are used to select the colormap for a color coding of the field values, or the color for a specific flag in a FlagField

#include <DisplayPropertiesItem.h>

+ Inheritance diagram for walberla::gui::DisplayPropertiesItem:

Signals

void optionChanged ()
 Called whenever a option has changed (combobox, color, colormap) More...
 
void colorSelected (const QColor &newColor)
 Called when user selected a new color. More...
 
void colormapSelected ()
 Called when user selected a new colormap, use getColorFromColormap() to retrieve colormap entries. More...
 
void comboBoxSelectionChanged (int selectedOption)
 Called when a new combobox item was selected. More...
 

Public Member Functions

 DisplayPropertiesItem (const QStringList &comboBoxEntries, QTreeWidgetItem *parent, bool checkbox=true)
 Constructs the item with the given combobox entries. More...
 
virtual ~DisplayPropertiesItem ()
 
void enableColorSelect (bool enable=true)
 
void enableGradientSelect (bool enable=true)
 
QColor getSelectedColor () const
 Returns currently selected color. More...
 
QColor getColorFromColormap (double value)
 Returns a color for value between 0 and 1, according to current colormap. More...
 
void setColor (QColor c)
 Sets the display color. More...
 
int getComboBoxSelection ()
 Returns index of selected combobox item (as passed in constructor) More...
 
bool isEnabled () const
 True if checkbox before text is selected. More...
 
virtual void showContextMenu (QPoint globalPos)
 

Protected Member Functions

virtual void showGradientSelect ()
 
virtual void showColorSelect ()
 
void updateColormapFromGradient ()
 

Protected Attributes

bool gradientSelectEnabled_
 
bool colorSelectEnabled_
 
QColor dispColor_
 
QLinearGradient colorMapGradient_
 
QImage colorMap_
 

Constructor & Destructor Documentation

walberla::gui::DisplayPropertiesItem::DisplayPropertiesItem ( const QStringList &  comboBoxEntries,
QTreeWidgetItem *  parent,
bool  checkbox = true 
)

Constructs the item with the given combobox entries.

Parameters
parentthe parent item, must not be NULL
virtual walberla::gui::DisplayPropertiesItem::~DisplayPropertiesItem ( )
inlinevirtual

Member Function Documentation

void walberla::gui::DisplayPropertiesItem::colormapSelected ( )
signal

Called when user selected a new colormap, use getColorFromColormap() to retrieve colormap entries.

void walberla::gui::DisplayPropertiesItem::colorSelected ( const QColor &  newColor)
signal

Called when user selected a new color.

void walberla::gui::DisplayPropertiesItem::comboBoxSelectionChanged ( int  selectedOption)
signal

Called when a new combobox item was selected.

void walberla::gui::DisplayPropertiesItem::enableColorSelect ( bool  enable = true)
inline
void walberla::gui::DisplayPropertiesItem::enableGradientSelect ( bool  enable = true)
inline
QColor walberla::gui::DisplayPropertiesItem::getColorFromColormap ( double  value)

Returns a color for value between 0 and 1, according to current colormap.

int walberla::gui::DisplayPropertiesItem::getComboBoxSelection ( )

Returns index of selected combobox item (as passed in constructor)

QColor walberla::gui::DisplayPropertiesItem::getSelectedColor ( ) const
inline

Returns currently selected color.

bool walberla::gui::DisplayPropertiesItem::isEnabled ( ) const

True if checkbox before text is selected.

void walberla::gui::DisplayPropertiesItem::optionChanged ( )
signal

Called whenever a option has changed (combobox, color, colormap)

void walberla::gui::DisplayPropertiesItem::setColor ( QColor  c)

Sets the display color.

void walberla::gui::DisplayPropertiesItem::showColorSelect ( )
protectedvirtual
void walberla::gui::DisplayPropertiesItem::showContextMenu ( QPoint  globalPos)
virtual
void walberla::gui::DisplayPropertiesItem::showGradientSelect ( )
protectedvirtual
void walberla::gui::DisplayPropertiesItem::updateColormapFromGradient ( )
protected

Member Data Documentation

QImage walberla::gui::DisplayPropertiesItem::colorMap_
protected
QLinearGradient walberla::gui::DisplayPropertiesItem::colorMapGradient_
protected
bool walberla::gui::DisplayPropertiesItem::colorSelectEnabled_
protected
QColor walberla::gui::DisplayPropertiesItem::dispColor_
protected
bool walberla::gui::DisplayPropertiesItem::gradientSelectEnabled_
protected

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