1
////////////////////////////////////////////////////////////////////////////////
2
/*! @file NewNoteDlg.cpp Редактирование текстового атрибута.
3
- Part of RAGUI - Research Assistant Graphical User Interface.
4
- Uses QtGui v.4.6 - http://qt.nokia.com/
5
- Uses RANet - Research Assistant Net Library (based on ANSI C++).
6
- Copyright(C) 2010, Viktor E. Bursian, St.Petersburg, Russia.
7
Viktor.Bursian@mail.ioffe.ru
8
*///////////////////////////////////////////////////////////////////////////////
9
#include "NewNoteDlg.h"
11
//------------------------------------------------------------------------------
13
sNewNoteDlg::~sNewNoteDlg ()
18
sNewNoteDlg::sNewNoteDlg (QWidget * parent)
20
,PreventCycling(false)
22
lblValue = new QLabel(this);
23
lblValue->setObjectName(QString::fromUtf8("lblValue"));
24
lblValue->setText(tr("Source HTML:"));
25
ValueSpace->addWidget(lblValue,0,0,1,1/*,Qt::Alignment*/);
27
fldValuePlain = new QTextEdit(this);
28
fldValuePlain->setObjectName(QString::fromUtf8("fldValuePlain"));
29
ValueSpace->addWidget(fldValuePlain,1,0,1,2/*,Qt::Alignment*/);
31
lblValueHTML = new QLabel(this);
32
lblValueHTML->setObjectName(QString::fromUtf8("lblValueHTML"));
33
lblValueHTML->setText(tr("Formatted\ntext:"));
34
ValueSpace->addWidget(lblValueHTML,2,0,1,1/*,Qt::Alignment*/);
36
fldValueHTML = new QTextEdit(this);
37
fldValueHTML->setObjectName(QString::fromUtf8("fldValueHTML"));
38
ValueSpace->addWidget(fldValueHTML,2,1,1,1/*,Qt::Alignment*/);
40
fldValueHTML->setEnabled(false);
42
connect(fldValuePlain,SIGNAL(textChanged()),this,SLOT(UpdateHTML()));
43
connect(fldValueHTML,SIGNAL(textChanged()),this,SLOT(UpdatePlain()));
47
void sNewNoteDlg::SetValue (rcsString value)
49
fldValuePlain->setPlainText(sString2QString(value));
51
fldValuePlain->setFocus();
55
bool sNewNoteDlg::Validate ()
57
TheValue=QString2sString(fldValuePlain->toPlainText());
58
return sAttrDlg::Validate();
62
void sNewNoteDlg::UpdatePlain ()
64
if( ! PreventCycling ){
65
TheValue=QString2sString(fldValueHTML->toHtml());
67
fldValuePlain->setPlainText(sString2QString(TheValue));
73
void sNewNoteDlg::UpdateHTML ()
75
if( ! PreventCycling ){
76
TheValue=QString2sString(fldValuePlain->toPlainText());
78
fldValueHTML->setHtml(sString2QString(TheValue));
83
//------------------------------------------------------------------------------