Quick and dirty port to Qt5
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "ChoiceDelegate.hpp"
|
||||
|
||||
@@ -44,7 +45,7 @@ void ChoiceDelegate::setEditorData(QWidget *editor,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
QComboBox* combo = qobject_cast<QComboBox *>(editor);
|
||||
int i = combo->findText(qVariantValue<QString>(index.data()));
|
||||
int i = combo->findText(index.data().toString());
|
||||
|
||||
if (i != -1) combo->setCurrentIndex(i);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "DateDelegate.hpp"
|
||||
|
||||
@@ -49,6 +50,6 @@ void DateDelegate::setEditorData(QWidget *editor,
|
||||
int day;
|
||||
|
||||
QComboBox* combo = qobject_cast<QComboBox *>(editor);
|
||||
day = QDate::fromString(qVariantValue<QString>(index.data()), _dateFormat).day()-1;
|
||||
day = QDate::fromString(index.data().toString(), _dateFormat).day()-1;
|
||||
combo->setCurrentIndex(day);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "FloatDelegate.hpp"
|
||||
|
||||
@@ -41,5 +42,5 @@ void FloatDelegate::setEditorData(QWidget *editor,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
QLineEdit* line = qobject_cast<QLineEdit *>(editor);
|
||||
line->setText(qVariantValue<QString>(index.data()));
|
||||
line->setText(index.data().toString());
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <QtGui>
|
||||
#include <QString>
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "FormulaDelegate.hpp"
|
||||
#include <ParseExp.hpp>
|
||||
@@ -81,7 +82,7 @@ void FormulaDelegate::setEditorData(QWidget *editor,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
QLineEdit* line = qobject_cast<QLineEdit *>(editor);
|
||||
QString s = qVariantValue<QString>(index.data());
|
||||
QString s = index.data().toString();
|
||||
|
||||
if ((*_operations)[index.row()].formula.length())
|
||||
line->setText((*_operations)[index.row()].formula);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "GridAccount.hpp"
|
||||
#include "TableViewDelegate.hpp"
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
#include <QString>
|
||||
|
||||
#include "StarDelegate.hpp"
|
||||
@@ -43,7 +44,7 @@ void StarDelegate::setEditorData(QWidget *editor,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
QLineEdit* line = qobject_cast<QLineEdit *>(editor);
|
||||
QString s = qVariantValue<QString>(index.data());
|
||||
QString s = index.data().toString();
|
||||
|
||||
if (s.endsWith("*"))
|
||||
line->setText(s.left(s.size()-1));
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <QtGui>
|
||||
#include <QString>
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "TabDelegate.hpp"
|
||||
|
||||
@@ -49,7 +50,7 @@ void TabDelegate::setEditorData(QWidget *editor,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
QLineEdit* line = qobject_cast<QLineEdit *>(editor);
|
||||
QString s = qVariantValue<QString>(index.data());
|
||||
QString s = index.data().toString();
|
||||
|
||||
line->setText(s.trimmed());
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#define TABLEVIEWDELEGATE_H
|
||||
|
||||
#include <QtGui>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#include "GridAccount.hpp"
|
||||
|
||||
class TableViewDelegate : public QStyledItemDelegate
|
||||
|
||||
Reference in New Issue
Block a user