Public Member Functions | Protected Slots

ComboBoxGroup Class Reference

Base class for a group of check boxes. More...

#include <exporter.h>

Inheritance diagram for ComboBoxGroup:
Inheritance graph
[legend]
Collaboration diagram for ComboBoxGroup:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ComboBoxGroup (const QString &title, QWidget *parent=0)
CheckBoxaddComboBox (const QString &title, const QVariant &data=QVariant())
void setAutoExclusive (bool exclude)
CheckBoxcurrentChecked ()
virtual void setStandardDelimiters ()

Protected Slots

void onDelimiterClick ()

Detailed Description

Base class for a group of check boxes.


Constructor & Destructor Documentation

ComboBoxGroup::ComboBoxGroup ( const QString title,
QWidget parent = 0 
)

                                                                            :
        QGroupBox(title, parent), autoExclude(false), lastChecked(0)
{
    QVBoxLayout *dLayout = new QVBoxLayout;
    setLayout(dLayout);
}


Member Function Documentation

CheckBox * ComboBoxGroup::addComboBox ( const QString title,
const QVariant data = QVariant() 
)

Referenced by DelimiterGroup::setStandardDelimiters(), and SplitOnGroup::setStandardDelimiters().

{
    boxContainer.append(new CheckBox(title, data, this));
    layout()->addWidget(boxContainer.last());
    connect(boxContainer.last(), SIGNAL(clicked()), this, SLOT(onDelimiterClick()));
    return boxContainer.last();
}

CheckBox * ComboBoxGroup::currentChecked (  ) 

{
    Q_ASSERT(autoExclude);

    // Seek
    foreach(CheckBox *box, boxContainer)
        if (box->isChecked()) return box;

    // Default
    return 0;
}

void ComboBoxGroup::onDelimiterClick (  )  [protected, slot]

Referenced by addComboBox().

{
    // update lastChecked
    CheckBox *box = dynamic_cast<CheckBox*>(sender());
    if (box) lastChecked = box;

    // Dit is de autoExclusive implementatie. Men kon het ook anders doen door op
    // alle checkboxen setAutoExclusive() te zetten, maar probleem dan is dat eens één
    // checkbox checked is, er minstens een checked moet (!) blijven. Volgens deze
    // implementatie is dit niet het geval.
    if (box && autoExclude)
        foreach(CheckBox *box, boxContainer)
            if (box != sender()) box->setChecked(false);
}

void ComboBoxGroup::setAutoExclusive ( bool  exclude  ) 

Referenced by Exporter::Exporter().

{
    autoExclude = exclude;
}

void ComboBoxGroup::setStandardDelimiters (  )  [virtual]

Reimplemented in SplitOnGroup, and DelimiterGroup.

{};


The documentation for this class was generated from the following files: