summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-12-08 05:33:09 +0100
committerStanislaw Halik <sthalik@misaki.pl>2016-12-08 05:33:09 +0100
commit4acd40cd2997b2702d9ab411a0c85d1a92a6189d (patch)
treef89b76a755501d31d800a8092b7ae5fd3e4483e8 /gui
parent982c7841be3e677d575fea9136f1b46f2d1bc1fe (diff)
gui: prevent stderr whining if controls don't fit at runtime
Diffstat (limited to 'gui')
-rw-r--r--gui/main-window.cpp42
-rw-r--r--gui/mapping-window.hpp3
-rw-r--r--gui/options-dialog.hpp3
-rw-r--r--gui/options-dialog.ui4
4 files changed, 32 insertions, 20 deletions
diff --git a/gui/main-window.cpp b/gui/main-window.cpp
index 59dc7a7a..d760783b 100644
--- a/gui/main-window.cpp
+++ b/gui/main-window.cpp
@@ -42,8 +42,14 @@ MainWindow::MainWindow() :
menu_action_mappings(&tray_menu)
{
ui.setupUi(this);
- setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | windowFlags());
- setFixedSize(size());
+
+ {
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ adjustSize();
+ setFixedSize(size());
+ setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | windowFlags());
+ }
+
updateButtonState(false, false);
if (group::ini_directory().size() == 0)
@@ -567,19 +573,21 @@ bool mk_dialog(mem<dylib> lib, ptr<t>& orig)
{
if (orig && orig->isVisible())
{
- orig->show();
- orig->raise();
+ QDialog& d = *orig;
+ d.show();
+ d.raise();
return false;
}
if (lib && lib->Dialog)
{
t* dialog = reinterpret_cast<t*>(lib->Dialog());
- dialog->setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
- // HACK: prevent stderr whining by adding a few pixels
- dialog->setFixedSize(dialog->size() + QSize(4, 4));
- dialog->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- dialog->show();
+ QDialog& d = *dialog;
+ d.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ d.adjustSize();
+ d.setFixedSize(d.size());
+ d.setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | d.windowFlags());
+ d.show();
orig.reset(dialog);
@@ -614,18 +622,20 @@ static bool mk_window(ptr<t>* place, Args&&... params)
{
if (*place && (*place)->isVisible())
{
- (*place)->show();
- (*place)->raise();
+ QDialog& d = **place;
+ d.show();
+ d.raise();
return false;
}
else
{
*place = make_unique<t>(std::forward<Args>(params)...);
- (*place)->setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
- // HACK: prevent stderr whining by adding a few pixels
- (*place)->setFixedSize((*place)->size() + QSize(4, 4));
- (*place)->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- (*place)->show();
+ QDialog& d = **place;
+ d.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ d.adjustSize();
+ d.setFixedSize(d.size());
+ d.setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | d.windowFlags());
+ d.show();
return true;
}
}
diff --git a/gui/mapping-window.hpp b/gui/mapping-window.hpp
index 7648c994..06d969cc 100644
--- a/gui/mapping-window.hpp
+++ b/gui/mapping-window.hpp
@@ -4,11 +4,12 @@
#include "ui_mapping-window.h"
#include <QWidget>
+#include <QDialog>
#include <QShowEvent>
#include <QCloseEvent>
#include <QCheckBox>
-class MapWidget final : public QWidget
+class MapWidget final : public QDialog
{
Q_OBJECT
public:
diff --git a/gui/options-dialog.hpp b/gui/options-dialog.hpp
index 5f6b64e0..8c62b278 100644
--- a/gui/options-dialog.hpp
+++ b/gui/options-dialog.hpp
@@ -3,10 +3,11 @@
#include "ui_options-dialog.h"
#include "logic/shortcuts.h"
#include <QObject>
+#include <QDialog>
#include <QWidget>
#include <functional>
-class OptionsDialog : public QWidget
+class OptionsDialog : public QDialog
{
Q_OBJECT
signals:
diff --git a/gui/options-dialog.ui b/gui/options-dialog.ui
index f23dd63f..2168fa8d 100644
--- a/gui/options-dialog.ui
+++ b/gui/options-dialog.ui
@@ -33,7 +33,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -478,7 +478,7 @@
</size>
</property>
<property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Specify an angle to rotate position tracking. It lets the tracker avoid moving on the X and Y axes when zooming, since camera isn't mounted perfectly in front of the model, but above or below.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ <string>Specify an angle to rotate position tracking. It lets the tracker avoid moving on the X and Y axes when zooming, since camera isn't mounted perfectly in front of the model, but above or below.</string>
</property>
<property name="alignment">
<set>Qt::AlignJustify|Qt::AlignVCenter</set>