#include <CQExpressionMmlStackedWidget.h>
CQExpressionMmlStackedWidget::CQExpressionMmlStackedWidget |
( |
QWidget * |
parent = 0 | ) |
|
CQExpressionMmlStackedWidget::~CQExpressionMmlStackedWidget |
( |
| ) |
|
QString CQExpressionMmlStackedWidget::getText |
( |
| ) |
|
void CQExpressionMmlStackedWidget::init |
( |
| ) |
|
|
protected |
Definition at line 152 of file CQExpressionMmlStackedWidget.cpp.
Referenced by CQExpressionMmlStackedWidget().
155 qDebug() <<
"L" << __LINE__ <<
" on CQEMSW mpExpressionWidget->text() = " << mpExpressionWidget->text();
156 qDebug() <<
"L" << __LINE__ <<
" on CQEMSW: activeWidget = " << currentIndex();
160 mpBtnViewExpression->hide();
161 #endif // not HAVE_MML
void CQExpressionMmlStackedWidget::saveMML |
( |
const QString |
filename | ) |
|
|
private |
Definition at line 222 of file CQExpressionMmlStackedWidget.cpp.
References CLocaleString::fromUtf8(), and TO_UTF8.
Referenced by slotSaveExpression().
227 ofile <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
228 ofile <<
"<!DOCTYPE math PUBLIC \"-//W3C//DTD MathML 2.0//EN\" \"http://www.w3.org/Math/DTD/mathml2/mathml2.dtd\">" << std::endl;
229 ofile <<
"<math xmlns=\"http://www.w3.org/1998/Math/MathML\">" << std::endl;
231 mpExpressionWidget->writeMathML(ofile);
233 ofile <<
"</math>" << std::endl;
static CLocaleString fromUtf8(const std::string &utf8)
void CQExpressionMmlStackedWidget::savePNG |
( |
const QString |
filename | ) |
|
|
private |
Definition at line 202 of file CQExpressionMmlStackedWidget.cpp.
References FROM_UTF8.
Referenced by slotSaveExpression().
204 std::ostringstream mml;
205 mpExpressionWidget->writeMathML(mml);
207 doc.setBaseFontPointSize(20);
208 doc.setFontName(QtMmlWidget::NormalFont, qApp->font().family());
211 const QSize &size = doc.size();
212 QPixmap pixmap(size.width(), size.height());
213 QPainter painter(&pixmap);
214 painter.setRenderHint(QPainter::Antialiasing);
215 painter.setRenderHint(QPainter::SmoothPixmapTransform);
216 painter.setRenderHint(QPainter::HighQualityAntialiasing);
217 painter.fillRect(0, 0, size.width(), size.height(), Qt::white);
218 doc.paint(&painter, QPoint(0, 0));
219 pixmap.save(outfilename,
"PNG");
void CQExpressionMmlStackedWidget::saveTeX |
( |
const QString |
filename | ) |
|
|
private |
void CQExpressionMmlStackedWidget::setReadOnly |
( |
const bool & |
readOnly | ) |
|
void CQExpressionMmlStackedWidget::signalCheckValidity |
( |
bool |
| ) |
|
|
signal |
void CQExpressionMmlStackedWidget::slotGoExpressionWidget |
( |
| ) |
|
|
protectedslot |
Definition at line 73 of file CQExpressionMmlStackedWidget.cpp.
76 qDebug() <<
"- here on CQExpressionMmlStackedWidget::slotGoExpressionWidget() -";
77 qDebug() <<
"L" << __LINE__ <<
" on CQEMSW mpExpressionWidget->text() = " << mpExpressionWidget->text();
80 setCurrentWidget(mpExpressionPage);
83 qDebug() <<
"L" << __LINE__ <<
" on CQEMSW mpExpressionWidget->text() = " << mpExpressionWidget->text();
84 qDebug() <<
"L" << __LINE__ <<
" on CQEMSW: activeWidget NEW = " << currentIndex();
void CQExpressionMmlStackedWidget::slotGoMmlWidget |
( |
| ) |
|
|
protectedslot |
Definition at line 88 of file CQExpressionMmlStackedWidget.cpp.
91 qDebug() <<
"L" << __LINE__ <<
" on CQEMSW mpExpressionWidget->text() = " << mpExpressionWidget->text();
94 setCurrentWidget(mpMmlPage);
97 qDebug() <<
"L" << __LINE__ <<
" on CQEMSW mpExpressionWidget->text() = " << mpExpressionWidget->text();
98 qDebug() <<
"L" << __LINE__ <<
" on CQEMSW: activeWidget NEW = " << currentIndex();
void CQExpressionMmlStackedWidget::slotSaveExpression |
( |
| ) |
|
|
privateslot |
Definition at line 164 of file CQExpressionMmlStackedWidget.cpp.
References C_INT32, checkSelection(), CopasiFileDialog::getSaveFileName(), saveMML(), savePNG(), and saveTeX().
166 QString *filter =
new QString;
169 C_INT32 Answer = QMessageBox::No;
171 while (Answer == QMessageBox::No)
177 "MathML (*.mml);;TeX (*.tex);;PNG (*.png)",
179 "Save Expression to Disk", filter);
181 if (outfilename.isEmpty())
return;
186 if (Answer == QMessageBox::Cancel)
191 qDebug() <<
"\non CQEMSW::slotSaveExpression -> filter = " << *filter <<
"\n";
194 if (filter->contains(
".tex"))
196 else if (filter->contains(
".png"))
C_INT32 checkSelection(const QString &file)
static QString getSaveFileName(QWidget *parent=0, const char *name=0, const QString &startWith=QString::null, const QString &filter=QString::null, const QString &caption=QString::null, QString *pSelectedFilter=NULL, QFileDialog::Options options=0)
void CQExpressionMmlStackedWidget::updateWidget |
( |
| ) |
|
|
slot |
Definition at line 102 of file CQExpressionMmlStackedWidget.cpp.
References FROM_UTF8.
105 qDebug() <<
"- here on CQExpressionMmlStackedWidget::updateWidget() -";
110 std::ostringstream mml;
111 std::vector<std::vector<std::string> > params;
114 qDebug() <<
"L" << __LINE__ <<
" on CQEMSW mpExpressionWidget->text() = " << mpExpressionWidget->text();
115 qDebug() <<
"L" << __LINE__ <<
" on CQEMSW: activeWidget NEW = " << currentIndex();
118 if (mpExpressionWidget->toPlainText().isEmpty() || !mpExpressionWidget->isValid())
119 setCurrentWidget(mpExpressionPage);
122 mpExpressionWidget->writeMathML(mml);
125 qDebug() <<
"mml.str() = " <<
FROM_UTF8(mml.str());
128 setCurrentWidget(mpMmlPage);
129 mpMmlScrollView->updateWidget(mml);
135 qDebug() <<
"L" << __LINE__ <<
" on CQEMSW: activeWidget = " << currentIndex();
QString CQExpressionMmlStackedWidget::MMLStr |
|
private |
The documentation for this class was generated from the following files: