mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 21:49:51 +00:00
7ff3e84c5d
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36194 a592a061-630c-0410-9148-cb99ea01b6c8
82 lines
1.6 KiB
C++
82 lines
1.6 KiB
C++
/**
|
|
* \file GuiLabel.cpp
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author John Levon
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#include "GuiLabel.h"
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
#include "insets/InsetLabel.h"
|
|
|
|
#include <QLabel>
|
|
#include <QPushButton>
|
|
#include <QLineEdit>
|
|
|
|
using namespace std;
|
|
|
|
namespace lyx {
|
|
namespace frontend {
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
//
|
|
// GuiLabel
|
|
//
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
GuiLabel::GuiLabel(QWidget * parent) : InsetParamsWidget(parent)
|
|
{
|
|
setupUi(this);
|
|
|
|
connect(keywordED, SIGNAL(textChanged(const QString &)),
|
|
this, SIGNAL(changed()));
|
|
|
|
setFocusProxy(keywordED);
|
|
}
|
|
|
|
|
|
void GuiLabel::paramsToDialog(Inset const * inset)
|
|
{
|
|
InsetLabel const * label = static_cast<InsetLabel const *>(inset);
|
|
InsetCommandParams const & params = label->params();
|
|
keywordED->setText(toqstr(params["name"]));
|
|
}
|
|
|
|
|
|
docstring GuiLabel::dialogToParams() const
|
|
{
|
|
InsetCommandParams params(insetCode());
|
|
params["name"] = qstring_to_ucs4(keywordED->text());
|
|
return from_utf8(InsetLabel::params2string(params));
|
|
}
|
|
|
|
|
|
bool GuiLabel::initialiseParams(std::string const & data)
|
|
{
|
|
InsetCommandParams p(insetCode());
|
|
if (!InsetCommand::string2params(data, p))
|
|
return false;
|
|
keywordED->setText(toqstr(p["name"]));
|
|
return true;
|
|
}
|
|
|
|
|
|
bool GuiLabel::checkWidgets() const
|
|
{
|
|
if (!InsetParamsWidget::checkWidgets())
|
|
return false;
|
|
return !keywordED->text().isEmpty();
|
|
}
|
|
|
|
} // namespace frontend
|
|
} // namespace lyx
|
|
|
|
#include "moc_GuiLabel.cpp"
|