29 #include <QApplication>
30 #include <QListWidgetItem>
31 #include <QScrollArea>
32 #include <QVBoxLayout>
33 #include <QWidgetAction>
34 #include <QtCore/QList>
36 #include "../WMainWindow.h"
37 #include "../WQtGui.h"
38 #include "../guiElements/WScaleLabel.h"
39 #include "WPropertyBoolWidget.h"
40 #include "WPropertyColorWidget.h"
41 #include "WPropertyDoubleWidget.h"
42 #include "WQtBranchTreeItem.h"
43 #include "WQtPropertyGroupWidget.h"
44 #include "WQtRoiTreeItem.h"
45 #include "WTreeItemTypes.h"
51 setFlags( Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled );
55 QHBoxLayout* containerLayout =
new QHBoxLayout();
60 QHBoxLayout* labelContainerLayout =
new QHBoxLayout();
61 labelContainer->setLayout( labelContainerLayout );
63 QWidget* propertyContainer =
new QWidget(
m_itemWidget );
64 QHBoxLayout* propertyContainerLayout =
new QHBoxLayout();
65 propertyContainer->setLayout( propertyContainerLayout );
66 propertyContainer->setObjectName(
"propertyContainer" );
71 name->setToolTip(
"The name of this branch." );
72 labelContainerLayout->addWidget( name );
76 color->setToolTip( QString::fromStdString( branch->colorProperty()->getDescription() ) );
81 isnot->setToolTip( QString::fromStdString( branch->invertProperty()->getDescription() ) );
84 grabWidget->setPixmap(
WQtGui::getMainWindow()->getIconManager()->getIcon(
"touchpoint_small" ).pixmap( 24, 32 ) );
85 grabWidget->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
86 grabWidget->setFixedWidth( 24 );
87 grabWidget->setToolTip(
"Drag and drop these textures to change their composition ordering." );
91 QColor defaultCol = palette.window().color();
94 QColor labelCol = defaultCol.darker( 150 );
96 QColor propertyCol = defaultCol;
98 name->setStyleSheet(
"background-color:" + labelCol.name() +
";" );
99 labelContainer->setStyleSheet(
"background-color:" + labelCol.name() +
";" );
100 propertyContainer->setStyleSheet(
"QWidget#propertyContainer{ background-color:" + propertyCol.name() +
";}" );
102 propertyContainerLayout->addWidget( isnot );
103 propertyContainerLayout->addWidget( color );
106 containerLayout->addWidget( grabWidget );
107 containerLayout->addWidget( labelContainer );
108 containerLayout->addWidget( propertyContainer );
111 containerLayout->setContentsMargins( 0, 2, 0, 2 );
112 containerLayout->setSpacing( 0 );
113 labelContainerLayout->setContentsMargins( 5, 2, 0, 2 );
114 labelContainerLayout->setSpacing( 0 );
115 propertyContainerLayout->setContentsMargins( 2, 2, 0, 2 );
116 propertyContainerLayout->setSpacing( 0 );
119 containerLayout->setStretchFactor( grabWidget, 0 );
120 containerLayout->setStretchFactor( labelContainer, 100 );
121 containerLayout->setStretchFactor( propertyContainer, 0 );
124 m_itemWidget->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
158 explicit RoiSort( std::map< WROI::RefPtr, int > indexMap ):
185 std::map< WROI::RefPtr, int > indexMap;
187 for(
int i = 0; i < childCount(); ++i )
190 WAssert( rti,
"All children of a branch item need to be ROI items." );
191 indexMap[ rti->
getRoi() ] = i;
Simple comparator class for sorting ROIs in the Roi Manager.
RoiSort(std::map< WROI::RefPtr, int > indexMap)
COnstructor.
bool operator()(WROI::RefPtr a, WROI::RefPtr b)
Operator to compare the order of two ROIs.
std::map< WROI::RefPtr, int > m_indexMap
Map needed to know the index in the GUI representation.
WQtBranchTreeItem(QTreeWidgetItem *parent, std::shared_ptr< WRMBranch > branch)
default constructor
WQtRoiTreeItem * addRoiItem(osg::ref_ptr< WROI >)
Add a ROI to the tree view.
std::shared_ptr< WRMBranch > m_branch
ROI.
std::shared_ptr< WRMBranch > getBranch()
getter
QWidget * getWidget() const
Create a representation widget for this item.
virtual ~WQtBranchTreeItem()
destructor
void updateRoiManagerSorting()
Update internal Roi Manager sorting using the sorting of the children of this tree item.
QWidget * m_itemWidget
Widget representing the item.
static WMainWindow * getMainWindow()
Returns the current main window instance or NULL if not existent.
A tree widget item to represent a ROI in the control panel.
osg::ref_ptr< WROI > getRoi()
Getter.
osg::ref_ptr< WROI > RefPtr
Ref Pointer type.