[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kalgebra-newplotter/analitzagui
From: Percy Camilo TriveƱo Aucahuasi <percy.camilo.ta () gmail ! com
Date: 2010-07-05 21:20:44
Message-ID: 20100705212044.2ED5DAC8A8 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1146391 by aucahuasi:
now functiondelegate render the equation inside the functionsview
M +9 -24 functiondelegate.cpp
M +0 -4 functiondelegate.h
M +2 -0 functionsview.cpp
--- branches/work/kalgebra-newplotter/analitzagui/functiondelegate.cpp \
#1146390:1146391 @@ -30,27 +30,6 @@
{
}
-QWidget *FunctionDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem \
&option, const QModelIndex &index) const
-{
- Q_UNUSED(parent)
- Q_UNUSED(option)
- Q_UNUSED(index)
-
- return 0;
-}
-
-void FunctionDelegate::setEditorData(QWidget *editor, const QModelIndex &index) \
const
-{
- Q_UNUSED(editor)
- Q_UNUSED(index)
-}
-
-void FunctionDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, \
const QModelIndex &index) const
-{
- Q_UNUSED(editor)
- Q_UNUSED(index)
-}
-
void FunctionDelegate::updateEditorGeometry(QWidget *editor, const \
QStyleOptionViewItem &option, const QModelIndex &index) const {
editor->setGeometry(option.rect);
@@ -66,10 +45,9 @@
void FunctionDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, \
const QModelIndex &index) const {
- if (index.column() == 1) // only for function expression
+ // only for function expressions that can be rendered by qmmldocument
+ if (index.column() == 1)
{
- painter->save();
-
QTreeView *view = qobject_cast<QTreeView*>(parent());
FunctionsModel *model = qobject_cast<FunctionsModel*>(view->model());
@@ -82,6 +60,10 @@
QRect contentRect(view->visualRect(index).left(), \
view->visualRect(index).top(),
mathMLRenderer.size().width(), mathMLRenderer.size().height());
+ if (contentRect.width() > 0)
+ {
+ painter->save();
+
QRect cellRect = view->visualRect(index);
quint16 margin = 4;
@@ -129,4 +111,7 @@
else
QItemDelegate::paint(painter, option, index);
}
+ else
+ QItemDelegate::paint(painter, option, index);
+}
--- branches/work/kalgebra-newplotter/analitzagui/functiondelegate.h #1146390:1146391
@@ -28,10 +28,6 @@
public:
FunctionDelegate(QObject *parent = 0);
-
- QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, \
const QModelIndex &index) const;
- void setEditorData(QWidget *editor, const QModelIndex &index) const;
- void setModelData(QWidget *editor, QAbstractItemModel *model, const \
QModelIndex &index) const;
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem \
&option, const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) \
const;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const \
QModelIndex &index) const;
--- branches/work/kalgebra-newplotter/analitzagui/functionsview.cpp #1146390:1146391
@@ -17,6 +17,7 @@
*************************************************************************************/
#include "functionsview.h"
+#include "functiondelegate.h"
#include "functionsmodel.h"
#include <KDebug>
#include <KLocale>
@@ -26,6 +27,7 @@
FunctionsView::FunctionsView(QWidget * parent) : QTreeView(parent)
{
+ setItemDelegate(new FunctionDelegate(this));
}
void FunctionsView::selectionChanged(const QItemSelection & selected, const \
QItemSelection &)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic