blob: 09b9d15f50d687953797f6ac385846374aefb9f9 (
plain)
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
|
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version
2 of the License, or (at your option) any later version.
*/
#include <QTabWidget>
#include <QPainter>
#include <QHBoxLayout>
#include <QSqlQuery>
#include <QVariant>
#include <QFontMetrics>
#include <QApplication>
#include <QPainter>
#include <QPen>
#include <QBrush>
#include <QGradient>
#include "statisticsdialog.h"
StatisticsDialog::StatisticsDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f){
QHBoxLayout *mainLayout = new QHBoxLayout;
mTab = new QTabWidget;
}
QualityStats::QualityStats(QWidget *parent) : QWidget(parent), mMargin(10) {
QSqlQuery q("SELECT DISTINCT(iquality), COUNT(iquality) FROM movies GROUP BY iquality");
q.exec();
while(q.next()){
mQualityDistrib[q.value(0).toInt()] = q.value(1).toInt();
}
QFontMetrics fm(qApp->font());
mBarHeight = fm.height();
}
void QualityStats::paintEvent(QPaintEvent *){
QPainter p(this);
int width = size().width();
QPen pen(Qt::red);
p.setPen(pen);
}
QSize QualityStats::sizeHint() const {
int height = mQualityDistrib.count() * mBarHeight;
height += mQualityDistrib.count() * mMargin;
height += mBarHeight + mMargin;
return QSize(400, height);
}
|