Base editor class. More...
#include <baseeditor.h>


Public Types | |
| enum | Buttons { ButtonNext, ButtonPrevious, ButtonNew, ButtonDelete, ButtonUndo, ButtonSubmit, ButtonClose, ButtonAdd } |
Signals | |
| void | closeRequested () |
Public Member Functions | |
| BaseEditor (QWidget *parent=0) | |
| QAbstractButton * | button (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 | |
| QGridLayout * | mainLayout () const |
| QGridLayout * | bottomLayout () const |
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.
| enum BaseEditor::Buttons |
| ButtonNext | |
| ButtonPrevious | |
| ButtonNew | |
| ButtonDelete | |
| ButtonUndo | |
| ButtonSubmit | |
| ButtonClose | |
| ButtonAdd |
{
ButtonNext,
ButtonPrevious,
ButtonNew,
ButtonDelete,
ButtonUndo,
ButtonSubmit,
ButtonClose,
ButtonAdd
};
| 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); }
| 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] |
Implemented in MappedBaseEditor, TableBaseEditor, and SensorUnitEditor.
| QGridLayout * BaseEditor::mainLayout | ( | ) | const [protected] |
Referenced by BaseEditor(), MappedBaseEditor::MappedBaseEditor(), ProjectCalibrationEditor::ProjectCalibrationEditor(), SensorUnitEditor::SensorUnitEditor(), TableBaseEditor::TableBaseEditor(), and UnitConversionEditor::UnitConversionEditor().
{
Q_ASSERT(m_mainLayout);
return m_mainLayout;
}
| void BaseEditor::onCloseButtonPress | ( | ) | [protected, slot] |
Referenced by button().
{
close();
emit closeRequested();
}
| virtual void BaseEditor::onNewButtonPress | ( | ) | [protected, pure virtual, slot] |
Implemented in MappedBaseEditor, TableBaseEditor, ProjectCalibrationEditor, SensorChannelCalibrationEditor, SensorChannelEditor, and SensorUnitEditor.
Referenced by button().
| 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] |
Implemented in MappedBaseEditor, TableBaseEditor, ProjectCalibrationEditor, SensorChannelEditor, SensorEditor, and SensorUnitEditor.
1.7.1