1 // Copyright (C) 2003 CEA/DEN, EDF R&D
5 // File : VisuGUI_SetupPlot2dDlg.cxx
6 // Author : Vadim SANDLER
10 #include "VisuGUI_SetupPlot2dDlg.h"
12 #include "SPlot2d_Curve.h"
14 #include "SUIT_Tools.h"
15 #include "SUIT_MessageBox.h"
16 #include "SUIT_ResourceMgr.h"
17 #include "SUIT_Session.h"
19 #include "LightApp_Application.h"
21 #include <SALOMEDSClient_AttributeTableOfInteger.hxx>
22 #include <SALOMEDSClient_AttributeTableOfReal.hxx>
25 #include <qpushbutton.h>
26 #include <qcheckbox.h>
27 #include <qtoolbutton.h>
28 #include <qcombobox.h>
29 #include <qscrollview.h>
31 #include <qcolordialog.h>
37 #include "utilities.h"
41 #define DLG_SIZE_WIDTH 500
42 #define DLG_SIZE_HEIGHT 400
43 #define MAX_LINE_WIDTH 100
44 #define MARGIN_SIZE 11
45 #define SPACING_SIZE 6
50 VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* parent )
52 "VisuGUI_SetupPlot2dDlg",
54 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
56 setCaption( tr("TLT_SETUP_PLOT2D") );
57 setSizeGripEnabled( TRUE );
58 QGridLayout* topLayout = new QGridLayout( this );
59 topLayout->setSpacing( SPACING_SIZE );
60 topLayout->setMargin( MARGIN_SIZE );
62 myItems.setAutoDelete( false );
67 myView = new QScrollView( this );
68 QFrame* frame = new QFrame( myView );
69 frame->setFrameStyle( QFrame::Plain | QFrame::NoFrame );
70 QGridLayout* frameLayout = new QGridLayout( frame, 1, 12 );
71 frameLayout->setMargin( MARGIN_SIZE ); frameLayout->setSpacing( SPACING_SIZE );
75 QLabel* labAxis = new QLabel( tr( "AXIS_LBL" ), frame );
76 QLabel* labData = new QLabel( tr( "DATA_LBL" ), frame );
77 QLabel* labUnit = new QLabel( tr( "UNITS_LBL" ), frame );
78 QLabel* labAttr = new QLabel( tr( "ATTRIBUTES_LBL" ), frame );
79 labAxis->setAlignment( AlignCenter );
80 labData->setAlignment( AlignCenter );
81 labUnit->setAlignment( AlignCenter );
82 labAttr->setAlignment( AlignCenter );
83 QFont font = labAxis->font(); font.setBold( true );
84 labAxis->setFont( font );
85 labData->setFont( font );
86 labUnit->setFont( font );
87 labAttr->setFont( font );
89 frameLayout->addMultiCellWidget( labAxis, 0, 0, 0, 1 );
90 lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
91 frameLayout->addWidget( lin, 0, 2 );
92 frameLayout->addWidget( labData, 0, 3 );
93 lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
94 frameLayout->addWidget( lin, 0, 4 );
95 frameLayout->addWidget( labUnit, 0, 5 );
96 lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
97 frameLayout->addWidget( lin, 0, 6 );
98 frameLayout->addMultiCellWidget( labAttr, 0, 0, 7, 11 );
99 frameLayout->setColStretch( 12, 5 );
100 lin = new QFrame( frame ); lin->setFrameStyle( QFrame::HLine | QFrame::Sunken );
101 frameLayout->addMultiCellWidget( lin, 1, 1, 0, 12 );
104 _PTR(GenericAttribute) anAttr;
105 _PTR(AttributeTableOfInteger) tblIntAttr;
106 _PTR(AttributeTableOfReal) tblRealAttr;
108 /* Try table of integer */
109 if ( myObject->FindAttribute( anAttr, "AttributeTableOfInteger" ) ) {
113 int nbRows = tblIntAttr->GetNbRows() ;
114 vector<string> rowTitles = tblIntAttr->GetRowTitles();
115 vector<string> rowUnits = tblIntAttr->GetRowUnits();
116 for ( int i = 0; i < nbRows; i++ ) {
117 VisuGUI_ItemContainer* item = new VisuGUI_ItemContainer( this );
118 item->createWidgets( frame );
119 frameLayout->addWidget( item->myHBtn, row, 0 );
120 frameLayout->addWidget( item->myVBtn, row, 1 );
121 frameLayout->addWidget( item->myTitleLab, row, 3 );
122 if ( rowTitles.size() > 0 )
123 item->myTitleLab->setText( QString( rowTitles[ i ].c_str() ) );
124 frameLayout->addWidget( item->myUnitLab, row, 5 );
125 if ( rowUnits.size() > 0 )
126 item->myUnitLab->setText( QString( rowUnits[ i ].c_str() ) );
127 frameLayout->addWidget( item->myAutoCheck, row, 7 );
128 frameLayout->addWidget( item->myLineCombo, row, 8 );
129 frameLayout->addWidget( item->myLineSpin, row, 9 );
130 frameLayout->addWidget( item->myMarkerCombo, row, 10 );
131 frameLayout->addWidget( item->myColorBtn, row, 11 );
132 connect( item, SIGNAL( horToggled( bool ) ), this, SLOT( onHBtnToggled( bool ) ) );
133 connect( item, SIGNAL( verToggled( bool ) ), this, SLOT( onVBtnToggled( bool ) ) );
134 myItems.append( item );
139 MESSAGE("VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg : Exception has been caught (int)!!!");
143 /* Try table of real */
144 else if ( myObject->FindAttribute( anAttr, "AttributeTableOfReal" ) ) {
145 tblRealAttr = anAttr;
148 int nbRows = tblRealAttr->GetNbRows() ;
149 vector<string> rowTitles = tblRealAttr->GetRowTitles();
150 vector<string> rowUnits = tblRealAttr->GetRowUnits();
151 for ( int i = 0; i < nbRows; i++ ) {
152 VisuGUI_ItemContainer* item = new VisuGUI_ItemContainer( this );
153 item->createWidgets( frame );
154 frameLayout->addWidget( item->myHBtn, row, 0 );
155 frameLayout->addWidget( item->myVBtn, row, 1 );
156 frameLayout->addWidget( item->myTitleLab, row, 3 );
157 if ( rowTitles.size() > 0 )
158 item->myTitleLab->setText( QString( rowTitles[ i ].c_str() ) );
159 frameLayout->addWidget( item->myUnitLab, row, 5 );
160 if ( rowUnits.size() > 0 )
161 item->myUnitLab->setText( QString( rowUnits[ i ].c_str() ) );
162 frameLayout->addWidget( item->myAutoCheck, row, 7 );
163 frameLayout->addWidget( item->myLineCombo, row, 8 );
164 frameLayout->addWidget( item->myLineSpin, row, 9 );
165 frameLayout->addWidget( item->myMarkerCombo, row, 10 );
166 frameLayout->addWidget( item->myColorBtn, row, 11 );
167 connect( item, SIGNAL( horToggled( bool ) ), this, SLOT( onHBtnToggled( bool ) ) );
168 connect( item, SIGNAL( verToggled( bool ) ), this, SLOT( onVBtnToggled( bool ) ) );
169 myItems.append( item );
174 MESSAGE("VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg : Exception has been caught (real)!!!");
178 lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
179 frameLayout->addMultiCellWidget( lin, 2, row+1, 2, 2 );
180 lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
181 frameLayout->addMultiCellWidget( lin, 2, row+1, 4, 4 );
182 lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
183 frameLayout->addMultiCellWidget( lin, 2, row+1, 6, 6 );
184 frameLayout->setRowStretch( row+1, 5 );
186 myView->addChild( frame, 0, 0 );
187 myView->setResizePolicy( QScrollView::AutoOneFit );
189 myView->setMinimumWidth( frame->sizeHint().width() + MARGIN_SIZE * 2 );
191 /* OK/Cancel/Help buttons */
192 myOkBtn = new QPushButton( tr( "BUT_OK" ), this, "buttonOk" );
193 myOkBtn->setAutoDefault( TRUE );
194 myOkBtn->setDefault( TRUE );
195 myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this, "buttonCancel" );
196 myCancelBtn->setAutoDefault( TRUE );
197 myHelpBtn = new QPushButton( tr( "BUT_HELP" ), this, "buttonHelp" );
198 myHelpBtn->setAutoDefault( TRUE );
200 topLayout->addMultiCellWidget( myView, 0, 0, 0, 3 );
201 topLayout->addWidget( myOkBtn, 1, 0 );
202 topLayout->setColStretch( 1, 5 );
203 topLayout->addWidget( myCancelBtn, 1, 2 );
204 topLayout->addWidget( myHelpBtn, 1, 3 );
206 connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
207 connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
208 connect( myHelpBtn, SIGNAL( clicked() ), this, SLOT( onHelp() ) );
212 /* Center widget inside it's parent widget */
213 resize( DLG_SIZE_WIDTH, DLG_SIZE_HEIGHT );
214 SUIT_Tools::centerWidget( this, parentWidget() );
219 VisuGUI_SetupPlot2dDlg::~VisuGUI_SetupPlot2dDlg()
223 Gets curves info ( indexes of row data in the table for horizontal and verical axes )
225 void VisuGUI_SetupPlot2dDlg::getCurvesSource( int& horIndex, QValueList<int>& verIndexes )
227 /* collecting horizontal and vertical axis items */
230 for ( i = 0; i < myItems.count(); i++ ) {
231 if ( myItems.at( i )->isHorizontalOn() ) {
234 else if ( myItems.at( i )->isVerticalOn() ) {
235 verIndexes.append( i );
240 Gets curve attributes
242 bool VisuGUI_SetupPlot2dDlg::getCurveAttributes( const int vIndex,
249 if ( vIndex >= 0 && vIndex < myItems.count() ) {
250 isAuto = myItems.at( vIndex )->isAutoAssign();
251 marker = myItems.at( vIndex )->getMarker();
252 line = myItems.at( vIndex )->getLine();
253 lineWidth = myItems.at( vIndex )->getLineWidth();
254 color = myItems.at( vIndex )->getColor();
260 Creates and returns curves presentations
262 void VisuGUI_SetupPlot2dDlg::getCurves( QPtrList<Plot2d_Curve>& container )
264 _PTR(GenericAttribute) anAttr;
265 _PTR(AttributeTableOfInteger) tblIntAttr;
266 _PTR(AttributeTableOfReal) tblRealAttr;
268 /* clearing container contents */
271 /* collecting horizontal and vertical axis items */
274 QValueList<int> verIndex;
275 getCurvesSource( horIndex, verIndex );
276 if ( horIndex < 0 || verIndex.isEmpty() ) /* no curves can be created */
279 /* Try table of integer */
280 if ( myObject->FindAttribute( anAttr, "AttributeTableOfInteger" ) ) {
284 int nbCols = tblIntAttr->GetNbColumns() ;
285 vector<string> rowTitles = tblIntAttr->GetRowTitles();
286 vector<string> rowUnits = tblIntAttr->GetRowUnits();
288 for ( i = 0; i < verIndex.count(); i++ ) {
289 SPlot2d_Curve* curve = new SPlot2d_Curve();
291 if ( rowTitles.size() > 0 ) {
292 curve->setHorTitle( QString( rowTitles[ horIndex ].c_str() ) );
293 curve->setVerTitle( QString( rowTitles[ verIndex[i] ].c_str() ) );
296 if ( rowUnits.size() > 0 ) {
297 curve->setHorUnits( QString( rowUnits[ horIndex ].c_str() ) );
298 curve->setVerUnits( QString( rowUnits[ verIndex[i] ].c_str() ) );
302 for ( j = 1; j <= nbCols; j++ ) {
303 if ( tblIntAttr->HasValue( horIndex+1, j ) && tblIntAttr->HasValue( verIndex[i]+1, j ) )
306 if ( nbPoints > 0 ) {
307 double* xList = new double[ nbPoints ];
308 double* yList = new double[ nbPoints ];
309 for ( j = 1; j <= nbCols; j++ ) {
310 if ( tblIntAttr->HasValue( horIndex+1, j ) && tblIntAttr->HasValue( verIndex[i]+1, j ) ) {
311 xList[j-1] = tblIntAttr->GetValue( horIndex +1, j );
312 yList[j-1] = tblIntAttr->GetValue( verIndex[i]+1, j );
315 curve->setData( xList, yList, nbPoints );
318 curve->setLine( (Plot2d_Curve::LineType)myItems.at( verIndex[i] )->getLine(), myItems.at( verIndex[i] )->getLineWidth() );
319 curve->setMarker( (Plot2d_Curve::MarkerType)myItems.at( verIndex[i] )->getMarker() );
320 curve->setColor( myItems.at( verIndex[i] )->getColor() );
321 curve->setAutoAssign( myItems.at( verIndex[i] )->isAutoAssign() );
322 // add curve into container
323 container.append( curve );
327 MESSAGE("VisuGUI_SetupPlot2dDlg::getCurves : Exception has been caught (int)!!!");
331 /* Try table of real */
332 else if ( myObject->FindAttribute( anAttr, "AttributeTableOfReal" ) ) {
333 tblRealAttr = anAttr;
336 int nbCols = tblRealAttr->GetNbColumns() ;
337 vector<string> rowTitles = tblRealAttr->GetRowTitles();
338 vector<string> rowUnits = tblRealAttr->GetRowUnits();
340 for ( i = 0; i < verIndex.count(); i++ ) {
341 SPlot2d_Curve* curve = new SPlot2d_Curve();
343 if ( rowTitles.size() > 0 ) {
344 curve->setHorTitle( QString( rowTitles[ horIndex ].c_str() ) );
345 curve->setVerTitle( QString( rowTitles[ verIndex[i] ].c_str() ) );
348 if ( rowUnits.size() > 0 ) {
349 curve->setHorUnits( QString( rowUnits[ horIndex ].c_str() ) );
350 curve->setVerUnits( QString( rowUnits[ verIndex[i] ].c_str() ) );
354 for ( j = 1; j <= nbCols; j++ ) {
355 if ( tblRealAttr->HasValue( horIndex+1, j ) && tblRealAttr->HasValue( verIndex[i]+1, j ) )
358 if ( nbPoints > 0 ) {
359 double* xList = new double[ nbPoints ];
360 double* yList = new double[ nbPoints ];
361 for ( j = 1; j <= nbCols; j++ ) {
362 if ( tblRealAttr->HasValue( horIndex+1, j ) && tblRealAttr->HasValue( verIndex[i]+1, j ) ) {
363 xList[j-1] = tblRealAttr->GetValue( horIndex +1, j );
364 yList[j-1] = tblRealAttr->GetValue( verIndex[i]+1, j );
367 curve->setData( xList, yList, nbPoints );
370 curve->setLine( (Plot2d_Curve::LineType)myItems.at( verIndex[i] )->getLine(), myItems.at( verIndex[i] )->getLineWidth() );
371 curve->setMarker( (Plot2d_Curve::MarkerType)myItems.at( verIndex[i] )->getMarker() );
372 curve->setColor( myItems.at( verIndex[i] )->getColor() );
373 curve->setAutoAssign( myItems.at( verIndex[i] )->isAutoAssign() );
374 // add curve into container
375 container.append( curve );
379 MESSAGE("VisuGUI_SetupPlot2dDlg::getCurves : Exception has been caught (real)!!!");
385 Slot, called when any <H> button is clicked
387 void VisuGUI_SetupPlot2dDlg::onHBtnToggled( bool on )
389 VisuGUI_ItemContainer* item = ( VisuGUI_ItemContainer* )sender();
391 for ( int i = 0; i < myItems.count(); i++ ) {
392 if ( myItems.at( i ) != item )
393 myItems.at( i )->setHorizontalOn( false );
399 Slot, called when any <V> button is clicked
401 void VisuGUI_SetupPlot2dDlg::onVBtnToggled( bool on )
403 VisuGUI_ItemContainer* item = ( VisuGUI_ItemContainer* )sender();
404 QPtrList<VisuGUI_ItemContainer> itemList;
405 itemList.setAutoDelete( false );
409 for ( i = 0; i < myItems.count(); i++ ) {
410 if ( myItems.at( i ) != item && !myItems.at( i )->isHorizontalOn() ) {
411 if ( myItems.at( i )->myUnitLab->text() == item->myUnitLab->text() ) {
412 if ( myItems.at( i )->isVerticalOn() )
415 itemList.append( myItems.at( i ) );
418 myItems.at( i )->setVerticalOn( false );
422 if ( totalOn == 0 && !itemList.isEmpty() &&
423 SUIT_MessageBox::info2( this,
425 tr( "QUE_WANT_SAME_UNITS" ),
429 for ( i = 0; i < itemList.count(); i++ ) {
430 itemList.at( i )->blockSignals( true );
431 itemList.at( i )->setVerticalOn( true );
432 itemList.at( i )->blockSignals( false );
439 Slot, called when <Help> button is clicked
441 void VisuGUI_SetupPlot2dDlg::onHelp()
443 QString aHelpFileName = "/files/creating_curves.htm";
444 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
446 VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
447 app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
450 SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
451 QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
452 arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
453 QObject::tr("BUT_OK"));
457 Enables/disables buttons
459 void VisuGUI_SetupPlot2dDlg::enableControls()
463 for ( int i = 0; i < myItems.count(); i++ ) {
464 if ( myItems.at( i )->isHorizontalOn() ) {
470 for ( int i = 0; i < myItems.count(); i++ ) {
472 for ( i = 0; i < myItems.count(); i++ ) {
474 if ( myItems.at( i )->isVerticalOn() )
476 myItems.at( i )->enableWidgets( bHSet && myItems.at( i )->isVerticalOn() );
478 myOkBtn->setEnabled( bHSet && bVSet );
481 // ====================================================================================
485 VisuGUI_ItemContainer::VisuGUI_ItemContainer( QObject* parent, const char* name )
486 : QObject( parent, name ),
493 void VisuGUI_ItemContainer::createWidgets( QWidget* parentWidget )
495 myHBtn = new QToolButton( parentWidget );
496 myHBtn->setText( tr( "H" ) );
497 myHBtn->setToggleButton( true );
498 myHBtn->setOn( false );
500 myVBtn = new QToolButton( parentWidget );
501 myVBtn->setText( tr( "V" ) );
502 myVBtn->setToggleButton( true );
503 myVBtn->setOn( false );
505 myTitleLab = new QLabel( parentWidget );
506 myUnitLab = new QLabel( parentWidget );
507 myUnitLab->setAlignment( AlignCenter);
509 myAutoCheck = new QCheckBox( tr( "AUTO_CHECK_LBL" ), parentWidget );
510 myAutoCheck->setChecked( true );
512 myLineCombo = new QComboBox( false, parentWidget );
513 myLineCombo->insertItem( tr( "NONE_LINE_LBL" ) );
514 myLineCombo->insertItem( tr( "SOLID_LINE_LBL" ) );
515 myLineCombo->insertItem( tr( "DASH_LINE_LBL" ) );
516 myLineCombo->insertItem( tr( "DOT_LINE_LBL" ) );
517 myLineCombo->insertItem( tr( "DASHDOT_LINE_LBL" ) );
518 myLineCombo->insertItem( tr( "DAHSDOTDOT_LINE_LBL" ) );
519 myLineCombo->setCurrentItem( 1 ); // SOLID by default
521 myLineSpin = new QSpinBox( 0, MAX_LINE_WIDTH, 1, parentWidget );
522 myLineSpin->setValue( 0 ); // width = 0 by default
524 myMarkerCombo = new QComboBox( false, parentWidget );
525 myMarkerCombo->insertItem( tr( "NONE_MARKER_LBL" ) );
526 myMarkerCombo->insertItem( tr( "CIRCLE_MARKER_LBL" ) );
527 myMarkerCombo->insertItem( tr( "RECTANGLE_MARKER_LBL" ) );
528 myMarkerCombo->insertItem( tr( "DIAMOND_MARKER_LBL" ) );
529 myMarkerCombo->insertItem( tr( "DTRIANGLE_MARKER_LBL" ) );
530 myMarkerCombo->insertItem( tr( "UTRIANGLE_MARKER_LBL" ) );
531 myMarkerCombo->insertItem( tr( "LTRIANGLE_MARKER_LBL" ) );
532 myMarkerCombo->insertItem( tr( "RTRIANGLE_MARKER_LBL" ) );
533 myMarkerCombo->insertItem( tr( "CROSS_MARKER_LBL" ) );
534 myMarkerCombo->insertItem( tr( "XCROSS_MARKER_LBL" ) );
535 myMarkerCombo->setCurrentItem( 1 ); // CIRCLE by default
537 myColorBtn = new QToolButton( parentWidget );
538 myColorBtn->setMinimumWidth( 20 );
540 connect( myAutoCheck, SIGNAL( clicked() ), this, SLOT( onAutoChanged() ) );
541 connect( myColorBtn, SIGNAL( clicked() ), this, SLOT( onColorChanged() ) );
542 connect( myHBtn, SIGNAL( toggled( bool ) ), this, SLOT( onHVToggled( bool ) ) );
543 connect( myVBtn, SIGNAL( toggled( bool ) ), this, SLOT( onHVToggled( bool ) ) );
544 setColor( QColor( 0, 0, 0 ) );
548 Enables attributes widgets
550 void VisuGUI_ItemContainer::enableWidgets( bool enable )
556 Sets horizontal button's state on
558 void VisuGUI_ItemContainer::setHorizontalOn( bool on )
563 Gets horizontal button's state
565 bool VisuGUI_ItemContainer::isHorizontalOn() const
567 return myHBtn->isOn();
570 Sets vertical button's state on
572 void VisuGUI_ItemContainer::setVerticalOn( bool on )
577 Gets vertical button's state
579 bool VisuGUI_ItemContainer::isVerticalOn() const
581 return myVBtn->isOn();
584 Sets item AutoAssign flag state
586 void VisuGUI_ItemContainer::setAutoAssign( bool on )
588 myAutoCheck->setChecked( on );
592 Gets item AutoAssign flag state
594 bool VisuGUI_ItemContainer::isAutoAssign() const
596 return myAutoCheck->isChecked();
599 Sets item line type and width
601 void VisuGUI_ItemContainer::setLine( const int line, const int width )
603 myLineCombo->setCurrentItem( line );
608 int VisuGUI_ItemContainer::getLine() const
610 return myLineCombo->currentItem();
615 int VisuGUI_ItemContainer::getLineWidth() const
617 return myLineSpin->value();
620 Sets item marker type
622 void VisuGUI_ItemContainer::setMarker( const int marker )
624 myMarkerCombo->setCurrentItem( marker );
627 Gets item marker type
629 int VisuGUI_ItemContainer::getMarker() const
631 return myMarkerCombo->currentItem();
636 void VisuGUI_ItemContainer::setColor( const QColor& color )
638 QPalette pal = myColorBtn->palette();
639 QColorGroup ca = pal.active();
640 ca.setColor( QColorGroup::Button, color );
641 QColorGroup ci = pal.inactive();
642 ci.setColor( QColorGroup::Button, color );
644 pal.setInactive( ci );
645 myColorBtn->setPalette( pal );
650 QColor VisuGUI_ItemContainer::getColor() const
652 return myColorBtn->palette().active().button();
655 Enables/disables widgets
657 void VisuGUI_ItemContainer::updateState()
659 myAutoCheck->setEnabled( myEnabled );
660 myLineCombo->setEnabled( myEnabled && !myAutoCheck->isChecked() );
661 myLineSpin->setEnabled( myEnabled && !myAutoCheck->isChecked() );
662 myMarkerCombo->setEnabled( myEnabled && !myAutoCheck->isChecked() );
663 myColorBtn->setEnabled( myEnabled && !myAutoCheck->isChecked() );
666 Slot, called when user clickes <Auto assign> check box
668 void VisuGUI_ItemContainer::onAutoChanged()
671 emit( autoClicked() );
674 <Color> button slot, invokes color selection dialog box
676 void VisuGUI_ItemContainer::onColorChanged()
678 QColor color = QColorDialog::getColor( getColor() );
679 if ( color.isValid() ) {
684 <H> and <V> buttons slot
686 void VisuGUI_ItemContainer::onHVToggled( bool on )
688 const QObject* snd = sender();
689 if ( snd == myHBtn ) {
691 if ( myVBtn->isOn() ) {
692 // blockSignals( true );
693 myVBtn->setOn( false );
694 // blockSignals( false );
697 emit horToggled( on );
701 if ( myHBtn->isOn() ) {
702 // blockSignals( true );
703 myHBtn->setOn( false );
704 // blockSignals( false );
707 emit verToggled( on );