File: playlistviewitem.cpp

package info (click to toggle)
qbble 1.2-10
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 108 kB
  • ctags: 143
  • sloc: cpp: 735; ansic: 138; makefile: 50
file content (64 lines) | stat: -rw-r--r-- 1,430 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "playlistviewitem.h"
#include <qpainter.h>
#include <iostream>
using namespace std;

playlistViewItem::playlistViewItem(QListView *parent, unsigned int id, unsigned int time, QString a, QString b, QString c, QString d, QString e, QString f, QString g, QString h)
	: QListViewItem(parent, a, b, c, d, e, f, g, h), m_id(id), m_time(time), m_bold(false)
{
	
}

playlistViewItem::~playlistViewItem()
{

}

unsigned int playlistViewItem::getid() const
{
	return m_id;
}

QString playlistViewItem::key(int column, bool ascending) const
{
	QString temp;
    switch (column)
    {
    case 0:
        temp.sprintf("%9d", m_id);
        break;
    case 1:
        // temp = m_info.m_title.c_str();
        return QListViewItem::key(column, ascending);
	case 2:
        temp.sprintf("%9d", m_time / 1000);
        break;
    case 3:
        return QListViewItem::key(column, ascending);
    
    }
    return temp;           
}

void playlistViewItem::paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align )
{
	// cout << "Reimplemented paintCell called" << endl;
	// p->setFont( QFont("Times", 10, QFont::Bold) );
	QFont fnt(p->font());
	if (m_bold)
		fnt.setBold(true);
	else
		fnt.setBold(false);
	p->setFont(	fnt );
	QListViewItem::paintCell(p, cg, column, width, align);
}

bool playlistViewItem::isBold() const
{
	return m_bold;
}

void playlistViewItem::setBold(bool value)
{
	m_bold = value;
}