From 402adaf7b02cb4bab691aa2aa729e5f912183148 Mon Sep 17 00:00:00 2001 From: Dmitry Kychanov Date: Tue, 21 Apr 2026 06:40:10 +0400 Subject: [PATCH] Fix device tabs not applying compact mode when hotplugging --- qt/OpenRGBDialog/OpenRGBDialog.cpp | 16 ++++++++++++---- qt/OpenRGBDialog/OpenRGBDialog.h | 2 ++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/qt/OpenRGBDialog/OpenRGBDialog.cpp b/qt/OpenRGBDialog/OpenRGBDialog.cpp index 9a7f1818d..f6b3441a0 100644 --- a/qt/OpenRGBDialog/OpenRGBDialog.cpp +++ b/qt/OpenRGBDialog/OpenRGBDialog.cpp @@ -564,12 +564,16 @@ void OpenRGBDialog::keyPressEvent(QKeyEvent *event) } } -void OpenRGBDialog::resizeEvent(QResizeEvent *event) +bool OpenRGBDialog::isCompactTabMode() { - QScreen* screen = QGuiApplication::primaryScreen(); - qreal scale = screen->devicePixelRatio(); + QScreen* screen = QGuiApplication::primaryScreen(); + qreal scale = screen->devicePixelRatio(); + return (width() < (700 * scale)); +} - bool compact_mode = (event->size().width() < (700 * scale)); +void OpenRGBDialog::resizeEvent(QResizeEvent *event) +{ + bool compact_mode = isCompactTabMode(); for(int i = 0; i < ui->DevicesTabBar->count(); i++) { @@ -1090,6 +1094,8 @@ void OpenRGBDialog::UpdateDevicesList() \*-----------------------------------------*/ TabLabel* NewTabLabel = new TabLabel(OpenRGBFont::GetIconIDFromDeviceType(controllers[controller_idx]->GetDeviceType()), (char *)controllers[controller_idx]->GetName().c_str(), (char *)context, false); + NewTabLabel->SetTextHidden(isCompactTabMode()); + ui->DevicesTabBar->tabBar()->setTabButton(ui->DevicesTabBar->count() - 1, QTabBar::LeftSide, NewTabLabel); /*-----------------------------------------*\ @@ -1149,6 +1155,8 @@ void OpenRGBDialog::UpdateDevicesList() \*---------------------------------------------*/ TabLabel* NewTabLabel = new TabLabel(OpenRGBFont::GetIconIDFromDeviceType(controllers[controller_idx]->GetDeviceType()), (char *)controllers[controller_idx]->GetName().c_str(), (char *)context, false); + NewTabLabel->SetTextHidden(isCompactTabMode()); + ui->InformationTabBar->tabBar()->setTabButton(ui->InformationTabBar->count() - 1, QTabBar::LeftSide, NewTabLabel); ui->InformationTabBar->tabBar()->setTabToolTip(ui->InformationTabBar->count() - 1, QString::fromStdString(controllers[controller_idx]->GetName())); diff --git a/qt/OpenRGBDialog/OpenRGBDialog.h b/qt/OpenRGBDialog/OpenRGBDialog.h index 9c2a22fd1..3e208954c 100644 --- a/qt/OpenRGBDialog/OpenRGBDialog.h +++ b/qt/OpenRGBDialog/OpenRGBDialog.h @@ -143,6 +143,8 @@ private: void OnSuspend() override; void OnResume() override; + bool isCompactTabMode(); + private slots: void on_Exit(); void on_LightsOff();