##// END OF EJS Templates
Settings binding (2)...
Settings binding (2) Makes widget for general settings a ISqpSettingsBindable and handles load and save

File last commit:

r464:236a0bfac326
r467:bf267432931b
Show More
SqpSettingsDialog.cpp
29 lines | 863 B | text/x-c | CppLexer
/ gui / src / Settings / SqpSettingsDialog.cpp
Alexandre Leroux
Creates settings dialog and adds it to a new menu in MainWindow...
r463 #include "Settings/SqpSettingsDialog.h"
#include "ui_SqpSettingsDialog.h"
SqpSettingsDialog::SqpSettingsDialog(QWidget *parent)
: QDialog{parent}, ui{new Ui::SqpSettingsDialog}
{
ui->setupUi(this);
// Connection to change the current page to the selection of an entry in the list
connect(ui->listWidget, &QListWidget::currentRowChanged, ui->stackedWidget,
&QStackedWidget::setCurrentIndex);
}
SqpSettingsDialog::~SqpSettingsDialog() noexcept
{
delete ui;
}
Alexandre Leroux
Implements method to register a widget in the dialog
r464 void SqpSettingsDialog::registerWidget(const QString &name, QWidget *widget) noexcept
{
auto newItem = new QListWidgetItem{ui->listWidget};
newItem->setText(name);
ui->stackedWidget->addWidget(widget);
// Selects widget if it's the first in the dialog
if (ui->listWidget->count() == 1) {
ui->listWidget->setCurrentItem(newItem);
}
}