implemented action resizable window
This commit is contained in:
@@ -79,8 +79,13 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
connect(this, &MainWindow::resizeContents, this, [this](int w, int h) {
|
connect(this, &MainWindow::resizeContents, this, [this](int w, int h) {
|
||||||
if (!QApplication::platformName().contains("eglfs")) {
|
if (!QApplication::platformName().contains("eglfs")) {
|
||||||
|
int modifiedHeight = h + menuBar()->height() + statusBar()->height();
|
||||||
ui->stackedWidget->resize(w, h);
|
ui->stackedWidget->resize(w, h);
|
||||||
resize(w, h + menuBar()->height() + statusBar()->height());
|
if (vid_resize == 0) {
|
||||||
|
setFixedSize(w, modifiedHeight);
|
||||||
|
} else {
|
||||||
|
resize(w, modifiedHeight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -98,6 +103,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
ui->actionKeyboard_requires_capture->setChecked(kbd_req_capture);
|
ui->actionKeyboard_requires_capture->setChecked(kbd_req_capture);
|
||||||
ui->actionRight_CTRL_is_left_ALT->setChecked(rctrl_is_lalt);
|
ui->actionRight_CTRL_is_left_ALT->setChecked(rctrl_is_lalt);
|
||||||
|
ui->actionResizable_window->setChecked(vid_resize > 0);
|
||||||
|
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
ui->gles->setFocusPolicy(Qt::NoFocus);
|
ui->gles->setFocusPolicy(Qt::NoFocus);
|
||||||
@@ -738,6 +744,7 @@ bool MainWindow::eventFilter(QObject* receiver, QEvent* event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QMainWindow::eventFilter(receiver, event);
|
return QMainWindow::eventFilter(receiver, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -811,3 +818,14 @@ void MainWindow::focusOutEvent(QFocusEvent* event)
|
|||||||
{
|
{
|
||||||
this->releaseKeyboard();
|
this->releaseKeyboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionResizable_window_triggered(bool checked) {
|
||||||
|
if (checked) {
|
||||||
|
vid_resize = 1;
|
||||||
|
setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||||
|
} else {
|
||||||
|
vid_resize = 0;
|
||||||
|
}
|
||||||
|
emit resizeContents(scrnsz_x, scrnsz_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -56,6 +56,7 @@ private slots:
|
|||||||
void on_actionHardware_Renderer_OpenGL_ES_triggered();
|
void on_actionHardware_Renderer_OpenGL_ES_triggered();
|
||||||
void on_actionHardware_Renderer_OpenGL_triggered();
|
void on_actionHardware_Renderer_OpenGL_triggered();
|
||||||
void on_actionSoftware_Renderer_triggered();
|
void on_actionSoftware_Renderer_triggered();
|
||||||
|
void on_actionResizable_window_triggered(bool checked);
|
||||||
|
|
||||||
void refreshMediaMenu();
|
void refreshMediaMenu();
|
||||||
void showMessage_(const QString& header, const QString& message);
|
void showMessage_(const QString& header, const QString& message);
|
||||||
|
@@ -7,10 +7,6 @@
|
|||||||
|
|
||||||
#include "qt_mainwindow.hpp"
|
#include "qt_mainwindow.hpp"
|
||||||
|
|
||||||
std::atomic_int resize_pending = 0;
|
|
||||||
std::atomic_int resize_w = 0;
|
|
||||||
std::atomic_int resize_h = 0;
|
|
||||||
|
|
||||||
MainWindow* main_window = nullptr;
|
MainWindow* main_window = nullptr;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -46,10 +42,6 @@ void mouse_poll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void plat_resize(int w, int h) {
|
void plat_resize(int w, int h) {
|
||||||
resize_w = w;
|
|
||||||
resize_h = h;
|
|
||||||
resize_pending = 1;
|
|
||||||
|
|
||||||
main_window->resizeContents(w, h);
|
main_window->resizeContents(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user