/* 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 #include #include #include #include #include #include #include #include #include #include #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); }