grc: generating qt - based cpp code incomplete

The generated code loads the geometry of the flowgraph from the wron diretcory "GNU Radio"
 but does not apply these settings.
If you change the geometry of the running flowgraph, these settings are not saved on close.

Signed-off-by: Volker Schroer <3470424+dl1ksv@users.noreply.github.com>
This commit is contained in:
Volker Schroer 2024-06-25 16:50:28 +02:00 committed by Jeff Long
parent 26852f4eb5
commit ad4b5440d6
2 changed files with 9 additions and 1 deletions

View File

@ -56,7 +56,8 @@ ${class_name}::${class_name} (${param_str}) ${initializer_str} {
this->top_grid_layout = new QGridLayout();
this->top_layout->addLayout(this->top_grid_layout);
this->settings = new QSettings("GNU Radio", "${class_name}");
this->settings = new QSettings("gnuradio/flowgraphs", "${class_name}");
this->restoreGeometry(this->settings->value("geometry").toByteArray());
% endif
% if flow_graph.get_option('thread_safe_setters'):
@ -101,6 +102,11 @@ ${var.vtype} ${class_name}::get_${var.name} () const {
return this->${var.name};
}
void ${class_name}::closeEvent(QCloseEvent *event) {
this->settings->setValue("geometry",this->saveGeometry());
event->accept();
}
void ${class_name}::set_${var.name} (${var.vtype} ${var.name}) {
% if flow_graph.get_option('thread_safe_setters'):
## with self._lock:

View File

@ -29,6 +29,7 @@ ${inc}
#include <QGridLayout>
#include <QSettings>
#include <QApplication>
#include <QCloseEvent>
% endif
% if parameters:
@ -59,6 +60,7 @@ private:
QVBoxLayout *top_layout;
QGridLayout *top_grid_layout;
QSettings *settings;
void closeEvent(QCloseEvent *event);
% endif