Ejemplo n.º 1
0
/** Insert a check or radio button */
void KGroupEduca::insertAnswer( const QString& text)
{
    QButton *answer = 0;

    switch( _typeMode )
    {
    case Radio:
        answer = new KRadioEduca( _vbox2 );
        break;
    case Check:
        answer = new KCheckEduca( _vbox2 );
        break;
    }
    answer->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0 ) );
    answer->setText( text );
    answer->show();
    insert(answer);
}
Ejemplo n.º 2
0
void MainWindow::setCurrent(QListViewItem *item)
{
    if (!item)
        return;
    
    _currentItem = (OListViewItem*)item;
//    _currentItem = dynamic_cast<OListViewItem*>(item);
    if (_currentItem->rtti() == OListViewItem::Result) {
        ResultItem *res = (ResultItem*)item;
//        ResultItem *res = dynamic_cast<ResultItem*>(item);
        richEdit->setText( res->toRichText() );
        QIntDict<QString> acts = res->actions();
        QButton *button;
        for (uint i = 0; i < acts.count(); i++) {
            button = buttonMap[i];
            if (!button && acts[i]) {
                owarn << " no button for " << *acts[i] << oendl;
                button = new QPushButton( buttonBox );
                buttonMap.insert( i,  button );
                signalMapper->setMapping(button, i );
                connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) );
            } else if (!acts[i]) {
		owarn << "No action for index " << i << oendl;
		continue;
	    }
            button->setText( *acts[i] );
            button->show();
        }
        for (uint i = acts.count(); i < _buttonCount; i++) {
            button = buttonMap[i];
            if (button)
                button->hide();
        }
        _buttonCount = acts.count();
        detailsFrame->show();
        buttonBox->show();
    }
    else {
        detailsFrame->hide();
        buttonBox->hide();
    }
    popupTimer->start( 300, true );
}