- fix: Press up/down arrow key in the option dialog's left panel won't switch page.
This commit is contained in:
parent
dcd53771d3
commit
eb1a219de6
1
NEWS.md
1
NEWS.md
|
@ -29,6 +29,7 @@ Red Panda C++ Version 2.24
|
|||
- fix: Crash if close file while auto syntax checking.
|
||||
- enhancement: Support sdcc compiler.
|
||||
- enhancement: Autowrap tool output text.
|
||||
- fix: Press up/down arrow key in the option dialog's left panel won't switch page.
|
||||
|
||||
Red Panda C++ Version 2.23
|
||||
|
||||
|
|
|
@ -78,6 +78,9 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
|
|||
ui->widgetsView->setModel(&model);
|
||||
delete m;
|
||||
|
||||
connect(ui->widgetsView->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||
this, &SettingsDialog::onWidgetsViewCurrentChanged);
|
||||
|
||||
model.setHorizontalHeaderLabels(QStringList());
|
||||
|
||||
ui->btnApply->setEnabled(false);
|
||||
|
@ -308,25 +311,7 @@ bool SettingsDialog::setCurrentWidget(const QString &widgetName, const QString &
|
|||
|
||||
void SettingsDialog::on_widgetsView_clicked(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
int i = index.data(GetWidgetIndexRole).toInt();
|
||||
if (i>=0) {
|
||||
saveCurrentPageSettings(true);
|
||||
SettingsWidget* pWidget = mSettingWidgets[i];
|
||||
if (ui->scrollArea->widget()!=nullptr) {
|
||||
QWidget* w = ui->scrollArea->takeWidget();
|
||||
w->setParent(nullptr);
|
||||
}
|
||||
ui->scrollArea->setWidget(pWidget);
|
||||
ui->lblWidgetCaption->setText(QString("%1 > %2").arg(pWidget->group()).arg(pWidget->name()));
|
||||
|
||||
ui->btnApply->setEnabled(false);
|
||||
} else if (model.hasChildren(index)) {
|
||||
ui->widgetsView->expand(index);
|
||||
QModelIndex childIndex = this->model.index(0,0,index);
|
||||
emit ui->widgetsView->clicked(childIndex);
|
||||
}
|
||||
showWidget(index);
|
||||
}
|
||||
|
||||
void SettingsDialog::widget_settings_changed(bool value)
|
||||
|
@ -334,6 +319,11 @@ void SettingsDialog::widget_settings_changed(bool value)
|
|||
ui->btnApply->setEnabled(value);
|
||||
}
|
||||
|
||||
void SettingsDialog::onWidgetsViewCurrentChanged(const QModelIndex &index, const QModelIndex &/*previous*/)
|
||||
{
|
||||
showWidget(index);
|
||||
}
|
||||
|
||||
void SettingsDialog::on_btnCancel_pressed()
|
||||
{
|
||||
this->close();
|
||||
|
@ -388,3 +378,26 @@ void SettingsDialog::closeAndQuit()
|
|||
mAppShouldQuit = true;
|
||||
close();
|
||||
}
|
||||
|
||||
void SettingsDialog::showWidget(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
int i = index.data(GetWidgetIndexRole).toInt();
|
||||
if (i>=0) {
|
||||
saveCurrentPageSettings(true);
|
||||
SettingsWidget* pWidget = mSettingWidgets[i];
|
||||
if (ui->scrollArea->widget()!=nullptr) {
|
||||
QWidget* w = ui->scrollArea->takeWidget();
|
||||
w->setParent(nullptr);
|
||||
}
|
||||
ui->scrollArea->setWidget(pWidget);
|
||||
ui->lblWidgetCaption->setText(QString("%1 > %2").arg(pWidget->group()).arg(pWidget->name()));
|
||||
|
||||
ui->btnApply->setEnabled(false);
|
||||
} else if (model.hasChildren(index)) {
|
||||
ui->widgetsView->expand(index);
|
||||
QModelIndex childIndex = this->model.index(0,0,index);
|
||||
emit ui->widgetsView->clicked(childIndex);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,11 @@ public:
|
|||
|
||||
private slots:
|
||||
void closeAndQuit();
|
||||
void showWidget(const QModelIndex &index);
|
||||
|
||||
void widget_settings_changed(bool value);
|
||||
|
||||
void onWidgetsViewCurrentChanged(const QModelIndex &index, const QModelIndex &previous);
|
||||
void on_widgetsView_clicked(const QModelIndex &index);
|
||||
|
||||
void on_btnCancel_pressed();
|
||||
|
|
Loading…
Reference in New Issue