COPASI API  4.16.103
FontChooser.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 // Qt headers
7 #include <QtCore/QString>
8 
9 // global headers
10 #include <assert.h>
11 
12 // global copasi headers
13 #include "copasi/copasi.h"
14 
15 // local copasi headers
16 #include "FontChooser.h"
17 #include "CQLayoutMainWindow.h"
18 #include "CQGLNetworkPainter.h"
19 
20 FontChooser::FontChooser(QWidget* parent , bool modal , Qt::WindowFlags fl)
21  : QDialog(parent, fl)
22 {
23  setupUi(this);
24  this->setModal(modal);
25  QString className = QString(parentWidget()->metaObject()->className());
26 
27  if (className == "CQLayoutMainWindow")
28  {
29  CQLayoutMainWindow * tmp = dynamic_cast<CQLayoutMainWindow *>(parentWidget());
30  assert(tmp);
31 
32  if (tmp)
33  {
34  C_INT32 currentFontSize = (C_INT32)(tmp->getFontSize());
35  spinBox1->setValue(currentFontSize);
36  }
37  }
38  else if (className == "CQGLNetworkPainter")
39  {
40  CQGLNetworkPainter * tmp = dynamic_cast<CQGLNetworkPainter *>(parentWidget());
41  assert(tmp);
42 
43  if (tmp)
44  {
45  C_INT32 currentFontSize = (C_INT32)(tmp->getFontSize());
46  spinBox1->setValue(currentFontSize);
47  }
48  }
49 }
50 
52 {
53  QString className = QString(parentWidget()->metaObject()->className());
54  C_INT32 val = spinBox1->value();
55 
56  if (className == "CQLayoutMainWindow")
57  {
58  CQLayoutMainWindow * tmp = dynamic_cast<CQLayoutMainWindow *>(parentWidget());
59  assert(tmp);
60 
61  if (tmp)
62  tmp->setFontSizeForLabels(val);
63  }
64  else if (className == "CQGLNetworkPainter") // check for another possible parent window
65  {
66  CQGLNetworkPainter * tmp = dynamic_cast<CQGLNetworkPainter *>(parentWidget());
67  assert(tmp);
68 
69  if (tmp)
70  tmp->setFontSizeForLabels((unsigned int) val);
71  }
72 }
73 
75 {
76  close();
77 }
void setFontSizeForLabels(C_INT32 size)
void cancel()
Definition: FontChooser.cpp:74
void changeFontSize()
Definition: FontChooser.cpp:51
#define C_INT32
Definition: copasi.h:90
void setFontSizeForLabels(unsigned int fs)
bool fl(const C_FLOAT64 &d1, const C_FLOAT64 &d2)
FontChooser(QWidget *parent=0, bool modal=false, Qt::WindowFlags fl=0)
Definition: FontChooser.cpp:20