6 #include <QtGui/QApplication>
7 #include <QtGui/QWheelEvent>
8 #include <QtGui/QAction>
10 #include <QtGui/QToolBar>
11 #include <QtCore/QFileInfo>
12 #include <QtGui/QHBoxLayout>
13 #include <QtGui/QLabel>
14 #include <QtGui/QComboBox>
32 if (list == NULL || dataModel == NULL)
return;
38 while (it != layouts.
end())
46 #define RENDERINFORMATION_TYPE_GLOBAL 0
47 #define RENDERINFORMATION_TYPE_LOCAL 1
48 #define RENDERINFORMATION_TYPE_DEFAULT 2
53 if (list == NULL || dataModel == NULL)
return NULL;
55 bool skipGlobal = list->count() > 0;
61 for (
size_t i = list->count(); i > 0; --i)
63 QString current = list->itemText(i - 1);
64 int type = list->itemData(i - 1).toInt();
67 list->removeItem(i - 1);
77 while (it != render.
end())
81 if (result == NULL) result = current;
109 while (it != render.
end())
113 if (result == NULL) result = current;
115 if (current->
getName().empty())
128 for (i = 0; i < iMax; ++i)
132 if (result == NULL) result = current;
134 std::string text = current->
getKey();
136 if (!current->
getName().empty())
162 if (numLocal > index)
169 if (render == NULL && numLocal + numGlobal > index)
176 if (render == NULL && numLocal + numGlobal + numDefault > (
size_t)index)
196 if (current == NULL)
return;
220 : QGraphicsView(parent)
222 , mIgnoreEvents(false)
224 setDragMode(QGraphicsView::ScrollHandDrag);
232 if (layoutScene == NULL)
return;
235 fileName.toStdString(),
236 QFileInfo(fileName).suffix().toStdString()
241 : QGraphicsView(scene)
243 , mIgnoreEvents(false)
246 setDragMode(QGraphicsView::ScrollHandDrag);
252 if (menu == NULL)
return;
262 if (toolBar == NULL)
return;
296 mpLayoutDropdown->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
299 mpRenderDropdown->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
304 setInteractive(
true);
305 setRenderHints(QPainter::Antialiasing);
310 QFrame* pFrame1 =
new QFrame;
311 QHBoxLayout* pLayout =
new QHBoxLayout;
312 pLayout->setSpacing(3);
313 pFrame1->setLayout(pLayout);
314 QLabel* pLabel =
new QLabel(tr(
"Layout:"));
315 pLayout->addWidget(pLabel);
318 QFrame* pFrame2 =
new QFrame;
319 pLayout =
new QHBoxLayout;
320 pLayout->setSpacing(3);
321 pFrame2->setLayout(pLayout);
322 QLabel* mpRenderLabel =
new QLabel(tr(
"Render Information:"));
323 pLayout->addWidget(mpRenderLabel);
326 toolBar->addWidget(pFrame1);
327 toolBar->addWidget(pFrame2);
332 setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
333 fitInView(scene()->itemsBoundingRect(), Qt::KeepAspectRatio);
338 setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
340 ensureVisible(scene()->itemsBoundingRect());
345 setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
350 setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
373 if (QApplication::keyboardModifiers() == Qt::ControlModifier ||
374 QApplication::keyboardModifiers() == Qt::MetaModifier ||
375 QApplication::keyboardModifiers() == Qt::ShiftModifier)
377 if (event->delta() > 0)
390 QGraphicsView::wheelEvent(event);
const CLayout * getCurrentLayout() const
void saveToFile(const std::string &fileName, const std::string &fileType="pdf")
void setDataModel(CCopasiDataModel *dataModel, CLayout *layout=NULL)
#define RENDERINFORMATION_TYPE_DEFAULT
CLRenderInformationBase * updateRenderInformationList(QComboBox *list, CCopasiDataModel *dataModel, CLayout *layout)
void setLayout(CLayout *layout, CCopasiDataModel *model=NULL, CLRenderInformationBase *renderInformation=NULL)
QComboBox * mpLayoutDropdown
const std::string & getObjectName() const
const CCopasiVector< CLLocalRenderInformation > & getListOfLocalRenderInformationObjects() const
virtual size_t size() const
void fillZoomTooBar(QToolBar *toolBar)
QAction * mpActFitOnScreen
CLGlobalRenderInformation * getDefaultStyle(size_t index)
void fillZoomMenu(QMenu *menu)
CCopasiDataModel * getDataModel()
void fillSelectionToolBar(QToolBar *toolBar)
void setRenderInformation(CCopasiDataModel *model, CLRenderInformationBase *renderInformation)
CCopasiDataModel * mpDataModel
size_t getNumDefaultStyles()
static const QIcon & icon(const IconID &id)
void slotLayoutChanged(int)
CQLayoutView(QWidget *parent=NULL)
QComboBox * mpRenderDropdown
CListOfLayouts * getListOfLayouts()
#define RENDERINFORMATION_TYPE_GLOBAL
void slotRenderInformationChanged(int)
void slotSaveToFile(const QString &fileName)
void wheelEvent(QWheelEvent *event)
void updateLayoutList(QComboBox *list, CCopasiDataModel *dataModel)
#define RENDERINFORMATION_TYPE_LOCAL
const CCopasiVector< CLGlobalRenderInformation > & getListOfGlobalRenderInformationObjects() const