Skip to content

Commit

Permalink
[71_9] Maximized the window when the screen ratio > 0.95
Browse files Browse the repository at this point in the history
  • Loading branch information
da-liii authored Dec 18, 2023
1 parent ec75d23 commit f1dcbfd
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/Plugins/Qt/qt_window_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#include "message.hpp"
#include "tm_window.hpp"

#include <QApplication>
#include <QDockWidget>
#include <QScreen>
#include <QVariant>
#include <QWidget>

Expand Down Expand Up @@ -165,7 +167,24 @@ qt_window_widget_rep::send (slot s, blackbox val) {
if (qwid) {
if (flag) {
// QWidget* master = QApplication::activeWindow ();
qwid->show ();
QMainWindow* win= qobject_cast<QMainWindow*> (qwid);
if (win == nullptr) {
qwid->show ();
}
else {
int screen_w=
QApplication::primaryScreen ()->availableSize ().width ();
int screen_h=
QApplication::primaryScreen ()->availableSize ().height ();
double ratio=
(1.0 * qwid->width () * qwid->height ()) / (screen_w * screen_h);
if (ratio > 0.95) {
qwid->showMaximized ();
}
else {
qwid->show ();
}
}
// qwid->activateWindow();
// WEIRD: in Ubuntu uncommenting the above line causes the main window
// to be opened in the background.
Expand Down

0 comments on commit f1dcbfd

Please sign in to comment.