r.nikonov Posted November 2, 2016 Share Posted November 2, 2016 Hello. I tried to use a viewport in our application and met two problems. I used ViewportWidgetQt class from examples, Qt 5.5.1, Unigine 2.3. 1) As I can see, viewport don't send to Unigine keyboards and mouse events. So, I can not use standard player controls (i.e. of PlayerSpectator) to move camera and I should implement it in C++ code or there is some way to do it? 2) Gui buttons are drawed only in main window, not in viewport. For my task, I wanted to see them in both windows or may be only in viewport. And even if buttons would be drawed, I could not click on them, because of the problem from first question. Link to comment
silent Posted November 3, 2016 Share Posted November 3, 2016 Hi, Our controls are indeed designed to be used with only main viewport. You can try to pass controls to the Qt vieweport by yourself - something like that: void ViewportWidgetQt::mousePressEvent(QMouseEvent *event) { if (event->button() & Qt::LeftButton) mouse_button |= Unigine::App::BUTTON_LEFT; ... Unigine::App::get()->setMouseButton(mouse_button); QWidget::mousePressEvent(event); } With that method I think you should be able to get controls working with viewports. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
r.nikonov Posted November 3, 2016 Author Share Posted November 3, 2016 Thank you. But can I draw Unigine GUI button in viewport? Link to comment
silent Posted November 3, 2016 Share Posted November 3, 2016 Hi, Each viewport should have their own Gui (you can get it via getGui()): WidgetButtonPtr b = WidgetButton::create("test"); vieport->getGui()->addChild(b->getWidget()); Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Recommended Posts