Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/entitywidget.cc')
-rw-r--r--src/entitywidget.cc63
1 files changed, 3 insertions, 60 deletions
diff --git a/src/entitywidget.cc b/src/entitywidget.cc
index 50056c0..c903ea8 100644
--- a/src/entitywidget.cc
+++ b/src/entitywidget.cc
@@ -18,8 +18,6 @@ EntityWidget::EntityWidget(QWidget *parent) : QWidget(parent)
{
is_selected = false;
is_dragging = false;
-
- entity_radius = 0;
}
void EntityWidget::set_selected(const bool selected)
@@ -28,63 +26,6 @@ void EntityWidget::set_selected(const bool selected)
update();
}
-void EntityWidget::set_label(const QString &label)
-{
- entity_label = label;
-}
-
-void EntityWidget::set_name(const QString &name)
-{
- entity_name = name;
-}
-
-void EntityWidget::set_radius(const float radius)
-{
- entity_radius = radius;
-
-}
-
-void EntityWidget::set_location(const float x, const float y, const float z)
-{
- entity_location[0] = x;
- entity_location[1] = y;
- entity_location[2] = z;
-}
-
-void EntityWidget::set_properties(const QString &properties)
-{
- entity_properties = properties;
-}
-
-void EntityWidget::add_property(const QString &key, const QString &value)
-{
- entity_properties += key;
- entity_properties += '=';
- entity_properties += value;
- entity_properties += '\n';
-}
-
-void EntityWidget::add_subsection(const QString &name)
-{
- if (entity_subsections.size()) {
- entity_subsections += '\n';
- }
-
- entity_subsections += '[';
- entity_subsections += name;
- entity_subsections += ']';
- entity_subsections += '\n';
-
-}
-
-void EntityWidget::add_subsection_property(const QString &key, const QString &value)
-{
- entity_subsections += key;
- entity_subsections += '=';
- entity_subsections += value;
- entity_subsections += '\n';
-}
-
void EntityWidget::paintEvent(QPaintEvent *event)
{
QPen pen(Qt::black, 1, Qt::SolidLine);
@@ -104,7 +45,8 @@ void EntityWidget::mousePressEvent(QMouseEvent *event)
if (event->button() == Qt::LeftButton) {
//qDebug() << "clicked entity " << name();
event->accept();
- is_dragging = true;
+ if (is_selected)
+ is_dragging = true;
emit clicked(this);
} else {
event->ignore();
@@ -122,6 +64,7 @@ void EntityWidget::mouseReleaseEvent(QMouseEvent *event)
void EntityWidget::mouseMoveEvent(QMouseEvent *event)
{
if (is_dragging) {
+ // TODO add delay
emit dragged(this, event->pos().x(), event->pos().y());
}
}