// ---
connect( myTypeGroup, SIGNAL( buttonClicked( int ) ), myWGStack, SLOT( setCurrentIndex( int ) ) );
- connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( browse() ) );
+ connect( myStdTypeCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onStdMarkerChanged( int ) ) );
+ connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( onBrowse() ) );
// ---
void VTKViewer_MarkerWidget::setStandardMarker( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
{
- if ( theMarkerType > VTK::MT_NONE && theMarkerType < VTK::MT_USER ) {
+ if ( theMarkerType > VTK::MT_NONE && theMarkerType < VTK::MT_USER ||
+ myExtraMarkerList.contains( theMarkerType ) ) {
myTypeGroup->button( 0 )->setChecked( true );
myWGStack->setCurrentIndex( 0 );
- myStdTypeCombo->setCurrentIndex( (int)theMarkerType-1 );
+ myStdTypeCombo->setCurrentId( theMarkerType );
int aMarkerScale = std::max( (int)VTK::MS_10, std::min( (int)VTK::MS_70, (int)theMarkerScale ) );
- myStdScaleCombo->setCurrentIndex( aMarkerScale-1 );
+ myStdScaleCombo->setCurrentId( aMarkerScale );
}
}
return myWGStack->currentIndex() == 1 ? myCustomTypeCombo->currentId() : 0;
}
+void VTKViewer_MarkerWidget::addExtraStdMarker( VTK::MarkerType theMarkerType, const QPixmap& thePixmap )
+{
+ if( myExtraMarkerList.isEmpty() )
+ myStdTypeCombo->insertSeparator( myStdTypeCombo->count() );
+ myStdTypeCombo->addItem( thePixmap, QString() );
+ myStdTypeCombo->setId( myStdTypeCombo->count()-1, theMarkerType );
+
+ myExtraMarkerList.append( theMarkerType );
+}
+
void VTKViewer_MarkerWidget::init()
{
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
return QPixmap::fromImage( anImage );
}
-void VTKViewer_MarkerWidget::browse()
+void VTKViewer_MarkerWidget::onStdMarkerChanged( int index )
+{
+ VTK::MarkerType aMarkerType = (VTK::MarkerType)myStdTypeCombo->id( index );
+ bool anIsExtraMarker = myExtraMarkerList.contains( aMarkerType );
+ myStdScaleCombo->setEnabled( !anIsExtraMarker );
+}
+
+void VTKViewer_MarkerWidget::onBrowse()
{
QStringList filters;
filters << tr( "Texture files (*.dat)" ) << tr( "All files (*)" );
VTK::MarkerScale getStandardMarkerScale() const;
int getCustomMarkerID() const;
+ void addExtraStdMarker( VTK::MarkerType, const QPixmap& );
+
private:
void init();
void addTexture( int, bool = false );
QPixmap markerFromData( const VTK::MarkerData& );
private slots:
- void browse();
+ void onStdMarkerChanged( int );
+ void onBrowse();
private:
QButtonGroup* myTypeGroup;
QtxComboBox* myCustomTypeCombo;
VTK::MarkerMap myCustomMarkerMap;
+
+ QList<VTK::MarkerType> myExtraMarkerList;
};
#endif