Fix device tabs not applying compact mode when hotplugging

This commit is contained in:
Dmitry Kychanov
2026-04-21 06:40:10 +04:00
committed by Adam Honse
parent c7c92d0647
commit 402adaf7b0
2 changed files with 14 additions and 4 deletions

View File

@@ -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()));

View File

@@ -143,6 +143,8 @@ private:
void OnSuspend() override;
void OnResume() override;
bool isCompactTabMode();
private slots:
void on_Exit();
void on_LightsOff();