mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-05-24 22:45:55 -04:00
Fix device tabs not applying compact mode when hotplugging
This commit is contained in:
committed by
Adam Honse
parent
c7c92d0647
commit
402adaf7b0
@@ -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()));
|
||||
|
||||
|
||||
@@ -143,6 +143,8 @@ private:
|
||||
void OnSuspend() override;
|
||||
void OnResume() override;
|
||||
|
||||
bool isCompactTabMode();
|
||||
|
||||
private slots:
|
||||
void on_Exit();
|
||||
void on_LightsOff();
|
||||
|
||||
Reference in New Issue
Block a user