refactor: ActionDialog, Only allow resize when the screen list is visible

This commit is contained in:
sithlord48 2025-01-10 15:37:25 -05:00 committed by Nick Bolton
parent 328a719d49
commit 1dadc2ddf4
2 changed files with 10 additions and 1 deletions

View file

@ -114,6 +114,14 @@ void ActionDialog::accept()
QDialog::accept();
}
void ActionDialog::updateSize()
{
setMaximumSize(QSize(16777215, 1677215));
adjustSize();
if (!isKeyAction(ui->comboActionType->currentIndex()))
setMaximumSize(size());
}
void ActionDialog::keySequenceChanged()
{
ui->listScreens->setEnabled(!ui->keySequenceWidget->keySequence().isMouseButton());
@ -129,7 +137,7 @@ void ActionDialog::actionTypeChanged(int index)
ui->comboSwitchToScreen->setVisible(index == ActionTypes::SwitchTo);
ui->comboSwitchInDirection->setVisible(index == ActionTypes::SwitchInDirection);
ui->comboLockCursorToScreen->setVisible(index == ActionTypes::ModifyCursorLock);
QTimer::singleShot(1, this, &ActionDialog::adjustSize);
QTimer::singleShot(1, this, &ActionDialog::updateSize);
}
bool ActionDialog::isKeyAction(int index)

View file

@ -53,6 +53,7 @@ protected slots:
void accept() override;
private:
void updateSize();
void keySequenceChanged();
void actionTypeChanged(int index);
bool isKeyAction(int index);