qt: Remove fullscreen status icons

This commit is contained in:
Alexander Babikov
2024-02-13 21:13:25 +05:00
parent 5acec5dfa4
commit 224daa92d0
12 changed files with 1 additions and 104 deletions

View File

@@ -17,15 +17,11 @@
#include "qt_renderercommon.hpp"
#include "qt_mainwindow.hpp"
#include "qt_machinestatus.hpp"
#include <QPainter>
#include <QWidget>
#include <QEvent>
#include <QApplication>
#include <QFontMetrics>
#include <QStatusBar>
#include <QLayout>
#include <cmath>
@@ -33,8 +29,6 @@ extern "C" {
#include <86box/86box.h>
#include <86box/plat.h>
#include <86box/video.h>
int status_icons_fullscreen = 0;
}
RendererCommon::RendererCommon() = default;
@@ -137,52 +131,6 @@ RendererCommon::onResize(int width, int height)
monitors[r_monitor_index].mon_res_y = (double) destination.height();
}
void RendererCommon::drawStatusBarIcons(QPainter* painter)
{
uint32_t x = 0;
auto prevcompositionMode = painter->compositionMode();
painter->setCompositionMode(QPainter::CompositionMode::CompositionMode_SourceOver);
for (int i = 0; i < main_window->statusBar()->children().count(); i++) {
QLabel* label = qobject_cast<QLabel*>(main_window->statusBar()->children()[i]);
if (label) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const QPixmap pixmap = label->pixmap();
#elif QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
const QPixmap pixmap = label->pixmap(Qt::ReturnByValue);
#else
const QPixmap pixmap = (label->pixmap() ? *label->pixmap() : QPixmap());
#endif
if (!pixmap.isNull()) {
painter->setBrush(QColor::fromRgbF(0, 0, 0, 1.));
painter->fillRect(x, painter->device()->height() - pixmap.height() - 5,
pixmap.width(), pixmap.height() + 5, QColor::fromRgbF(0, 0, 0, .5));
painter->drawPixmap(x + main_window->statusBar()->layout()->spacing() / 2,
painter->device()->height() - pixmap.height() - 3, pixmap);
x += pixmap.width();
if (i <= main_window->statusBar()->children().count() - 3) {
painter->fillRect(x, painter->device()->height() - pixmap.height() - 5,
main_window->statusBar()->layout()->spacing(), pixmap.height() + 5,
QColor::fromRgbF(0, 0, 0, .5));
x += main_window->statusBar()->layout()->spacing();
} else
painter->fillRect(x, painter->device()->height() - pixmap.height() - 4, 4,
pixmap.height() + 4, QColor::fromRgbF(0, 0, 0, .5));
}
}
}
if (main_window->status->getMessage().isEmpty() == false) {
auto curStatusMsg = main_window->status->getMessage();
auto textSize = painter->fontMetrics().size(Qt::TextSingleLine, QChar(' ') + curStatusMsg + QChar(' '));
painter->setPen(QColor(0, 0, 0, 127));
painter->fillRect(painter->device()->width() - textSize.width(), painter->device()->height() - textSize.height(),
textSize.width(), textSize.height(), QColor(0, 0, 0, 127));
painter->setPen(QColor(255, 255, 255, 255));
painter->drawText(QRectF(painter->device()->width() - textSize.width(), painter->device()->height() - textSize.height(),
textSize.width(), textSize.height()), Qt::TextSingleLine, QChar(' ') + curStatusMsg + QChar(' '));
}
painter->setCompositionMode(prevcompositionMode);
}
bool
RendererCommon::eventDelegate(QEvent *event, bool &result)
{