1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
24 //////////////////////////////////////////
25 // DlgRef_1List1Spin1Btn
26 //////////////////////////////////////////
28 DlgRef_1List1Spin1Btn::DlgRef_1List1Spin1Btn( QWidget* parent, Qt::WindowFlags f )
29 : QWidget( parent, f )
34 DlgRef_1List1Spin1Btn::~DlgRef_1List1Spin1Btn()
38 //////////////////////////////////////////
39 // DlgRef_1Sel1Check1List
40 //////////////////////////////////////////
42 DlgRef_1Sel1Check1List::DlgRef_1Sel1Check1List( QWidget* parent, Qt::WindowFlags f )
43 : QWidget( parent, f )
48 DlgRef_1Sel1Check1List::~DlgRef_1Sel1Check1List()
52 //////////////////////////////////////////
53 // DlgRef_1Sel1Check1Sel
54 //////////////////////////////////////////
56 DlgRef_1Sel1Check1Sel::DlgRef_1Sel1Check1Sel( QWidget* parent, Qt::WindowFlags f )
57 : QWidget( parent, f )
62 DlgRef_1Sel1Check1Sel::~DlgRef_1Sel1Check1Sel()
66 //////////////////////////////////////////
68 //////////////////////////////////////////
70 DlgRef_1Sel1Check::DlgRef_1Sel1Check( QWidget* parent, Qt::WindowFlags f )
71 : QWidget( parent, f )
76 DlgRef_1Sel1Check::~DlgRef_1Sel1Check()
80 //////////////////////////////////////////
81 // DlgRef_1Sel1List1Check3Btn
82 //////////////////////////////////////////
84 DlgRef_1Sel1List1Check3Btn::DlgRef_1Sel1List1Check3Btn( QWidget* parent, Qt::WindowFlags f )
85 : QWidget( parent, f )
90 DlgRef_1Sel1List1Check3Btn::~DlgRef_1Sel1List1Check3Btn()
94 //////////////////////////////////////////
95 // DlgRef_1Sel1Spin1Check
96 //////////////////////////////////////////
98 DlgRef_1Sel1Spin1Check::DlgRef_1Sel1Spin1Check( QWidget* parent, Qt::WindowFlags f )
99 : QWidget( parent, f )
104 DlgRef_1Sel1Spin1Check::~DlgRef_1Sel1Spin1Check()
108 //////////////////////////////////////////
110 //////////////////////////////////////////
112 DlgRef_1Sel1Spin::DlgRef_1Sel1Spin( QWidget* parent, Qt::WindowFlags f )
113 : QWidget( parent, f )
118 DlgRef_1Sel1Spin::~DlgRef_1Sel1Spin()
122 //////////////////////////////////////////
123 // DlgRef_1Sel2Spin1View1Check
124 //////////////////////////////////////////
126 DlgRef_1Sel2Spin1View1Check::DlgRef_1Sel2Spin1View1Check( QWidget* parent, Qt::WindowFlags f )
127 : QWidget( parent, f )
132 DlgRef_1Sel2Spin1View1Check::~DlgRef_1Sel2Spin1View1Check()
136 //////////////////////////////////////////
138 //////////////////////////////////////////
140 DlgRef_1Sel2Spin::DlgRef_1Sel2Spin( QWidget* parent, Qt::WindowFlags f )
141 : QWidget( parent, f )
146 DlgRef_1Sel2Spin::~DlgRef_1Sel2Spin()
150 //////////////////////////////////////////
152 //////////////////////////////////////////
154 DlgRef_1Sel3Check::DlgRef_1Sel3Check( QWidget* parent, Qt::WindowFlags f )
155 : QWidget( parent, f )
160 DlgRef_1Sel3Check::~DlgRef_1Sel3Check()
164 //////////////////////////////////////////
166 //////////////////////////////////////////
168 DlgRef_1Sel3Spin::DlgRef_1Sel3Spin( QWidget* parent, Qt::WindowFlags f )
169 : QWidget( parent, f )
174 DlgRef_1Sel3Spin::~DlgRef_1Sel3Spin()
178 //////////////////////////////////////////
179 // DlgRef_1Sel3Spin1Check
180 //////////////////////////////////////////
182 DlgRef_1Sel3Spin1Check::DlgRef_1Sel3Spin1Check( QWidget* parent, Qt::WindowFlags f )
183 : QWidget( parent, f )
188 DlgRef_1Sel3Spin1Check::~DlgRef_1Sel3Spin1Check()
192 //////////////////////////////////////////
193 // DlgRef_1Sel4Spin2Check
194 //////////////////////////////////////////
196 DlgRef_1Sel4Spin2Check::DlgRef_1Sel4Spin2Check( QWidget* parent, Qt::WindowFlags f )
197 : QWidget( parent, f )
202 DlgRef_1Sel4Spin2Check::~DlgRef_1Sel4Spin2Check()
206 //////////////////////////////////////////
208 //////////////////////////////////////////
210 DlgRef_1Sel4Spin::DlgRef_1Sel4Spin( QWidget* parent, Qt::WindowFlags f )
211 : QWidget( parent, f )
216 DlgRef_1Sel4Spin::~DlgRef_1Sel4Spin()
220 //////////////////////////////////////////
221 // DlgRef_1Sel5Spin1Check
222 //////////////////////////////////////////
224 DlgRef_1Sel5Spin1Check::DlgRef_1Sel5Spin1Check( QWidget* parent, Qt::WindowFlags f )
225 : QWidget( parent, f )
230 DlgRef_1Sel5Spin1Check::~DlgRef_1Sel5Spin1Check()
234 //////////////////////////////////////////
236 //////////////////////////////////////////
238 DlgRef_1Sel5Spin::DlgRef_1Sel5Spin( QWidget* parent, Qt::WindowFlags f )
239 : QWidget( parent, f )
244 DlgRef_1Sel5Spin::~DlgRef_1Sel5Spin()
248 //////////////////////////////////////////
250 //////////////////////////////////////////
252 DlgRef_1Spin::DlgRef_1Spin( QWidget* parent, Qt::WindowFlags f )
253 : QWidget( parent, f )
258 DlgRef_1Spin::~DlgRef_1Spin()
262 //////////////////////////////////////////
264 //////////////////////////////////////////
266 DlgRef_1Sel::DlgRef_1Sel( QWidget* parent, Qt::WindowFlags f )
267 : QWidget( parent, f )
272 DlgRef_1Sel::~DlgRef_1Sel()
276 //////////////////////////////////////////
278 //////////////////////////////////////////
280 DlgRef_1SelExt::DlgRef_1SelExt( QWidget* parent, Qt::WindowFlags f )
281 : QWidget( parent, f )
286 DlgRef_1SelExt::~DlgRef_1SelExt()
290 //////////////////////////////////////////
291 // DlgRef_2Sel1List1Check
292 //////////////////////////////////////////
294 DlgRef_2Sel1List1Check::DlgRef_2Sel1List1Check( QWidget* parent, Qt::WindowFlags f )
295 : QWidget( parent, f )
300 DlgRef_2Sel1List1Check::~DlgRef_2Sel1List1Check()
304 //////////////////////////////////////////
305 // DlgRef_2Sel1List2Check
306 //////////////////////////////////////////
308 DlgRef_2Sel1List2Check::DlgRef_2Sel1List2Check( QWidget* parent, Qt::WindowFlags f )
309 : QWidget( parent, f )
314 DlgRef_2Sel1List2Check::~DlgRef_2Sel1List2Check()
318 //////////////////////////////////////////
320 //////////////////////////////////////////
322 DlgRef_2Sel1List::DlgRef_2Sel1List( QWidget* parent, Qt::WindowFlags f )
323 : QWidget( parent, f )
328 DlgRef_2Sel1List::~DlgRef_2Sel1List()
332 //////////////////////////////////////////
333 // DlgRef_2Sel1Spin2Check
334 //////////////////////////////////////////
336 DlgRef_2Sel1Spin2Check::DlgRef_2Sel1Spin2Check( QWidget* parent, Qt::WindowFlags f )
337 : QWidget( parent, f )
342 DlgRef_2Sel1Spin2Check::~DlgRef_2Sel1Spin2Check()
346 //////////////////////////////////////////
348 //////////////////////////////////////////
350 DlgRef_2Sel1Spin::DlgRef_2Sel1Spin( QWidget* parent, Qt::WindowFlags f )
351 : QWidget( parent, f )
356 DlgRef_2Sel1Spin::~DlgRef_2Sel1Spin()
360 //////////////////////////////////////////
361 // DlgRef_2Sel1SpinInt
362 //////////////////////////////////////////
364 DlgRef_2Sel1SpinInt::DlgRef_2Sel1SpinInt( QWidget* parent, Qt::WindowFlags f )
365 : QWidget( parent, f )
370 DlgRef_2Sel1SpinInt::~DlgRef_2Sel1SpinInt()
374 //////////////////////////////////////////
376 //////////////////////////////////////////
378 DlgRef_2Sel2List::DlgRef_2Sel2List( QWidget* parent, Qt::WindowFlags f )
379 : QWidget( parent, f )
384 DlgRef_2Sel2List::~DlgRef_2Sel2List()
388 //////////////////////////////////////////
389 // DlgRef_2Sel2Spin1Check
390 //////////////////////////////////////////
392 DlgRef_2Sel2Spin1Check::DlgRef_2Sel2Spin1Check( QWidget* parent, Qt::WindowFlags f )
393 : QWidget( parent, f )
398 DlgRef_2Sel2Spin1Check::~DlgRef_2Sel2Spin1Check()
402 //////////////////////////////////////////
403 // DlgRef_2Sel2Spin3Check
404 //////////////////////////////////////////
406 DlgRef_2Sel2Spin3Check::DlgRef_2Sel2Spin3Check( QWidget* parent, Qt::WindowFlags f )
407 : QWidget( parent, f )
412 DlgRef_2Sel2Spin3Check::~DlgRef_2Sel2Spin3Check()
416 //////////////////////////////////////////
418 //////////////////////////////////////////
420 DlgRef_2Sel2Spin::DlgRef_2Sel2Spin( QWidget* parent, Qt::WindowFlags f )
421 : QWidget( parent, f )
426 DlgRef_2Sel2Spin::~DlgRef_2Sel2Spin()
430 //////////////////////////////////////////
431 // DlgRef_2Sel3Spin2Rb
432 //////////////////////////////////////////
434 DlgRef_2Sel3Spin2Rb::DlgRef_2Sel3Spin2Rb( QWidget* parent, Qt::WindowFlags f )
435 : QWidget( parent, f )
440 DlgRef_2Sel3Spin2Rb::~DlgRef_2Sel3Spin2Rb()
444 //////////////////////////////////////////
446 //////////////////////////////////////////
448 DlgRef_2Sel3Spin::DlgRef_2Sel3Spin( QWidget* parent, Qt::WindowFlags f )
449 : QWidget( parent, f )
454 DlgRef_2Sel3Spin::~DlgRef_2Sel3Spin()
458 //////////////////////////////////////////
459 // DlgRef_2Sel4Spin1Check
460 //////////////////////////////////////////
462 DlgRef_2Sel4Spin1Check::DlgRef_2Sel4Spin1Check( QWidget* parent, Qt::WindowFlags f )
463 : QWidget( parent, f )
468 DlgRef_2Sel4Spin1Check::~DlgRef_2Sel4Spin1Check()
472 //////////////////////////////////////////
474 //////////////////////////////////////////
476 DlgRef_2Sel::DlgRef_2Sel( QWidget* parent, Qt::WindowFlags f )
477 : QWidget( parent, f )
482 DlgRef_2Sel::~DlgRef_2Sel()
486 //////////////////////////////////////////
488 //////////////////////////////////////////
490 DlgRef_2SelExt::DlgRef_2SelExt( QWidget* parent, Qt::WindowFlags f )
491 : QWidget( parent, f )
496 DlgRef_2SelExt::~DlgRef_2SelExt()
500 //////////////////////////////////////////
502 //////////////////////////////////////////
504 DlgRef_2Spin::DlgRef_2Spin( QWidget* parent, Qt::WindowFlags f )
505 : QWidget( parent, f )
510 DlgRef_2Spin::~DlgRef_2Spin()
514 //////////////////////////////////////////
516 //////////////////////////////////////////
518 DlgRef_3Check::DlgRef_3Check( QWidget* parent, Qt::WindowFlags f )
519 : QWidget( parent, f )
524 DlgRef_3Check::~DlgRef_3Check()
528 //////////////////////////////////////////
530 //////////////////////////////////////////
532 DlgRef_3Radio::DlgRef_3Radio( QWidget* parent, Qt::WindowFlags f )
533 : QWidget( parent, f )
538 DlgRef_3Radio::~DlgRef_3Radio()
542 //////////////////////////////////////////
543 // DlgRef_3Radio1Sel1Spin
544 //////////////////////////////////////////
546 DlgRef_3Radio1Sel1Spin::DlgRef_3Radio1Sel1Spin( QWidget* parent, Qt::WindowFlags f )
547 : QWidget( parent, f )
552 DlgRef_3Radio1Sel1Spin::~DlgRef_3Radio1Sel1Spin()
556 //////////////////////////////////////////
558 //////////////////////////////////////////
560 DlgRef_3Sel1Check::DlgRef_3Sel1Check( QWidget* parent, Qt::WindowFlags f )
561 : QWidget( parent, f )
566 DlgRef_3Sel1Check::~DlgRef_3Sel1Check()
570 //////////////////////////////////////////
572 //////////////////////////////////////////
574 DlgRef_3Sel1Spin::DlgRef_3Sel1Spin( QWidget* parent, Qt::WindowFlags f )
575 : QWidget( parent, f )
580 DlgRef_3Sel1Spin::~DlgRef_3Sel1Spin()
584 //////////////////////////////////////////
586 //////////////////////////////////////////
588 DlgRef_3Sel2Spin::DlgRef_3Sel2Spin( QWidget* parent, Qt::WindowFlags f )
589 : QWidget( parent, f )
594 DlgRef_3Sel2Spin::~DlgRef_3Sel2Spin()
598 //////////////////////////////////////////
599 // DlgRef_3Sel3Spin1Check
600 //////////////////////////////////////////
602 DlgRef_3Sel3Spin1Check::DlgRef_3Sel3Spin1Check( QWidget* parent, Qt::WindowFlags f )
603 : QWidget( parent, f )
608 DlgRef_3Sel3Spin1Check::~DlgRef_3Sel3Spin1Check()
612 void DlgRef_3Sel3Spin1Check::ShowRows( int fromRow, int toRow, bool toShow )
614 const int maxRows = 7;
616 if ( toRow >= fromRow && fromRow >= 0 && toRow <= maxRows ) {
617 int c = gridLayout1->count();
618 for ( int i = 0; i < c; i++ ) {
619 QWidget* w = gridLayout1->itemAt( i )->widget();
620 int row, col, rowspan, colspan;
621 gridLayout1->getItemPosition( i, &row, &col, &rowspan, &colspan );
622 if ( w && row >= fromRow && row <= toRow )
623 w->setVisible( toShow );
628 //////////////////////////////////////////
629 // DlgRef_3Sel3Spin2Check
630 //////////////////////////////////////////
632 DlgRef_3Sel3Spin2Check::DlgRef_3Sel3Spin2Check( QWidget* parent, Qt::WindowFlags f )
633 : QWidget( parent, f )
638 DlgRef_3Sel3Spin2Check::~DlgRef_3Sel3Spin2Check()
642 void DlgRef_3Sel3Spin2Check::ShowRows( int fromRow, int toRow, bool toShow )
644 const int maxRows = 8;
646 if ( toRow >= fromRow && fromRow >= 0 && toRow <= maxRows ) {
647 int c = gridLayout1->count();
648 for ( int i = 0; i < c; i++ ) {
649 QWidget* w = gridLayout1->itemAt( i )->widget();
650 int row, col, rowspan, colspan;
651 gridLayout1->getItemPosition( i, &row, &col, &rowspan, &colspan );
652 if ( w && row >= fromRow && row <= toRow )
653 w->setVisible( toShow );
658 //////////////////////////////////////////
659 // DlgRef_3Sel4Spin2Check
660 //////////////////////////////////////////
662 DlgRef_3Sel4Spin2Check::DlgRef_3Sel4Spin2Check( QWidget* parent, Qt::WindowFlags f )
663 : QWidget( parent, f )
668 DlgRef_3Sel4Spin2Check::~DlgRef_3Sel4Spin2Check()
672 //////////////////////////////////////////
674 //////////////////////////////////////////
676 DlgRef_3Sel::DlgRef_3Sel( QWidget* parent, Qt::WindowFlags f )
677 : QWidget( parent, f )
682 DlgRef_3Sel::~DlgRef_3Sel()
686 //////////////////////////////////////////
687 // DlgRef_3Spin1Check
688 //////////////////////////////////////////
690 DlgRef_3Spin1Check::DlgRef_3Spin1Check( QWidget* parent, Qt::WindowFlags f )
691 : QWidget( parent, f )
696 DlgRef_3Spin1Check::~DlgRef_3Spin1Check()
700 //////////////////////////////////////////
702 //////////////////////////////////////////
704 DlgRef_3Spin::DlgRef_3Spin( QWidget* parent, Qt::WindowFlags f )
705 : QWidget( parent, f )
710 DlgRef_3Spin::~DlgRef_3Spin()
714 //////////////////////////////////////////
715 // DlgRef_4Sel1List1Check
716 //////////////////////////////////////////
718 DlgRef_4Sel1List1Check::DlgRef_4Sel1List1Check( QWidget* parent, Qt::WindowFlags f )
719 : QWidget( parent, f )
724 DlgRef_4Sel1List1Check::~DlgRef_4Sel1List1Check()
728 //////////////////////////////////////////
730 //////////////////////////////////////////
732 DlgRef_4Sel1List::DlgRef_4Sel1List( QWidget* parent, Qt::WindowFlags f )
733 : QWidget( parent, f )
738 DlgRef_4Sel1List::~DlgRef_4Sel1List()
742 //////////////////////////////////////////
743 // DlgRef_4Sel1Spin2Check
744 //////////////////////////////////////////
746 DlgRef_4Sel1Spin2Check::DlgRef_4Sel1Spin2Check( QWidget* parent, Qt::WindowFlags f )
747 : QWidget( parent, f )
752 DlgRef_4Sel1Spin2Check::~DlgRef_4Sel1Spin2Check()
756 void DlgRef_4Sel1Spin2Check::ShowRows( int fromRow, int toRow, bool toShow )
758 const int maxRows = 6;
760 if ( toRow >= fromRow && fromRow >= 0 && toRow <= maxRows ) {
761 int c = gridLayout1->count();
762 for ( int i = 0; i < c; i++ ) {
763 QWidget* w = gridLayout1->itemAt( i )->widget();
764 int row, col, rowspan, colspan;
765 gridLayout1->getItemPosition( i, &row, &col, &rowspan, &colspan );
766 if ( w && row >= fromRow && row <= toRow )
767 w->setVisible( toShow );
772 //////////////////////////////////////////
773 // DlgRef_4Sel1Spin3Check
774 //////////////////////////////////////////
776 DlgRef_4Sel1Spin3Check::DlgRef_4Sel1Spin3Check( QWidget* parent, Qt::WindowFlags f )
777 : QWidget( parent, f )
782 DlgRef_4Sel1Spin3Check::~DlgRef_4Sel1Spin3Check()
786 //////////////////////////////////////////
788 //////////////////////////////////////////
790 DlgRef_6Sel::DlgRef_6Sel( QWidget* parent, Qt::WindowFlags f )
791 : QWidget( parent, f )
796 DlgRef_6Sel::~DlgRef_6Sel()
800 //////////////////////////////////////////
802 //////////////////////////////////////////
804 DlgRef_Skeleton::DlgRef_Skeleton( QWidget* parent, Qt::WindowFlags f )
805 : QWidget( parent, f )
810 DlgRef_Skeleton::~DlgRef_Skeleton()
814 //////////////////////////////////////////
816 //////////////////////////////////////////
818 QString DlgRef::PrintDoubleValue( double theValue, int thePrecision )
820 const double prec = 1e-12;
822 if ( qAbs(theValue) < prec )
825 QString aRes = QLocale().toString( theValue, thePrecision >= 0 ? 'f' : 'g', qAbs( thePrecision ) );
829 while ( p < thePrecision ) {
830 QString aRes = QLocale().toString( theValue, thePrecision >= 0 ? 'f' : 'g', qAbs( p++ ) );
831 double v = aRes.toDouble();
832 double err = qAbs( theValue - v );
833 if ( err > 0 && err <= prec )
838 // remove trailing zeroes
840 QRegExp expre( QString( "(%1|%2)[+-]?[0-9]+$" ).arg( QLocale().exponential().toLower(),
841 QLocale().exponential().toUpper() ) );
843 int idx = aRes.indexOf( expre );
844 QString aResExp = "";
846 aResExp = aRes.mid( idx );
847 aRes = aRes.left( idx );
850 if ( aRes.contains( QLocale().decimalPoint() ) )
851 aRes.remove( QRegExp( QString( "(\\%1|0)0*$" ).arg( QLocale().decimalPoint() ) ) );
853 return aRes == "-0" ? QString( "0" ) : aRes + aResExp;