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

◆ DisplayPropertiesItem()

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

◆ ~DisplayPropertiesItem()

virtual walberla::gui::DisplayPropertiesItem::~DisplayPropertiesItem ( )
inlinevirtual

Member Function Documentation

◆ colormapSelected

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

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

◆ colorSelected

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

Called when user selected a new color.

◆ comboBoxSelectionChanged

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

Called when a new combobox item was selected.

◆ enableColorSelect()

void walberla::gui::DisplayPropertiesItem::enableColorSelect ( bool  enable = true)
inline

◆ enableGradientSelect()

void walberla::gui::DisplayPropertiesItem::enableGradientSelect ( bool  enable = true)
inline

◆ getColorFromColormap()

QColor walberla::gui::DisplayPropertiesItem::getColorFromColormap ( double  value)

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

◆ getComboBoxSelection()

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

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

◆ getSelectedColor()

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

Returns currently selected color.

◆ isEnabled()

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

True if checkbox before text is selected.

◆ optionChanged

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

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

◆ setColor()

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

Sets the display color.

◆ showColorSelect()

void walberla::gui::DisplayPropertiesItem::showColorSelect ( )
protectedvirtual

◆ showContextMenu()

void walberla::gui::DisplayPropertiesItem::showContextMenu ( QPoint  globalPos)
virtual

◆ showGradientSelect()

void walberla::gui::DisplayPropertiesItem::showGradientSelect ( )
protectedvirtual

◆ updateColormapFromGradient()

void walberla::gui::DisplayPropertiesItem::updateColormapFromGradient ( )
protected

Member Data Documentation

◆ colorMap_

QImage walberla::gui::DisplayPropertiesItem::colorMap_
protected

◆ colorMapGradient_

QLinearGradient walberla::gui::DisplayPropertiesItem::colorMapGradient_
protected

◆ colorSelectEnabled_

bool walberla::gui::DisplayPropertiesItem::colorSelectEnabled_
protected

◆ dispColor_

QColor walberla::gui::DisplayPropertiesItem::dispColor_
protected

◆ gradientSelectEnabled_

bool walberla::gui::DisplayPropertiesItem::gradientSelectEnabled_
protected

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