Merge pull request #2080 from Cacodemon345/newqt
qt: Status bar and window fixes
This commit is contained in:
@@ -172,9 +172,6 @@ struct MachineStatus::States {
|
|||||||
Pixmaps pixmaps;
|
Pixmaps pixmaps;
|
||||||
|
|
||||||
States(QObject* parent) {
|
States(QObject* parent) {
|
||||||
#ifdef _WIN32
|
|
||||||
pixmap_size = QSize(16, 16) * qobject_cast<MainWindow*>(parent->parent())->screen()->devicePixelRatio();
|
|
||||||
#endif
|
|
||||||
pixmaps.cartridge.load("/cartridge%1.ico");
|
pixmaps.cartridge.load("/cartridge%1.ico");
|
||||||
pixmaps.cassette.load("/cassette%1.ico");
|
pixmaps.cassette.load("/cassette%1.ico");
|
||||||
pixmaps.floppy_disabled.normal = ProgSettings::loadIcon(QStringLiteral("/floppy_disabled.ico")).pixmap(pixmap_size);
|
pixmaps.floppy_disabled.normal = ProgSettings::loadIcon(QStringLiteral("/floppy_disabled.ico")).pixmap(pixmap_size);
|
||||||
|
@@ -130,6 +130,10 @@ main_thread_fn()
|
|||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
|
app.setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
|
#endif
|
||||||
qt_set_sequence_auto_mnemonic(false);
|
qt_set_sequence_auto_mnemonic(false);
|
||||||
Q_INIT_RESOURCE(qt_resources);
|
Q_INIT_RESOURCE(qt_resources);
|
||||||
Q_INIT_RESOURCE(qt_translations);
|
Q_INIT_RESOURCE(qt_translations);
|
||||||
|
@@ -418,7 +418,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
ui->toolBar->setIconSize(QSize(16 * screen()->devicePixelRatio(), 16 * screen()->devicePixelRatio()));
|
ui->toolBar->setIconSize(QSize(16 * screen()->devicePixelRatio(), 16 * screen()->devicePixelRatio()));
|
||||||
ui->statusbar->resize(ui->statusbar->width(), ui->statusbar->sizeHint().height() * screen()->devicePixelRatio());
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,7 +459,7 @@ void MainWindow::showEvent(QShowEvent *event) {
|
|||||||
if (shownonce) return;
|
if (shownonce) return;
|
||||||
shownonce = true;
|
shownonce = true;
|
||||||
if (window_remember && !QApplication::platformName().contains("wayland")) {
|
if (window_remember && !QApplication::platformName().contains("wayland")) {
|
||||||
setGeometry(window_x, window_y, window_w, window_h + menuBar()->height() + (hide_status_bar ? 0 : statusBar()->height()));
|
setGeometry(window_x, window_y, window_w, window_h + menuBar()->height() + (hide_status_bar ? 0 : statusBar()->height()) + (hide_tool_bar ? 0 : ui->toolBar->height()));
|
||||||
}
|
}
|
||||||
if (vid_resize == 2) {
|
if (vid_resize == 2) {
|
||||||
setFixedSize(fixed_size_x, fixed_size_y
|
setFixedSize(fixed_size_x, fixed_size_y
|
||||||
@@ -471,8 +470,11 @@ void MainWindow::showEvent(QShowEvent *event) {
|
|||||||
scrnsz_x = fixed_size_x;
|
scrnsz_x = fixed_size_x;
|
||||||
scrnsz_y = fixed_size_y;
|
scrnsz_y = fixed_size_y;
|
||||||
}
|
}
|
||||||
else if (window_remember) {
|
else if (window_remember && vid_resize == 1) {
|
||||||
emit resizeContents(window_w, window_h);
|
resize(window_w, window_h
|
||||||
|
+ menuBar()->height()
|
||||||
|
+ (hide_status_bar ? 0 : statusBar()->height())
|
||||||
|
+ (hide_tool_bar ? 0 : ui->toolBar->height()) + 1);
|
||||||
scrnsz_x = window_w;
|
scrnsz_x = window_w;
|
||||||
scrnsz_y = window_h;
|
scrnsz_y = window_h;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user