[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/kvoctrain/kvoctrain
From: Frederik Gladhorn <frederik.gladhorn () gmx ! de>
Date: 2007-08-21 13:54:27
Message-ID: 1187704467.320500.12250.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 702907 by gladhorn:
fix crash when starting entry dialog. still not nice, but works for now. problem was \
that sometimes the proxy indices and sometimes the model ones were used. big thanks \
to jpwhiting
M +2 -0 entry-dialogs/CommonEntryPage.cpp
M +1 -0 kva_init.cpp
M +29 -4 kvoctrain.cpp
--- trunk/KDE/kdeedu/kvoctrain/kvoctrain/entry-dialogs/CommonEntryPage.cpp \
#702906:702907 @@ -426,6 +426,8 @@
}
} else { // multiple entries (don't change the word itself for example)
foreach(QModelIndex selIndex, m_selection) {
+
+ kDebug() << "Changing multiple - row: " << selIndex.row();
//QModelIndex index = m_sortFilterModel->mapToSource(selIndex);
///@todo need to use the selection!!!
--- trunk/KDE/kdeedu/kvoctrain/kvoctrain/kva_init.cpp #702906:702907
@@ -532,6 +532,7 @@
connect(m_tableModel, SIGNAL(modelReset()), m_tableView, \
SLOT(slotModelReset()));
connect(m_tableView->selectionModel(), SIGNAL(currentChanged(const QModelIndex \
&, const QModelIndex &)),
this, SLOT(slotCurrentChanged(const QModelIndex &, const QModelIndex \
&))); +
slotCurrentChanged(m_tableView->currentIndex(), m_tableView->currentIndex());
m_tableView->setColumnHidden(KV_COL_LESS, !Prefs::tableLessonColumnVisible());
--- trunk/KDE/kdeedu/kvoctrain/kvoctrain/kvoctrain.cpp #702906:702907
@@ -158,6 +158,8 @@
void KVocTrainApp::slotEditRow()
{
+kDebug() << "slotEditRow()";
+
slotEditEntry2(m_tableView->currentIndex());
}
@@ -217,6 +219,8 @@
void KVocTrainApp::slotEditEntry(int row, int col)
{
+kDebug() << "slotEditEntry() " << row << ", " << col;
+
if (entryDlg == 0) {
entryDlg = new EntryDlg(this, m_doc);
connect(entryDlg, SIGNAL(sigEditChoice(int)), this, \
SLOT(slotEditCallBack(int))); @@ -232,16 +236,20 @@
void KVocTrainApp::slotEditEntry2(const QModelIndex & index)
{
+kDebug() << "slotEditEntry2(const QModelIndex & index) " << index.row() << ", " << \
index.column(); +
if (index.isValid()) {
/// @todo mapToSource seems to sometimes not work. Especially when starting \
KVocTrain and directly using Edit Entry without selecting anything in the table. This \
happens despite the index has valid row/column entries.
- QModelIndex docIndex = m_sortFilterModel->mapToSource(index);
- slotEditEntry(docIndex.row(), docIndex.column());
+ //QModelIndex docIndex = m_sortFilterModel->mapToSource(index);
+ //slotEditEntry(docIndex.row(), docIndex.column());
+ slotEditEntry(index.row(), index.column());
}
}
void KVocTrainApp::setDataEntryDlg(int row, int col)
{
+kDebug() << "setDataEntryDlg() " << row << ", " << col;
if (entryDlg == 0) {
kError() << "KVocTrainApp::setDataEntryDlg: entryDlg == 0\n";
return;
@@ -254,7 +262,11 @@
col -= KV_EXTRA_COLS;
entryDlg->setData(row, col,
- m_tableView->selectionModel()->selectedRows());
+ QModelIndexList());
+
+/// FIXME reenable
+// entryDlg->setData(row, col,
+// m_tableView->selectionModel()->selectedRows());
m_tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
}
@@ -917,6 +929,19 @@
translationId = 0;
}
+ bool table = false;
+ if (current.model() == m_tableModel) {
+ kDebug() << "KVocTrainApp::slotCurrentChanged(const QModelIndex & current, \
const QModelIndex & previous) model is table: " << current.row() << ", " << \
current.column(); + }
+
+ QModelIndex index = current;
+
+ bool filter = false;
+ if (current.model() == m_sortFilterModel) {
+ kDebug() << "KVocTrainApp::slotCurrentChanged(const QModelIndex & current, \
const QModelIndex & previous) model is proxy"; + index = \
m_sortFilterModel->mapToSource(current); + }
+
// mapToSource seems rather broken for some reason
KEduVocExpression * currentExpression = \
current.data(KVTTableModel::ExpressionRole).value<KEduVocExpression*>();
@@ -928,7 +953,7 @@
m_typeStatusBarLabel->setText(i18n("Type: %1", \
KVTQuery::typeStr(currentExpression->translation(translationId).type())));
if (entryDlg != 0) {
- slotEditEntry2(current);
+ slotEditEntry2(index);
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic