From 7c2a67b93e0e2b80bb89985c92a5aafc6b2b3d65 Mon Sep 17 00:00:00 2001 From: am Date: Sat, 5 Sep 2009 18:04:34 +0000 Subject: -started statistics. It compiles, but does nothing at all yet -implemented aboutShemov and aboutQt git-svn-id: file:///var/svn/repos2/shemov/trunk@405 f440f766-f032-0410-8965-dc7d17de2ca0 --- statisticsdialog.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 statisticsdialog.cpp (limited to 'statisticsdialog.cpp') 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 +#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); +} + -- cgit v1.2.3-70-g09d2