Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swiot/ad74413r: Restore parent references for widgets. #1953

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions plugins/swiot/src/ad74413r/ad74413r.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ void Ad74413r::updateMeasurements(PlotAxis *axis, int chnlIdx)
void Ad74413r::createMeasurementsLabel(int chnlIdx, QPen chPen, QStringList labels)
{
for(const QString &label : labels) {
MeasurementLabel *ml = new MeasurementLabel(this);
MeasurementLabel *ml = new MeasurementLabel(m_measurePanel);
ml->setColor(chPen.color());
ml->setName(label);
m_labels[chnlIdx].append(ml);
Expand All @@ -547,9 +547,9 @@ void Ad74413r::createMeasurementsLabel(int chnlIdx, QPen chPen, QStringList labe

void Ad74413r::setupDeviceBtn()
{
VerticalChannelManager *vcm = new VerticalChannelManager(this);
VerticalChannelManager *vcm = new VerticalChannelManager(m_tool->leftStack());
m_tool->leftStack()->add("vcm", vcm);
m_devBtn = new CollapsableMenuControlButton(this);
m_devBtn = new CollapsableMenuControlButton(vcm);
m_devBtn->getControlBtn()->setName("AD74413R");
m_devBtn->getControlBtn()->setCheckable(false);
m_devBtn->getControlBtn()->button()->setVisible(false);
Expand Down Expand Up @@ -587,7 +587,7 @@ void Ad74413r::setupToolTemplate()

layout->addWidget(m_tool);

m_plot = new PlotWidget(this);
m_plot = new PlotWidget(m_tool->centralContainer());
m_info = new PlotInfo(m_plot->plot()->canvas());
TimeSamplingInfo *samplingInfo = new TimeSamplingInfo(m_plot);
m_info->addCustomInfo(samplingInfo, InfoPosition::IP_RIGHT);
Expand All @@ -598,13 +598,13 @@ void Ad74413r::setupToolTemplate()
setupDeviceBtn();
m_tool->addWidgetToCentralContainerHelper(m_plot);

m_infoBtn = new InfoBtn(this, true);
m_infoBtn = new InfoBtn(m_tool->topContainer(), true);
m_infoBtn->installEventFilter(this);
m_settingsBtn = new GearBtn(this);
m_runBtn = new RunBtn(this);
m_settingsBtn = new GearBtn(m_tool->topContainer());
m_runBtn = new RunBtn(m_tool->topContainer());
m_runBtn->setEnabled(false);
m_runBtn->setChecked(false);
m_singleBtn = new SingleShotBtn(this);
m_singleBtn = new SingleShotBtn(m_tool->topContainer());
m_singleBtn->setEnabled(false);
m_singleBtn->setChecked(false);
m_configBtn = createConfigBtn();
Expand All @@ -619,17 +619,17 @@ void Ad74413r::setupToolTemplate()
});
});

MenuControlButton *measure = new MenuControlButton(this);
MenuControlButton *measure = new MenuControlButton(m_tool->bottomContainer());
setupMeasureButtonHelper(measure);
m_measurePanel = new MeasurementsPanel(this);
m_measurePanel = new MeasurementsPanel(m_tool->topStack());
m_tool->topStack()->add(measureMenuId, m_measurePanel);
connect(measure, &MenuControlButton::toggled, this, [&](bool en) {
if(en)
m_tool->requestMenu(measureMenuId);
m_tool->openTopContainerHelper(en);
});

m_chnlsMenuBtn = new MenuControlButton(this);
m_chnlsMenuBtn = new MenuControlButton(m_tool->bottomContainer());
setupChannelsMenuControlBtn(m_chnlsMenuBtn, "Channels");
connect(m_chnlsMenuBtn->button(), &QAbstractButton::toggled, this, [=, this](bool b) {
if(b) {
Expand All @@ -645,11 +645,11 @@ void Ad74413r::setupToolTemplate()
m_rightMenuBtnGrp = dynamic_cast<OpenLastMenuBtn *>(openLastMenuBtn)->getButtonGroup();
m_rightMenuBtnGrp->addButton(m_chnlsMenuBtn->button());

m_channelStack = new MapStackedWidget(this);
m_channelStack = new MapStackedWidget(m_tool->rightStack());
m_tool->rightStack()->add(channelsMenuId, m_channelStack);

QString settingsMenuId = "PlotSettings";
m_tool->rightStack()->add(settingsMenuId, createSettingsMenu(this));
m_tool->rightStack()->add(settingsMenuId, createSettingsMenu(m_tool->rightStack()));
connect(m_settingsBtn, &QPushButton::toggled, this, [=, this](bool b) {
if(b) {
m_tool->requestMenu(settingsMenuId);
Expand Down
Loading