mirror of
https://github.com/edisionnano/QDiskInfo.git
synced 2026-03-07 20:09:55 +03:00
Fix cyclic navigation enabling the next button even if there's only one drive
This commit is contained in:
@@ -170,8 +170,16 @@ void MainWindow::onPrevButtonClicked()
|
||||
|
||||
void MainWindow::updateNavigationButtons(qsizetype currentIndex)
|
||||
{
|
||||
prevButton->setEnabled(currentIndex > 0 || (ui->actionCyclic_Navigation->isChecked() && buttonGroup->buttons().size() > 1)); // We can use setVisible if we want to mimic CrystalDiskInfo
|
||||
nextButton->setEnabled(currentIndex < buttonGroup->buttons().size() - 1 || ui->actionCyclic_Navigation->isChecked());
|
||||
const qsizetype totalButtons = buttonGroup->buttons().size();
|
||||
const bool isCyclic = ui->actionCyclic_Navigation->isChecked();
|
||||
|
||||
prevButton->setEnabled( // We can use setVisible if we want to mimic CrystalDiskInfo
|
||||
(currentIndex > 0) || (isCyclic && totalButtons > 1)
|
||||
);
|
||||
|
||||
nextButton->setEnabled(
|
||||
(currentIndex < totalButtons - 1) || (isCyclic && totalButtons > 1)
|
||||
);
|
||||
}
|
||||
|
||||
void MainWindow::updateUI()
|
||||
|
||||
Reference in New Issue
Block a user