OpenToonz - An open-source full-featured 2D animation creation software
C
dialog position fix
shun_iwasawa4ada6a9de4c0
diff --git a/toonz/sources/toonz/penciltestpopup.cpp b/toonz/sources/toonz/penciltestpopup.cppindex 02fb1b227..b9d46c331 100644--- a/toonz/sources/toonz/penciltestpopup.cpp+++ b/toonz/sources/toonz/penciltestpopup.cpp@@ -569,17 +569,16 @@ void LevelNameLineEdit::onEditingFinished() {//=============================================================================PencilTestPopup::PencilTestPopup()- : Dialog(TApp::instance()->getMainWindow(), false, false, "PencilTest")- , m_currentCamera(NULL)- , m_cameraImageCapture(NULL)- , m_captureWhiteBGCue(false)- , m_captureCue(false) {+ // set the parent 0 in order to enable the popup behind the main window+ : Dialog(0, false, false, "PencilTest"),+ m_currentCamera(NULL),+ m_cameraImageCapture(NULL),+ m_captureWhiteBGCue(false),+ m_captureCue(false) {setWindowTitle(tr("Camera Capture"));// add maximize button to the dialog- Qt::WindowFlags flags = windowFlags();- flags |= Qt::WindowMaximizeButtonHint;- setWindowFlags(flags);+ setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint);layout()->setSizeConstraint(QLayout::SetNoConstraint);@@ -1241,6 +1240,7 @@ void PencilTestPopup::hideEvent(QHideEvent* event) {if (m_currentCamera->state() == QCamera::LoadedState)m_currentCamera->unload();}+ Dialog::hideEvent(event);}//-----------------------------------------------------------------------------diff --git a/toonz/sources/toonzqt/dvdialog.cpp b/toonz/sources/toonzqt/dvdialog.cppindex 59cfbd865..ee19d2742 100644--- a/toonz/sources/toonzqt/dvdialog.cpp+++ b/toonz/sources/toonzqt/dvdialog.cpp@@ -25,6 +25,7 @@#include <QPainter>#include <QRadioButton>#include <QThread>+#include <QDesktopWidget>// boost includes#include <boost/algorithm/cxx11/any_of.hpp>@@ -286,8 +287,16 @@ Dialog::Dialog(QWidget *parent, bool hasButton, bool hasFixedSize,if (geo != QString()) {QStringList values = geo.split(" ");assert(values.size() == 4);- setGeometry(values.at(0).toInt(), std::max(30, values.at(1).toInt()),- values.at(2).toInt(), values.at(3).toInt());+ // Ensure that the dialog is visible in the screen.+ // The dialog opens with some offset to bottom-right direction+ // if a flag Qt::WindowMaximizeButtonHint is set. (e.g. PencilTestPopup)+ // Therefore, if the dialog is moved to the bottom-end of the screen,+ // it will be got out of the screen on the next launch.+ // The following position adjustment will also prevent such behavior.+ QRect screen = QApplication::desktop()->screenGeometry();+ int x = std::min(values.at(0).toInt(), screen.width() - 50);+ int y = std::min(std::max(30, values.at(1).toInt()), screen.height() - 90);+ setGeometry(x, y, values.at(2).toInt(), values.at(3).toInt());}}