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 @@
#include <cmath>
#include <string>
#include "core/common/WLogger.h"
#include "core/common/WPropertyVariable.h"
#include "../WGuiConsts.h"
......@@ -71,6 +70,12 @@ WPropertyStringWidget::~WPropertyStringWidget()
// 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()
{
QString val = QString::fromStdString( m_stringProperty->get() );
......
......@@ -55,6 +55,13 @@ public:
*/
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:
/**
* Called whenever the widget should update.
......
......@@ -137,6 +137,17 @@ WPropertyWidget::~WPropertyWidget()
m_connection.disconnect();
}
void WPropertyWidget::forceInformationMode( bool force )
{
if( !force && ( m_property->getPurpose() != PV_PURPOSE_INFORMATION ) )
{
setCurrentIndex( 0 );
return;
}
setCurrentIndex( 1 );
}
void WPropertyWidget::requestUpdate()
{
QCoreApplication::postEvent( this, new WPropertyChangedEvent() );
......
......@@ -113,6 +113,12 @@ public:
*/
virtual void requestUpdate();
/**
* Force the widget to use the information widgets.
*
* \param force true to force
*/
void forceInformationMode( bool force = true );
protected:
/**
* Called whenever the widget should update itself.
......
......@@ -153,6 +153,8 @@ WQtColormapper::WQtTextureListItem::WQtTextureListItem( const osg::ref_ptr< WGET
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->forceInformationMode();
nameLabel->disableTextInteraction();
labelContainerLayout->addWidget( nameLabel );
......
......@@ -35,6 +35,7 @@
#include "../WQt4Gui.h"
#include "../WMainWindow.h"
#include "WPropertyBoolWidget.h"
#include "WPropertyStringWidget.h"
#include "WTreeItemTypes.h"
#include "WQtRoiTreeItem.h"
......@@ -60,9 +61,11 @@ WQtRoiTreeItem::WQtRoiTreeItem( QTreeWidgetItem * parent, osg::ref_ptr< WROI > r
propertyContainer->setLayout( propertyContainerLayout );
propertyContainer->setObjectName( "propertyContainer" );
WScaleLabel* l = new WScaleLabel( QString::fromStdString( roi->nameProperty()->get() ), 5, labelContainer );
l->setTextInteractionFlags( Qt::NoTextInteraction );
l->setToolTip( "The name of this ROI." );
// name
WPropertyStringWidget* name = new WPropertyStringWidget( roi->nameProperty(), NULL, m_itemWidget );
name->setToolTip( "The name of this ROI." );
name->forceInformationMode();
name->disableTextInteraction();
// inverse
WPropertyBoolWidget* isnot = new WPropertyBoolWidget( roi->invertProperty(), NULL, m_itemWidget );
......@@ -91,7 +94,7 @@ WQtRoiTreeItem::WQtRoiTreeItem( QTreeWidgetItem * parent, osg::ref_ptr< WROI > r
// property color
QColor propertyCol = defaultCol;
l->setStyleSheet( "background-color:" + labelCol.name() + ";" );
//name->setStyleSheet( "background-color:" + labelCol.name() + ";border:none;" );
labelContainer->setStyleSheet( "background-color:" + labelCol.name() + ";" );
propertyContainer->setStyleSheet( "QWidget#propertyContainer{ background-color:" + propertyCol.name() + ";}" );
......@@ -100,8 +103,8 @@ WQtRoiTreeItem::WQtRoiTreeItem( QTreeWidgetItem * parent, osg::ref_ptr< WROI > r
propertyContainerLayout->addWidget( show );
labelContainerLayout->addWidget( active );
labelContainerLayout->addWidget( l );
labelContainerLayout->setStretchFactor( l, 100 );
labelContainerLayout->addWidget( name );
labelContainerLayout->setStretchFactor( name, 100 );
labelContainerLayout->setStretchFactor( active, 0 );
// 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