1 /***************************************************************************
2 kgroupeduca.cpp - description
5 copyright : (C) 2000 by Javier Campos Morales
6 email : javi@asyris.org
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
18 #include "kgroupeduca.h"
19 #include "kgroupeduca.moc"
20 #include "kcheckeduca.h"
21 #include "kradioeduca.h"
25 KGroupEduca::KGroupEduca(QWidget
*parent
, const char *name
) : QVButtonGroup(i18n("Answers"), parent
, name
)
27 _sv
= new QScrollView(this);
28 _sv
->setVScrollBarMode(QScrollView::Auto
);
29 _sv
->setHScrollBarMode(QScrollView::Auto
);
30 _sv
->setFrameStyle( QFrame::NoFrame
| QFrame::Plain
);
31 _vbox2
= new QVBox( _sv
->viewport() );
32 _vbox2
->setSpacing( 6 );
33 _vbox2
->setMargin( 11 );
34 _sv
->viewport()->setBackgroundMode( _vbox2
->backgroundMode() );
35 _sv
->setStaticBackground(true);
36 _sv
->addChild( _vbox2
);
40 KGroupEduca::~KGroupEduca(){
43 /** Insert a check or radio button */
44 void KGroupEduca::insertAnswer( const QString
& text
)
51 answer
= new KRadioEduca( _vbox2
);
54 answer
= new KCheckEduca( _vbox2
);
57 answer
->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType
)5, (QSizePolicy::SizeType
)0 ) );
58 answer
->setText( text
);
64 void KGroupEduca::setType(ButtonType type
)
69 /** Clear all kradio or kcheck answers */
70 void KGroupEduca::clearAnswers()
72 unsigned int maxButton
= count();
73 for( unsigned int i
=0 ; i
<maxButton
; ++i
)
76 if( (tmpButton
= find(i
)) )
83 /** Return if is checked radio or check buttons */
84 bool KGroupEduca::isChecked(int id
)
90 KRadioEduca
*tmpRadioButton
= (KRadioEduca
*) find(id
);
91 if(tmpRadioButton
!= 0) return tmpRadioButton
->isChecked();
96 KCheckEduca
*tmpCheckButton
= (KCheckEduca
*) find(id
);
97 if(tmpCheckButton
!= 0) return tmpCheckButton
->isChecked();