summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2008-06-25 16:41:36 +0200
committerSamuel Rødal <sroedal@trolltech.com>2008-06-25 17:34:38 +0200
commit2fe663ef819430735fbadc7a03f9d8f0d630d236 (patch)
tree7ede1fbdd37b6605d65c41e016726d5d6aab54a5
parent0bff84f01e4ab7b3585aa2330429a75e238e24ce (diff)
Make the control widget a dialog and make it movable.
-rw-r--r--openglscene.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/openglscene.cpp b/openglscene.cpp
index 6c63939..51dcf88 100644
--- a/openglscene.cpp
+++ b/openglscene.cpp
@@ -13,7 +13,7 @@
#define GL_MULTISAMPLE 0x809D
#endif
-class Controls : public QWidget
+class Controls : public QDialog
{
Q_OBJECT
@@ -36,7 +36,8 @@ private:
};
Controls::Controls(OpenGLScene *scene)
- : m_scene(scene)
+ : QDialog(0, Qt::CustomizeWindowHint | Qt::WindowTitleHint)
+ , m_scene(scene)
, m_models(new QComboBox)
, m_dir(QLatin1String("models"))
{
@@ -136,8 +137,12 @@ OpenGLScene::OpenGLScene()
controls->setWindowOpacity(0.8);
QGraphicsProxyWidget *item = addWidget(controls);
+ const QPointF offset = item->boundingRect().topLeft();
+
item->translate(10, 10);
+ item->translate(-offset.x(), -offset.y());
item->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
+ item->setFlag(QGraphicsItem::ItemIsMovable);
m_time.start();
}
@@ -233,7 +238,6 @@ QColor OpenGLScene::modelColor() const
return m_modelColor;
}
-
void OpenGLScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
QGraphicsScene::mouseMoveEvent(event);