MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / setFloating

Method setFloating

src/gui/CatControlApplet.cpp:185–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185void CatControlApplet::setFloating(bool on)
186{
187 if (on) {
188 // Build the floating page on first use
189 if (!m_floatingPage) {
190 m_floatingPage = new QWidget(this);
191 m_floatingPage->setStyleSheet("QWidget { background: transparent; }");
192 auto* floatingRoot = new QVBoxLayout(m_floatingPage);
193 floatingRoot->setContentsMargins(4, 4, 4, 4);
194 floatingRoot->setSpacing(4);
195
196 // Enable button + note (must enable before ports can be configured)
197 auto* enableRow = new QHBoxLayout;
198 enableRow->setSpacing(8);
199 m_floatingEnableBtn = new QPushButton("Enable CAT");
200 m_floatingEnableBtn->setCheckable(true);
201 applyToggleButtonStyle(m_floatingEnableBtn, ToggleTribe::Success);
202 m_floatingEnableBtn->setFixedSize(100, 22);
203 {
204 QSignalBlocker b(m_floatingEnableBtn);
205 m_floatingEnableBtn->setChecked(
206 AppSettings::instance().value("CatEnabled", "False").toString() == "True");
207 }
208 auto* noteLabel = new QLabel("Enable before configuring ports.");
209 ThemeManager::instance().applyStyleSheet(noteLabel,
210 "QLabel { color: {{color.text.label}}; font-size: 10px; font-style: italic; }");
211 enableRow->addWidget(m_floatingEnableBtn);
212 enableRow->addWidget(noteLabel);
213 enableRow->addStretch();
214 floatingRoot->addLayout(enableRow);
215
216 connect(m_floatingEnableBtn, &QPushButton::toggled, this, [this](bool on) {
217 auto& s = AppSettings::instance();
218 s.setValue("CatEnabled", on ? "True" : "False");
219 s.save();
220 if (m_enableBtn) {
221 QSignalBlocker b(m_enableBtn);
222 m_enableBtn->setChecked(on);
223 }
224 emit enableChanged(on);
225 });
226
227 auto* sep = new QFrame;
228 sep->setFrameShape(QFrame::HLine);
229 ThemeManager::instance().applyStyleSheet(sep, kSepStyle);
230 floatingRoot->addWidget(sep);
231
232 auto* scroll = new QScrollArea;
233 scroll->setWidgetResizable(true);
234 scroll->setFrameShape(QFrame::NoFrame);
235 scroll->setStyleSheet("QScrollArea { background: transparent; }");
236
237 auto* rowContainer = new QWidget;
238 rowContainer->setStyleSheet("QWidget { background: transparent; }");
239 m_grid = new QGridLayout(rowContainer);
240 m_grid->setContentsMargins(0, 0, 0, 0);
241 m_grid->setSpacing(3);
242 scroll->setWidget(rowContainer);

Callers 4

rearrangeLayoutMethod · 0.45
floatPanadapterMethod · 0.45
dockPanadapterMethod · 0.45
AppletPanelMethod · 0.45

Calls 6

applyToggleButtonStyleFunction · 0.85
applyStyleSheetMethod · 0.80
toStringMethod · 0.45
valueMethod · 0.45
setValueMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected