Public Types | Signals | Public Member Functions | Protected Slots | Protected Member Functions

BaseEditor Class Reference

Base editor class. More...

#include <baseeditor.h>

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

List of all members.

Public Types

enum  Buttons {
  ButtonNext, ButtonPrevious, ButtonNew, ButtonDelete,
  ButtonUndo, ButtonSubmit, ButtonClose, ButtonAdd
}

Signals

void closeRequested ()

Public Member Functions

 BaseEditor (QWidget *parent=0)
QAbstractButtonbutton (const Buttons &button)
virtual bool isDirty () const =0

Protected Slots

virtual void updateButtons ()=0
void onCloseButtonPress ()
virtual void onNewButtonPress ()=0
virtual void onSubmitButtonPress ()=0
virtual void onUndoButtonPress ()=0

Protected Member Functions

QGridLayoutmainLayout () const
QGridLayoutbottomLayout () const

Detailed Description

Base editor class.

It is mainly used to prevent code bloat.

This bug report points to an apparent bug. I experienced this only once, after the creation of the application interface in the database. The reason remained unknown.

Todo:
Empty fields are saved into database as empty strings, not NULL values. Is this desirable, and if not, how should it be solved? With triggers or similar, or through the application?

Member Enumeration Documentation

Enumerator:
ButtonNext 
ButtonPrevious 
ButtonNew 
ButtonDelete 
ButtonUndo 
ButtonSubmit 
ButtonClose 
ButtonAdd 

                 {
        ButtonNext,
        ButtonPrevious,
        ButtonNew,
        ButtonDelete,
        ButtonUndo,
        ButtonSubmit,
        ButtonClose,
        ButtonAdd
    };


Constructor & Destructor Documentation

BaseEditor::BaseEditor ( QWidget parent = 0  ) 

                                                : QWidget(parent)
{
    // member initialization
    m_mainLayout = new QGridLayout(this);
    setLayout(m_mainLayout);

    // bottom layout setup
    m_bottomLayout = new QGridLayout();
    QLabel *mandatory = new QLabel("* fields are mandatory",this);
    m_bottomLayout->addWidget(mandatory, 0, 0, 1, 1);

    // main layout setup
    mainLayout()->addLayout(m_bottomLayout, 2, 0, 1, 1);
}


Member Function Documentation

QGridLayout * BaseEditor::bottomLayout (  )  const [protected]

Referenced by SensorChannelCalibrationEditor::SensorChannelCalibrationEditor().

{
    Q_ASSERT(m_bottomLayout);
    return m_bottomLayout;
}

QAbstractButton * BaseEditor::button ( const Buttons button  ) 

Referenced by MappedBaseEditor::MappedBaseEditor(), SensorUnitEditor::SensorUnitEditor(), TableBaseEditor::TableBaseEditor(), TableBaseEditor::updateButtons(), and MappedBaseEditor::updateButtons().

{
    // lazy initialization
    QAbstractButton *b;
    while (!(b = buttonGroup.button(button))) {
        switch (button) {
        case BaseEditor::ButtonClose: buttonGroup.addButton(new QPushButton(tr("&Close"), this), button); buttonConnect(buttonGroup.button(button), SLOT(onCloseButtonPress())); break;
        case BaseEditor::ButtonUndo: buttonGroup.addButton(new QPushButton(tr("&Undo"), this), button); buttonConnect(buttonGroup.button(button), SLOT(onUndoButtonPress())); break;
        case BaseEditor::ButtonSubmit: buttonGroup.addButton(new QPushButton(tr("&Submit"), this), button); buttonConnect(buttonGroup.button(button), SLOT(onSubmitButtonPress())); break;
        case BaseEditor::ButtonNew: buttonGroup.addButton(new QPushButton(tr("&New"), this), button); buttonConnect(buttonGroup.button(button), SLOT(onNewButtonPress())); break;
        case BaseEditor::ButtonNext: buttonGroup.addButton(new QPushButton(tr("N&ext"), this), button); break;
        case BaseEditor::ButtonPrevious: buttonGroup.addButton(new QPushButton(tr("&Previous"), this), button); break;
        case BaseEditor::ButtonDelete: buttonGroup.addButton(new QPushButton(tr("&Delete"), this), button); break;
        case BaseEditor::ButtonAdd: buttonGroup.addButton(new QPushButton("Add", this), button); break;
        }
        Q_ASSERT(buttonGroup.button(button));
    }
    Q_ASSERT(b);
    return b;
}

void BaseEditor::closeRequested (  )  [signal]

Referenced by onCloseButtonPress().

virtual bool BaseEditor::isDirty (  )  const [pure virtual]
QGridLayout * BaseEditor::mainLayout (  )  const [protected]
void BaseEditor::onCloseButtonPress (  )  [protected, slot]

Referenced by button().

{
    close();
    emit closeRequested();
}

virtual void BaseEditor::onNewButtonPress (  )  [protected, pure virtual, slot]
virtual void BaseEditor::onSubmitButtonPress (  )  [protected, pure virtual, slot]

Implemented in MappedBaseEditor, TableBaseEditor, and SensorUnitEditor.

Referenced by button().

virtual void BaseEditor::onUndoButtonPress (  )  [protected, pure virtual, slot]

Implemented in MappedBaseEditor, TableBaseEditor, and SensorUnitEditor.

Referenced by button().

virtual void BaseEditor::updateButtons (  )  [protected, pure virtual, slot]

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