#include <QmitkColorPropertyEditor.h>
Public Member Functions | |
QmitkColorPropertyEditor (const mitk::ColorProperty *, QWidget *parent) | |
virtual | ~QmitkColorPropertyEditor () |
Protected Slots | |
void | onColorSelected (QColor) |
Protected Member Functions | |
virtual void | mousePressEvent (QMouseEvent *) |
virtual void | mouseReleaseEvent (QMouseEvent *) |
Static Protected Attributes | |
static QmitkPopupColorChooser * | colorChooser = NULL |
static int | colorChooserRefCount = 0 |
Definition at line 74 of file QmitkColorPropertyEditor.h.
QmitkColorPropertyEditor::QmitkColorPropertyEditor | ( | const mitk::ColorProperty * | property, |
QWidget * | parent | ||
) |
Definition at line 247 of file QmitkColorPropertyEditor.cpp.
References colorChooser, and colorChooserRefCount.
: QmitkColorPropertyView( property, parent ) { // our popup belongs to the whole screen, so it could be drawn outside the toplevel window's borders int scr; if ( QApplication::desktop()->isVirtualDesktop() ) scr = QApplication::desktop()->screenNumber( parent->mapToGlobal( pos() ) ); else scr = QApplication::desktop()->screenNumber( parent ); if ( colorChooserRefCount == 0 ) { colorChooser = new QmitkPopupColorChooser( QApplication::desktop()->screen( scr ), 50 ); } ++colorChooserRefCount; }
QmitkColorPropertyEditor::~QmitkColorPropertyEditor | ( | ) | [virtual] |
Definition at line 264 of file QmitkColorPropertyEditor.cpp.
References colorChooser, and colorChooserRefCount.
{ --colorChooserRefCount; if (!colorChooserRefCount) { delete colorChooser; colorChooser = NULL; } }
void QmitkColorPropertyEditor::mousePressEvent | ( | QMouseEvent * | e ) | [protected, virtual] |
Definition at line 274 of file QmitkColorPropertyEditor.cpp.
References colorChooser, mitk::ColorProperty::GetColor(), QmitkColorPropertyView::m_ColorProperty, onColorSelected(), and QmitkPopupColorChooser::popup().
{ connect( colorChooser, SIGNAL(colorSelected(QColor)), this, SLOT(onColorSelected(QColor)) ); if (m_ColorProperty) { colorChooser->popup( this, e->pos(), &(m_ColorProperty->GetColor()) ); } }
void QmitkColorPropertyEditor::mouseReleaseEvent | ( | QMouseEvent * | ) | [protected, virtual] |
Definition at line 283 of file QmitkColorPropertyEditor.cpp.
References colorChooser, and onColorSelected().
{ disconnect( colorChooser, SIGNAL(colorSelected(QColor)), this, SLOT(onColorSelected(QColor)) ); }
void QmitkColorPropertyEditor::onColorSelected | ( | QColor | c ) | [protected, slot] |
Definition at line 288 of file QmitkColorPropertyEditor.cpp.
References mitk::RenderingManager::GetInstance(), and QmitkColorPropertyView::m_ColorProperty.
Referenced by mousePressEvent(), and mouseReleaseEvent().
{ if (m_ColorProperty) { int r,g,b; c.getRgb( &r, &g, &b ); const_cast<mitk::ColorProperty*>(m_ColorProperty)->SetColor( r / 255.0, g / 255.0, b / 255.0 ); const_cast<mitk::ColorProperty*>(m_ColorProperty)->Modified(); mitk::RenderingManager::GetInstance()->RequestUpdateAll(); } }
QmitkPopupColorChooser * QmitkColorPropertyEditor::colorChooser = NULL [static, protected] |
Definition at line 88 of file QmitkColorPropertyEditor.h.
Referenced by mousePressEvent(), mouseReleaseEvent(), QmitkColorPropertyEditor(), and ~QmitkColorPropertyEditor().
int QmitkColorPropertyEditor::colorChooserRefCount = 0 [static, protected] |
Definition at line 89 of file QmitkColorPropertyEditor.h.
Referenced by QmitkColorPropertyEditor(), and ~QmitkColorPropertyEditor().