Commit d522004e authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE #263] ROI and colormap items now follow the name property.

parent b568e138
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <cmath> #include <cmath>
#include <string> #include <string>
#include "core/common/WLogger.h" #include "core/common/WLogger.h"
#include "core/common/WPropertyVariable.h" #include "core/common/WPropertyVariable.h"
#include "../WGuiConsts.h" #include "../WGuiConsts.h"
...@@ -71,6 +70,12 @@ WPropertyStringWidget::~WPropertyStringWidget() ...@@ -71,6 +70,12 @@ WPropertyStringWidget::~WPropertyStringWidget()
// cleanup // cleanup
} }
void WPropertyStringWidget::disableTextInteraction( bool disable )
{
// To have word warp work correctly -> set size policy
m_asText.setTextInteractionFlags( disable ? Qt::NoTextInteraction : Qt::TextSelectableByMouse );
}
void WPropertyStringWidget::update() void WPropertyStringWidget::update()
{ {
QString val = QString::fromStdString( m_stringProperty->get() ); QString val = QString::fromStdString( m_stringProperty->get() );
......
...@@ -55,6 +55,13 @@ public: ...@@ -55,6 +55,13 @@ public:
*/ */
virtual ~WPropertyStringWidget(); virtual ~WPropertyStringWidget();
/**
* Disable the ability to select text. This is only applicable if in information mode.
*
* \param disable true to disable.
*/
void disableTextInteraction( bool disable = true );
protected: protected:
/** /**
* Called whenever the widget should update. * Called whenever the widget should update.
......
...@@ -137,6 +137,17 @@ WPropertyWidget::~WPropertyWidget() ...@@ -137,6 +137,17 @@ WPropertyWidget::~WPropertyWidget()
m_connection.disconnect(); m_connection.disconnect();
} }
void WPropertyWidget::forceInformationMode( bool force )
{
if( !force && ( m_property->getPurpose() != PV_PURPOSE_INFORMATION ) )
{
setCurrentIndex( 0 );
return;
}
setCurrentIndex( 1 );
}
void WPropertyWidget::requestUpdate() void WPropertyWidget::requestUpdate()
{ {
QCoreApplication::postEvent( this, new WPropertyChangedEvent() ); QCoreApplication::postEvent( this, new WPropertyChangedEvent() );
......
...@@ -113,6 +113,12 @@ public: ...@@ -113,6 +113,12 @@ public:
*/ */
virtual void requestUpdate(); virtual void requestUpdate();
/**
* Force the widget to use the information widgets.
*
* \param force true to force
*/
void forceInformationMode( bool force = true );
protected: protected:
/** /**
* Called whenever the widget should update itself. * Called whenever the widget should update itself.
......
...@@ -153,6 +153,8 @@ WQtColormapper::WQtTextureListItem::WQtTextureListItem( const osg::ref_ptr< WGET ...@@ -153,6 +153,8 @@ WQtColormapper::WQtTextureListItem::WQtTextureListItem( const osg::ref_ptr< WGET
WPropertyStringWidget* nameLabel = new WPropertyStringWidget( m_texture->name(), NULL, m_itemWidget ); WPropertyStringWidget* nameLabel = new WPropertyStringWidget( m_texture->name(), NULL, m_itemWidget );
nameLabel->setToolTip( "The name of this texture. This usually is the name of the file it was loaded from." ); nameLabel->setToolTip( "The name of this texture. This usually is the name of the file it was loaded from." );
nameLabel->forceInformationMode();
nameLabel->disableTextInteraction();
labelContainerLayout->addWidget( nameLabel ); labelContainerLayout->addWidget( nameLabel );
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "../WQt4Gui.h" #include "../WQt4Gui.h"
#include "../WMainWindow.h" #include "../WMainWindow.h"
#include "WPropertyBoolWidget.h" #include "WPropertyBoolWidget.h"
#include "WPropertyStringWidget.h"
#include "WTreeItemTypes.h" #include "WTreeItemTypes.h"
#include "WQtRoiTreeItem.h" #include "WQtRoiTreeItem.h"
...@@ -60,9 +61,11 @@ WQtRoiTreeItem::WQtRoiTreeItem( QTreeWidgetItem * parent, osg::ref_ptr< WROI > r ...@@ -60,9 +61,11 @@ WQtRoiTreeItem::WQtRoiTreeItem( QTreeWidgetItem * parent, osg::ref_ptr< WROI > r
propertyContainer->setLayout( propertyContainerLayout ); propertyContainer->setLayout( propertyContainerLayout );
propertyContainer->setObjectName( "propertyContainer" ); propertyContainer->setObjectName( "propertyContainer" );
WScaleLabel* l = new WScaleLabel( QString::fromStdString( roi->nameProperty()->get() ), 5, labelContainer ); // name
l->setTextInteractionFlags( Qt::NoTextInteraction ); WPropertyStringWidget* name = new WPropertyStringWidget( roi->nameProperty(), NULL, m_itemWidget );
l->setToolTip( "The name of this ROI." ); name->setToolTip( "The name of this ROI." );
name->forceInformationMode();
name->disableTextInteraction();
// inverse // inverse
WPropertyBoolWidget* isnot = new WPropertyBoolWidget( roi->invertProperty(), NULL, m_itemWidget ); WPropertyBoolWidget* isnot = new WPropertyBoolWidget( roi->invertProperty(), NULL, m_itemWidget );
...@@ -91,7 +94,7 @@ WQtRoiTreeItem::WQtRoiTreeItem( QTreeWidgetItem * parent, osg::ref_ptr< WROI > r ...@@ -91,7 +94,7 @@ WQtRoiTreeItem::WQtRoiTreeItem( QTreeWidgetItem * parent, osg::ref_ptr< WROI > r
// property color // property color
QColor propertyCol = defaultCol; QColor propertyCol = defaultCol;
l->setStyleSheet( "background-color:" + labelCol.name() + ";" ); //name->setStyleSheet( "background-color:" + labelCol.name() + ";border:none;" );
labelContainer->setStyleSheet( "background-color:" + labelCol.name() + ";" ); labelContainer->setStyleSheet( "background-color:" + labelCol.name() + ";" );
propertyContainer->setStyleSheet( "QWidget#propertyContainer{ background-color:" + propertyCol.name() + ";}" ); propertyContainer->setStyleSheet( "QWidget#propertyContainer{ background-color:" + propertyCol.name() + ";}" );
...@@ -100,8 +103,8 @@ WQtRoiTreeItem::WQtRoiTreeItem( QTreeWidgetItem * parent, osg::ref_ptr< WROI > r ...@@ -100,8 +103,8 @@ WQtRoiTreeItem::WQtRoiTreeItem( QTreeWidgetItem * parent, osg::ref_ptr< WROI > r
propertyContainerLayout->addWidget( show ); propertyContainerLayout->addWidget( show );
labelContainerLayout->addWidget( active ); labelContainerLayout->addWidget( active );
labelContainerLayout->addWidget( l ); labelContainerLayout->addWidget( name );
labelContainerLayout->setStretchFactor( l, 100 ); labelContainerLayout->setStretchFactor( name, 100 );
labelContainerLayout->setStretchFactor( active, 0 ); labelContainerLayout->setStretchFactor( active, 0 );
// fill layout // fill layout
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment