MCPcopy Create free account
hub / github.com/KDE/kdevelop / updateVisibility

Function updateVisibility

kdevplatform/sublime/idealcontroller.cpp:341–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339}
340
341class IdealToolBar : public QToolBar
342{
343 Q_OBJECT
344public:
345 explicit IdealToolBar(const QString& title, bool hideWhenEmpty, IdealButtonBarWidget* buttons, QMainWindow* parent)
346 : QToolBar(title, parent)
347 , m_buttons(hideWhenEmpty ? buttons : nullptr)
348 {
349 setMovable(false);
350 setFloatable(false);
351 setObjectName(title);
352 layout()->setContentsMargins(0, 0, 0, 0);
353
354 addWidget(buttons);
355
356 // This code determines the initial visibility of the toolbar only if KMainWindow::applyMainWindowSettings()
357 // fails to restore the main window state from config.
358 if (hideWhenEmpty) {
359 updateVisibility();
360 connect(m_buttons, &IdealButtonBarWidget::emptyChanged, this, &IdealToolBar::updateVisibility);
361 }
362 }
363
364 void updateVisibility()
365 {
366 // if (!m_buttons) do not hide if empty, therefore always show
367 setVisible(!m_buttons || !m_buttons->isEmpty());
368 }
369
370private:
371 IdealButtonBarWidget* const m_buttons;

Callers 1

ifMethod · 0.85

Calls 1

isEmptyMethod · 0.45

Tested by

no test coverage detected