1 // Copyright (C) 2009-2013 CEA/DEN, EDF R&D
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
21 #include "MyDlgRef.hxx"
23 //////////////////////////////////////////
24 // DlgRef_1List1Spin1Btn
25 //////////////////////////////////////////
27 DlgRef_1List1Spin1Btn::DlgRef_1List1Spin1Btn( QWidget* parent, Qt::WindowFlags f )
28 : QWidget( parent, f )
33 DlgRef_1List1Spin1Btn::~DlgRef_1List1Spin1Btn()
37 //////////////////////////////////////////
38 // DlgRef_1Sel1Check1List
39 //////////////////////////////////////////
41 DlgRef_1Sel1Check1List::DlgRef_1Sel1Check1List( QWidget* parent, Qt::WindowFlags f )
42 : QWidget( parent, f )
47 DlgRef_1Sel1Check1List::~DlgRef_1Sel1Check1List()
51 //////////////////////////////////////////
52 // DlgRef_1Sel1Check1Sel
53 //////////////////////////////////////////
55 DlgRef_1Sel1Check1Sel::DlgRef_1Sel1Check1Sel( QWidget* parent, Qt::WindowFlags f )
56 : QWidget( parent, f )
61 DlgRef_1Sel1Check1Sel::~DlgRef_1Sel1Check1Sel()
65 //////////////////////////////////////////
67 //////////////////////////////////////////
69 DlgRef_1Sel1Check::DlgRef_1Sel1Check( QWidget* parent, Qt::WindowFlags f )
70 : QWidget( parent, f )
75 DlgRef_1Sel1Check::~DlgRef_1Sel1Check()
79 //////////////////////////////////////////
80 // DlgRef_1Sel1List1Check3Btn
81 //////////////////////////////////////////
83 DlgRef_1Sel1List1Check3Btn::DlgRef_1Sel1List1Check3Btn( QWidget* parent, Qt::WindowFlags f )
84 : QWidget( parent, f )
89 DlgRef_1Sel1List1Check3Btn::~DlgRef_1Sel1List1Check3Btn()
93 //////////////////////////////////////////
94 // DlgRef_1Sel1Spin1Check
95 //////////////////////////////////////////
97 DlgRef_1Sel1Spin1Check::DlgRef_1Sel1Spin1Check( QWidget* parent, Qt::WindowFlags f )
98 : QWidget( parent, f )
103 DlgRef_1Sel1Spin1Check::~DlgRef_1Sel1Spin1Check()
107 //////////////////////////////////////////
109 //////////////////////////////////////////
111 DlgRef_1Sel1Spin::DlgRef_1Sel1Spin( QWidget* parent, Qt::WindowFlags f )
112 : QWidget( parent, f )
117 DlgRef_1Sel1Spin::~DlgRef_1Sel1Spin()
121 //////////////////////////////////////////
122 // DlgRef_1Sel2Spin1View1Check
123 //////////////////////////////////////////
125 DlgRef_1Sel2Spin1View1Check::DlgRef_1Sel2Spin1View1Check( QWidget* parent, Qt::WindowFlags f )
126 : QWidget( parent, f )
131 DlgRef_1Sel2Spin1View1Check::~DlgRef_1Sel2Spin1View1Check()
135 //////////////////////////////////////////
137 //////////////////////////////////////////
139 DlgRef_1Sel2Spin::DlgRef_1Sel2Spin( QWidget* parent, Qt::WindowFlags f )
140 : QWidget( parent, f )
145 DlgRef_1Sel2Spin::~DlgRef_1Sel2Spin()
149 //////////////////////////////////////////
151 //////////////////////////////////////////
153 DlgRef_1Sel3Check::DlgRef_1Sel3Check( QWidget* parent, Qt::WindowFlags f )
154 : QWidget( parent, f )
159 DlgRef_1Sel3Check::~DlgRef_1Sel3Check()
163 //////////////////////////////////////////
165 //////////////////////////////////////////
167 DlgRef_1Sel3Spin::DlgRef_1Sel3Spin( QWidget* parent, Qt::WindowFlags f )
168 : QWidget( parent, f )
173 DlgRef_1Sel3Spin::~DlgRef_1Sel3Spin()
177 //////////////////////////////////////////
178 // DlgRef_1Sel3Spin1Check
179 //////////////////////////////////////////
181 DlgRef_1Sel3Spin1Check::DlgRef_1Sel3Spin1Check( QWidget* parent, Qt::WindowFlags f )
182 : QWidget( parent, f )
187 DlgRef_1Sel3Spin1Check::~DlgRef_1Sel3Spin1Check()
191 //////////////////////////////////////////
192 // DlgRef_1Sel4Spin2Check
193 //////////////////////////////////////////
195 DlgRef_1Sel4Spin2Check::DlgRef_1Sel4Spin2Check( QWidget* parent, Qt::WindowFlags f )
196 : QWidget( parent, f )
201 DlgRef_1Sel4Spin2Check::~DlgRef_1Sel4Spin2Check()
205 //////////////////////////////////////////
207 //////////////////////////////////////////
209 DlgRef_1Sel4Spin::DlgRef_1Sel4Spin( QWidget* parent, Qt::WindowFlags f )
210 : QWidget( parent, f )
215 DlgRef_1Sel4Spin::~DlgRef_1Sel4Spin()
219 //////////////////////////////////////////
220 // DlgRef_1Sel5Spin1Check
221 //////////////////////////////////////////
223 DlgRef_1Sel5Spin1Check::DlgRef_1Sel5Spin1Check( QWidget* parent, Qt::WindowFlags f )
224 : QWidget( parent, f )
229 DlgRef_1Sel5Spin1Check::~DlgRef_1Sel5Spin1Check()
233 //////////////////////////////////////////
235 //////////////////////////////////////////
237 DlgRef_1Sel5Spin::DlgRef_1Sel5Spin( QWidget* parent, Qt::WindowFlags f )
238 : QWidget( parent, f )
243 DlgRef_1Sel5Spin::~DlgRef_1Sel5Spin()
247 //////////////////////////////////////////
249 //////////////////////////////////////////
251 DlgRef_1Spin::DlgRef_1Spin( QWidget* parent, Qt::WindowFlags f )
252 : QWidget( parent, f )
257 DlgRef_1Spin::~DlgRef_1Spin()
261 //////////////////////////////////////////
263 //////////////////////////////////////////
265 DlgRef_1Sel::DlgRef_1Sel( QWidget* parent, Qt::WindowFlags f )
266 : QWidget( parent, f )
271 DlgRef_1Sel::~DlgRef_1Sel()
275 //////////////////////////////////////////
277 //////////////////////////////////////////
279 DlgRef_1SelExt::DlgRef_1SelExt( QWidget* parent, Qt::WindowFlags f )
280 : QWidget( parent, f )
285 DlgRef_1SelExt::~DlgRef_1SelExt()
289 //////////////////////////////////////////
290 // DlgRef_2Sel1List1Check
291 //////////////////////////////////////////
293 DlgRef_2Sel1List1Check::DlgRef_2Sel1List1Check( QWidget* parent, Qt::WindowFlags f )
294 : QWidget( parent, f )
299 DlgRef_2Sel1List1Check::~DlgRef_2Sel1List1Check()
303 //////////////////////////////////////////
304 // DlgRef_2Sel1List2Check
305 //////////////////////////////////////////
307 DlgRef_2Sel1List2Check::DlgRef_2Sel1List2Check( QWidget* parent, Qt::WindowFlags f )
308 : QWidget( parent, f )
313 DlgRef_2Sel1List2Check::~DlgRef_2Sel1List2Check()
317 //////////////////////////////////////////
319 //////////////////////////////////////////
321 DlgRef_2Sel1List::DlgRef_2Sel1List( QWidget* parent, Qt::WindowFlags f )
322 : QWidget( parent, f )
327 DlgRef_2Sel1List::~DlgRef_2Sel1List()
331 //////////////////////////////////////////
332 // DlgRef_2Sel1Spin2Check
333 //////////////////////////////////////////
335 DlgRef_2Sel1Spin2Check::DlgRef_2Sel1Spin2Check( QWidget* parent, Qt::WindowFlags f )
336 : QWidget( parent, f )
341 DlgRef_2Sel1Spin2Check::~DlgRef_2Sel1Spin2Check()
345 //////////////////////////////////////////
347 //////////////////////////////////////////
349 DlgRef_2Sel1Spin::DlgRef_2Sel1Spin( QWidget* parent, Qt::WindowFlags f )
350 : QWidget( parent, f )
355 DlgRef_2Sel1Spin::~DlgRef_2Sel1Spin()
359 //////////////////////////////////////////
360 // DlgRef_2Sel1SpinInt
361 //////////////////////////////////////////
363 DlgRef_2Sel1SpinInt::DlgRef_2Sel1SpinInt( QWidget* parent, Qt::WindowFlags f )
364 : QWidget( parent, f )
369 DlgRef_2Sel1SpinInt::~DlgRef_2Sel1SpinInt()
373 //////////////////////////////////////////
375 //////////////////////////////////////////
377 DlgRef_2Sel2List::DlgRef_2Sel2List( QWidget* parent, Qt::WindowFlags f )
378 : QWidget( parent, f )
383 DlgRef_2Sel2List::~DlgRef_2Sel2List()
387 //////////////////////////////////////////
388 // DlgRef_2Sel2Spin1Check
389 //////////////////////////////////////////
391 DlgRef_2Sel2Spin1Check::DlgRef_2Sel2Spin1Check( QWidget* parent, Qt::WindowFlags f )
392 : QWidget( parent, f )
397 DlgRef_2Sel2Spin1Check::~DlgRef_2Sel2Spin1Check()
401 //////////////////////////////////////////
402 // DlgRef_2Sel2Spin3Check
403 //////////////////////////////////////////
405 DlgRef_2Sel2Spin3Check::DlgRef_2Sel2Spin3Check( QWidget* parent, Qt::WindowFlags f )
406 : QWidget( parent, f )
411 DlgRef_2Sel2Spin3Check::~DlgRef_2Sel2Spin3Check()
415 //////////////////////////////////////////
417 //////////////////////////////////////////
419 DlgRef_2Sel2Spin::DlgRef_2Sel2Spin( QWidget* parent, Qt::WindowFlags f )
420 : QWidget( parent, f )
425 DlgRef_2Sel2Spin::~DlgRef_2Sel2Spin()
429 //////////////////////////////////////////
430 // DlgRef_2Sel3Spin2Rb
431 //////////////////////////////////////////
433 DlgRef_2Sel3Spin2Rb::DlgRef_2Sel3Spin2Rb( QWidget* parent, Qt::WindowFlags f )
434 : QWidget( parent, f )
439 DlgRef_2Sel3Spin2Rb::~DlgRef_2Sel3Spin2Rb()
443 //////////////////////////////////////////
445 //////////////////////////////////////////
447 DlgRef_2Sel3Spin::DlgRef_2Sel3Spin( QWidget* parent, Qt::WindowFlags f )
448 : QWidget( parent, f )
453 DlgRef_2Sel3Spin::~DlgRef_2Sel3Spin()
457 //////////////////////////////////////////
458 // DlgRef_2Sel4Spin1Check
459 //////////////////////////////////////////
461 DlgRef_2Sel4Spin1Check::DlgRef_2Sel4Spin1Check( QWidget* parent, Qt::WindowFlags f )
462 : QWidget( parent, f )
467 DlgRef_2Sel4Spin1Check::~DlgRef_2Sel4Spin1Check()
471 //////////////////////////////////////////
473 //////////////////////////////////////////
475 DlgRef_2Sel::DlgRef_2Sel( QWidget* parent, Qt::WindowFlags f )
476 : QWidget( parent, f )
481 DlgRef_2Sel::~DlgRef_2Sel()
485 //////////////////////////////////////////
487 //////////////////////////////////////////
489 DlgRef_2SelExt::DlgRef_2SelExt( QWidget* parent, Qt::WindowFlags f )
490 : QWidget( parent, f )
495 DlgRef_2SelExt::~DlgRef_2SelExt()
499 //////////////////////////////////////////
501 //////////////////////////////////////////
503 DlgRef_2Spin::DlgRef_2Spin( QWidget* parent, Qt::WindowFlags f )
504 : QWidget( parent, f )
509 DlgRef_2Spin::~DlgRef_2Spin()
513 //////////////////////////////////////////
515 //////////////////////////////////////////
517 DlgRef_3Check::DlgRef_3Check( QWidget* parent, Qt::WindowFlags f )
518 : QWidget( parent, f )
523 DlgRef_3Check::~DlgRef_3Check()
527 //////////////////////////////////////////
529 //////////////////////////////////////////
531 DlgRef_3Radio::DlgRef_3Radio( QWidget* parent, Qt::WindowFlags f )
532 : QWidget( parent, f )
537 DlgRef_3Radio::~DlgRef_3Radio()
541 //////////////////////////////////////////
542 // DlgRef_3Radio1Sel1Spin
543 //////////////////////////////////////////
545 DlgRef_3Radio1Sel1Spin::DlgRef_3Radio1Sel1Spin( QWidget* parent, Qt::WindowFlags f )
546 : QWidget( parent, f )
551 DlgRef_3Radio1Sel1Spin::~DlgRef_3Radio1Sel1Spin()
555 //////////////////////////////////////////
557 //////////////////////////////////////////
559 DlgRef_3Sel1Check::DlgRef_3Sel1Check( QWidget* parent, Qt::WindowFlags f )
560 : QWidget( parent, f )
565 DlgRef_3Sel1Check::~DlgRef_3Sel1Check()
569 //////////////////////////////////////////
571 //////////////////////////////////////////
573 DlgRef_3Sel1Spin::DlgRef_3Sel1Spin( QWidget* parent, Qt::WindowFlags f )
574 : QWidget( parent, f )
579 DlgRef_3Sel1Spin::~DlgRef_3Sel1Spin()
583 //////////////////////////////////////////
585 //////////////////////////////////////////
587 DlgRef_3Sel2Spin::DlgRef_3Sel2Spin( QWidget* parent, Qt::WindowFlags f )
588 : QWidget( parent, f )
593 DlgRef_3Sel2Spin::~DlgRef_3Sel2Spin()
597 //////////////////////////////////////////
598 // DlgRef_3Sel3Spin1Check
599 //////////////////////////////////////////
601 DlgRef_3Sel3Spin1Check::DlgRef_3Sel3Spin1Check( QWidget* parent, Qt::WindowFlags f )
602 : QWidget( parent, f )
607 DlgRef_3Sel3Spin1Check::~DlgRef_3Sel3Spin1Check()
611 void DlgRef_3Sel3Spin1Check::ShowRows( int fromRow, int toRow, bool toShow )
613 const int maxRows = 7;
615 if ( toRow >= fromRow && fromRow >= 0 && toRow <= maxRows ) {
616 int c = gridLayout1->count();
617 for ( int i = 0; i < c; i++ ) {
618 QWidget* w = gridLayout1->itemAt( i )->widget();
619 int row, col, rowspan, colspan;
620 gridLayout1->getItemPosition( i, &row, &col, &rowspan, &colspan );
621 if ( w && row >= fromRow && row <= toRow )
622 w->setVisible( toShow );
627 //////////////////////////////////////////
628 // DlgRef_3Sel3Spin2Check
629 //////////////////////////////////////////
631 DlgRef_3Sel3Spin2Check::DlgRef_3Sel3Spin2Check( QWidget* parent, Qt::WindowFlags f )
632 : QWidget( parent, f )
637 DlgRef_3Sel3Spin2Check::~DlgRef_3Sel3Spin2Check()
641 void DlgRef_3Sel3Spin2Check::ShowRows( int fromRow, int toRow, bool toShow )
643 const int maxRows = 8;
645 if ( toRow >= fromRow && fromRow >= 0 && toRow <= maxRows ) {
646 int c = gridLayout1->count();
647 for ( int i = 0; i < c; i++ ) {
648 QWidget* w = gridLayout1->itemAt( i )->widget();
649 int row, col, rowspan, colspan;
650 gridLayout1->getItemPosition( i, &row, &col, &rowspan, &colspan );
651 if ( w && row >= fromRow && row <= toRow )
652 w->setVisible( toShow );
657 //////////////////////////////////////////
658 // DlgRef_3Sel4Spin2Check
659 //////////////////////////////////////////
661 DlgRef_3Sel4Spin2Check::DlgRef_3Sel4Spin2Check( QWidget* parent, Qt::WindowFlags f )
662 : QWidget( parent, f )
667 DlgRef_3Sel4Spin2Check::~DlgRef_3Sel4Spin2Check()
671 //////////////////////////////////////////
673 //////////////////////////////////////////
675 DlgRef_3Sel::DlgRef_3Sel( QWidget* parent, Qt::WindowFlags f )
676 : QWidget( parent, f )
681 DlgRef_3Sel::~DlgRef_3Sel()
685 //////////////////////////////////////////
686 // DlgRef_3Spin1Check
687 //////////////////////////////////////////
689 DlgRef_3Spin1Check::DlgRef_3Spin1Check( QWidget* parent, Qt::WindowFlags f )
690 : QWidget( parent, f )
695 DlgRef_3Spin1Check::~DlgRef_3Spin1Check()
699 //////////////////////////////////////////
701 //////////////////////////////////////////
703 DlgRef_3Spin::DlgRef_3Spin( QWidget* parent, Qt::WindowFlags f )
704 : QWidget( parent, f )
709 DlgRef_3Spin::~DlgRef_3Spin()
713 //////////////////////////////////////////
714 // DlgRef_4Sel1List1Check
715 //////////////////////////////////////////
717 DlgRef_4Sel1List1Check::DlgRef_4Sel1List1Check( QWidget* parent, Qt::WindowFlags f )
718 : QWidget( parent, f )
723 DlgRef_4Sel1List1Check::~DlgRef_4Sel1List1Check()
727 //////////////////////////////////////////
729 //////////////////////////////////////////
731 DlgRef_4Sel1List::DlgRef_4Sel1List( QWidget* parent, Qt::WindowFlags f )
732 : QWidget( parent, f )
737 DlgRef_4Sel1List::~DlgRef_4Sel1List()
741 //////////////////////////////////////////
742 // DlgRef_4Sel1Spin2Check
743 //////////////////////////////////////////
745 DlgRef_4Sel1Spin2Check::DlgRef_4Sel1Spin2Check( QWidget* parent, Qt::WindowFlags f )
746 : QWidget( parent, f )
751 DlgRef_4Sel1Spin2Check::~DlgRef_4Sel1Spin2Check()
755 void DlgRef_4Sel1Spin2Check::ShowRows( int fromRow, int toRow, bool toShow )
757 const int maxRows = 6;
759 if ( toRow >= fromRow && fromRow >= 0 && toRow <= maxRows ) {
760 int c = gridLayout1->count();
761 for ( int i = 0; i < c; i++ ) {
762 QWidget* w = gridLayout1->itemAt( i )->widget();
763 int row, col, rowspan, colspan;
764 gridLayout1->getItemPosition( i, &row, &col, &rowspan, &colspan );
765 if ( w && row >= fromRow && row <= toRow )
766 w->setVisible( toShow );
771 //////////////////////////////////////////
772 // DlgRef_4Sel1Spin3Check
773 //////////////////////////////////////////
775 DlgRef_4Sel1Spin3Check::DlgRef_4Sel1Spin3Check( QWidget* parent, Qt::WindowFlags f )
776 : QWidget( parent, f )
781 DlgRef_4Sel1Spin3Check::~DlgRef_4Sel1Spin3Check()
785 //////////////////////////////////////////
787 //////////////////////////////////////////
789 DlgRef_6Sel::DlgRef_6Sel( QWidget* parent, Qt::WindowFlags f )
790 : QWidget( parent, f )
795 DlgRef_6Sel::~DlgRef_6Sel()
799 //////////////////////////////////////////
801 //////////////////////////////////////////
803 MyDlgRef_Skeleton::MyDlgRef_Skeleton( QWidget* parent, Qt::WindowFlags f )
804 : QWidget( parent, f )
809 MyDlgRef_Skeleton::~MyDlgRef_Skeleton()
813 //////////////////////////////////////////
815 //////////////////////////////////////////
817 QString DlgRef::PrintDoubleValue( double theValue, int thePrecision )
819 const double prec = 1e-12;
821 if ( qAbs(theValue) < prec )
824 QString aRes = QLocale().toString( theValue, thePrecision >= 0 ? 'f' : 'g', qAbs( thePrecision ) );
828 while ( p < thePrecision ) {
829 QString aRes = QLocale().toString( theValue, thePrecision >= 0 ? 'f' : 'g', qAbs( p++ ) );
830 double v = aRes.toDouble();
831 double err = qAbs( theValue - v );
832 if ( err > 0 && err <= prec )
837 // remove trailing zeroes
839 QRegExp expre( QString( "(%1|%2)[+-]?[0-9]+$" ).arg( QLocale().exponential().toLower(),
840 QLocale().exponential().toUpper() ) );
842 int idx = aRes.indexOf( expre );
843 QString aResExp = "";
845 aResExp = aRes.mid( idx );
846 aRes = aRes.left( idx );
849 if ( aRes.contains( QLocale().decimalPoint() ) )
850 aRes.remove( QRegExp( QString( "(\\%1|0)0*$" ).arg( QLocale().decimalPoint() ) ) );
852 return aRes == "-0" ? QString( "0" ) : aRes + aResExp;