diff options
Diffstat (limited to 'statisticsdialog.cpp')
-rw-r--r-- | statisticsdialog.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/statisticsdialog.cpp b/statisticsdialog.cpp new file mode 100644 index 0000000..09b9d15 --- /dev/null +++ b/statisticsdialog.cpp @@ -0,0 +1,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); +} + |