COPASI API  4.16.103
CQMmlScrollView.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 /*!
12  \file CQMmlScrollView.cpp
13  \brief Implementation file of class CQMmlScrollView
14  */
15 
16 #include "CQMmlScrollView.h"
17 
18 #include <QtGui/QApplication>
19 
20 #ifdef HAVE_MML
21 # include <qtmmlwidget.h>
22 #endif // HAVE_MML
23 
24 #include "qtUtilities.h"
25 
26 /// Constructor
27 CQMmlScrollView::CQMmlScrollView(QWidget* parent, const char* /* name */, Qt::WFlags /* fl */)
28  : QScrollArea(parent)
29 {
30  setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
31 
32 #ifdef HAVE_MML
33  mpMmlWidget = new QtMmlWidget(viewport() /*, "mpMmlWidget"*/);
34  mpMmlWidget->setMinimumSize(QSize(0, 0));
35  setWidget(mpMmlWidget);
36 #endif // HAVE_MML
37 }
38 
39 /// Destructor
41 {
42  // no need to delete child widgets, Qt does it all for us
43 }
44 
45 /// Function to update the MathML widget
46 void CQMmlScrollView::updateWidget(std::ostringstream &mml)
47 {
48 #ifdef HAVE_MML
49  mpMmlWidget->setContent(FROM_UTF8(mml.str()));
50  mpMmlWidget->setBaseFontPointSize(qApp->font().pointSize());
51  mpMmlWidget->setFontName(QtMmlWidget::NormalFont, qApp->font().family());
52 
53  mpMmlWidget->resize(mpMmlWidget->sizeHint().width(), mpMmlWidget->sizeHint().height());
54 
55 #endif // HAVE_MML
56 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
void updateWidget(std::ostringstream &mml)
Function to update the MathML widget.
CQMmlScrollView(QWidget *parent=0, const char *name=0, Qt::WFlags fl=0)
Constructor.
~CQMmlScrollView()
Destructor.
Header file of class CQMmlScrollView.