[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/kwordquiz/src
From: Peter Hedlund <peter () peterandlinda ! com>
Date: 2010-03-18 17:21:04
Message-ID: 20100318172104.47ACEAC855 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1104818 by hedlund:
Indicate a linked sound with a little square in the upper right corner of a cell.
M +3 -2 kwqtabledelegate.cpp
M +1 -31 kwqtablemodel.cpp
--- trunk/KDE/kdeedu/kwordquiz/src/kwqtabledelegate.cpp #1104817:1104818
@@ -19,8 +19,7 @@
#include "kwqtabledelegate.h"
-#include <QPainter>
-#include <QDebug>
+#include <QtGui/QPainter>
#include <KLineEdit>
@@ -154,6 +153,8 @@
}
drawDisplay(painter, opt, opt.rect, index.data(Qt::DisplayRole).toString());
+ if (!index.data(KWQTableModel::SoundRole).isNull())
+ painter->fillRect(option.rect.right() - 3, option.rect.top(), 4, 4, Qt::red);
drawFocus(painter, opt, option.rect);
painter->restore();
--- trunk/KDE/kdeedu/kwordquiz/src/kwqtablemodel.cpp #1104817:1104818
@@ -19,8 +19,6 @@
#include "kwqtablemodel.h"
-#include <QtGui/QPainter>
-
#include <KLocale>
#include <KIcon>
@@ -51,11 +49,8 @@
if (!index.isValid())
return QVariant();
- int l = 0;
QPixmap ip;
- QPixmap sp;
QString image;
- QString sound;
switch (role) {
case Qt::FontRole:
@@ -71,34 +66,9 @@
ip = QPixmap(image).scaled(QSize(22, 22), Qt::KeepAspectRatio);
m_decorationCache->insert(image, ip);
}
- l++;
}
+ return ip;
- sound = m_doc->lesson()->entries(KEduVocLesson::Recursive).value(index.row())->translation(index.column())->soundUrl().toLocalFile();
- if (!sound.isEmpty()) {
- sp = QPixmap(KIcon("audio-x-generic").pixmap(QSize(22, 22), QIcon::Active));
- l++;
- }
-
- if (l == 0)
- return QVariant();
-
- if (l == 1) {
- if (sp.isNull())
- return ip;
- else
- return sp;
- }
-
- if (l == 2) {
- QPixmap combined(QSize(46, 22));
- combined.fill(Qt::transparent);
- QPainter merger(&combined);
- merger.drawPixmap(0, 0, sp);
- merger.drawPixmap(24, 0, ip);
- return combined;
- }
-
case KWQTableModel::ImageRole:
return m_doc->lesson()->entries(KEduVocLesson::Recursive).value(index.row())->translation(index.column())->imageUrl().toLocalFile();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic