lyx_mirror/src/frontends/qt4/InsetParamsWidget.cpp
Abdelrazak Younes bbda43a400 Attempt to simplify as much as possible Inset parameter dialog creation. We now just need an ui file and a class that inherits InsetParamsWidget and implement 4 methods. Then InsetParamsDialog will take care of the rest. InsetParamsDialog has 2 running mode: "immediate apply" and "Restore/OK/Close" which is the default; I hope this is enough to satisfy all users. The checkbox status might be saved later in session settings.
This new attempt replace the previous attempt with InsetDialog which was still too tight with the older framework.
Status:
float, ert, box, info: migrated
vspace: migrated but buggy. To be fixed later.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33480 a592a061-630c-0410-9148-cb99ea01b6c8
2010-02-15 23:17:45 +00:00

65 lines
1.2 KiB
C++

// -*- C++ -*-
/**
* \file InsetParamsWidget.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "InsetParamsWidget.h"
#include "qt_helpers.h"
#include <QLineEdit>
namespace lyx {
namespace frontend {
CheckedWidget::CheckedWidget(QLineEdit * input, QWidget * label)
: input_(input), label_(label)
{
}
bool CheckedWidget::check() const
{
bool const valid = input_->hasAcceptableInput();
// Visual feedback.
setValid(input_, valid);
if (label_)
setValid(label_, valid);
return valid;
}
InsetParamsWidget::InsetParamsWidget(QWidget * parent) : QWidget(parent)
{
}
void InsetParamsWidget::addCheckedWidget(QLineEdit * input, QWidget * label)
{
checked_widgets_.append(CheckedWidget(input, label));
}
bool InsetParamsWidget::checkWidgets() const
{
bool valid = true;
Q_FOREACH(CheckedWidget const & le, checked_widgets_)
valid &= le.check();
return valid;
}
} // namespace frontend
} // namespace lyx
#include "moc_InsetParamsWidget.cpp"