ActivityWidget::ActivityWidget(QWidget* parent /* = NULL */): QWidget(parent), _useReflection(false), _label(NULL), _activityProgressBar(NULL), _reflectionEffect(NULL), _reflectionDistance(8.f) { _label = new QLabel(this); _label->setStyleSheet("color: white;"); _activityProgressBar = new ActivityProgressBar(this); _reflectionEffect = new MirrorGraphicsEffect(); _reflectionEffect->setEnabled(_useReflection); this->setGraphicsEffect(_reflectionEffect); _timer = new QTimer(this); connect(_timer, SIGNAL(timeout()), this, SLOT(update())); connect(_timer, SIGNAL(timeout()), _activityProgressBar, SLOT(update_indicator())); _timer->start(1000/25); setText("Activity description"); QVBoxLayout* layout = new QVBoxLayout(); layout->addWidget(_label); layout->addWidget(_activityProgressBar); setLayout(layout); _label->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); _activityProgressBar->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); QString stylesheet = "QWidget { background: gray; border-radius: 5px; }"; setStyleSheet(stylesheet); showReflection(true); }
ActivityProgressBar::ActivityProgressBar(QWidget* parent /* = NULL */): QProgressBar(parent), _progressBarImageDelta(0.f), _pbIndicator(NULL) { QString stylesheet = "QProgressBar { border: 2px solid black; border-radius: 5px; }"; setStyleSheet(stylesheet); update_indicator(); }
void CollisionShape::volume_changed() { if (indicator.is_valid()) update_indicator(indicator); Object *parent=get_parent(); if (!parent) return; PhysicsBody *physics_body=parent->cast_to<PhysicsBody>(); ERR_EXPLAIN("CollisionShape parent is not of type PhysicsBody"); ERR_FAIL_COND(!physics_body); physics_body->recompute_child_volumes(); }
void GameCanvas::updateInteractionIndicator() { QString action; switch (app->getPossibleInteraction()) { case 0: action="[NIEMOZLIWE]"; break; case 1: action="[NAPRAW]"; break; case 2: action="[OTWORZ]"; break; case 3: action="[ROZMAWIAJ]"; break; case 4: action=app->generic_group_label; break; default: action="[BULLSHIT]"; break; } emit update_indicator(action); }
void CollisionShape::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_SCENE: { if (get_root_node()->get_editor() && !indicator.is_valid()) { indicator=VisualServer::get_singleton()->poly_create(); RID mat=VisualServer::get_singleton()->fixed_material_create(); VisualServer::get_singleton()->material_set_flag( mat, VisualServer::MATERIAL_FLAG_UNSHADED, true ); VisualServer::get_singleton()->material_set_flag( mat, VisualServer::MATERIAL_FLAG_WIREFRAME, true ); VisualServer::get_singleton()->material_set_flag( mat, VisualServer::MATERIAL_FLAG_DOUBLE_SIDED, true ); VisualServer::get_singleton()->material_set_line_width( mat, 3 ); VisualServer::get_singleton()->poly_set_material(indicator,mat,true); update_indicator(indicator); } if (indicator.is_valid()) { indicator_instance=VisualServer::get_singleton()->instance_create2(indicator,get_world()->get_scenario()); VisualServer::get_singleton()->instance_attach_object_instance_ID(indicator_instance,get_instance_ID()); } volume_changed(); } break; case NOTIFICATION_EXIT_SCENE: { if (indicator_instance.is_valid()) { VisualServer::get_singleton()->free(indicator_instance); } volume_changed(); } break; case NOTIFICATION_TRANSFORM_CHANGED: { if (indicator_instance.is_valid()) { VisualServer::get_singleton()->instance_set_transform(indicator_instance,get_global_transform()); } volume_changed(); } break; default: {} } }