summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2008-06-25 20:12:47 +0200
committerSamuel Rødal <sroedal@trolltech.com>2008-06-25 20:14:54 +0200
commitf45c90cd7a9ad1129c8492687e77a819fc72b186 (patch)
tree05633a576e3ba158d5bc52466494b76506fa71b6
parent6258d5a835a0432931bafe035da644fa61e7f1e7 (diff)
Don't resize statistics widget.
-rw-r--r--model.h2
-rw-r--r--openglscene.cpp8
2 files changed, 6 insertions, 4 deletions
diff --git a/model.h b/model.h
index b1ef24e..ed759b7 100644
--- a/model.h
+++ b/model.h
@@ -15,7 +15,7 @@ public:
void render(bool wireframe = false, bool normals = false) const;
- int triangles() const { return m_pointIndices.size() / 3; }
+ int faces() const { return m_pointIndices.size() / 3; }
int edges() const { return m_edgeIndices.size() / 2; }
int points() const { return m_points.size(); }
diff --git a/openglscene.cpp b/openglscene.cpp
index 2a10c18..46fa21d 100644
--- a/openglscene.cpp
+++ b/openglscene.cpp
@@ -15,7 +15,7 @@ OpenGLScene::OpenGLScene()
, m_lightPosition(0.0f)
, m_modelColor(QColor::fromCmykF(0.40, 0.0, 1.0, 0.0))
, m_backgroundColor(QColor::fromCmykF(0.39, 0.39, 0.0, 0.0))
- , m_model(new Model)
+ , m_model(0)
, m_lastTime(0)
, m_angularMomentum(0, 40, 0)
, m_dir(QLatin1String("models"), QLatin1String("*.obj"), QDir::Size | QDir::Reversed, QDir::Files)
@@ -64,6 +64,7 @@ OpenGLScene::OpenGLScene()
QWidget *statistics = new QDialog(0, Qt::CustomizeWindowHint | Qt::WindowTitleHint);
QVBoxLayout *statisticsLayout = new QVBoxLayout(statistics);
+ statisticsLayout->setMargin(20);
for (int i = 0; i < 3; ++i) {
m_labels[i] = new QLabel;
@@ -72,7 +73,6 @@ OpenGLScene::OpenGLScene()
statistics->setWindowOpacity(0.8);
statistics->setWindowTitle(tr("Model info"));
- statistics->resize(controls->width(), 0);
QGraphicsItem *statisticsItem = addWidget(statistics);
statisticsItem->translate(10 - rect.x(), 20 + rect.height() - rect.y());
@@ -82,6 +82,8 @@ OpenGLScene::OpenGLScene()
item->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
}
+ setModel(new Model);
+
m_time.start();
}
@@ -162,7 +164,7 @@ void OpenGLScene::setModel(Model *model)
m_labels[0]->setText(tr("Points: %0").arg(m_model->points()));
m_labels[1]->setText(tr("Edges: %0").arg(m_model->edges()));
- m_labels[2]->setText(tr("Triangles: %0").arg(m_model->triangles()));
+ m_labels[2]->setText(tr("Faces: %0").arg(m_model->faces()));
update();
}