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

Method syncTabStackHeightToCurrentPage

src/gui/VfoWidget.cpp:2778–2821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2776}
2777
2778void VfoWidget::syncTabStackHeightToCurrentPage()
2779{
2780 if (!m_tabStack) {
2781 return;
2782 }
2783 if (!m_tabStack->isVisible()) {
2784 m_tabStack->setMinimumHeight(0);
2785 m_tabStack->setMaximumHeight(QWIDGETSIZE_MAX);
2786 for (int i = 0; i < m_tabStack->count(); ++i) {
2787 if (QWidget* tab = m_tabStack->widget(i)) {
2788 tab->setMinimumHeight(0);
2789 tab->setMaximumHeight(QWIDGETSIZE_MAX);
2790 }
2791 }
2792 return;
2793 }
2794
2795 QWidget* page = m_tabStack->currentWidget();
2796 if (!page) {
2797 return;
2798 }
2799 for (int i = 0; i < m_tabStack->count(); ++i) {
2800 if (QWidget* tab = m_tabStack->widget(i)) {
2801 tab->setMinimumHeight(0);
2802 tab->setMaximumHeight(QWIDGETSIZE_MAX);
2803 }
2804 }
2805 if (page->layout()) {
2806 page->layout()->invalidate();
2807 page->layout()->activate();
2808 }
2809
2810 const int pageHeight = page->layout()
2811 ? qMax(page->layout()->minimumSize().height(), page->layout()->sizeHint().height())
2812 : page->sizeHint().height();
2813 if (pageHeight > 0) {
2814 page->setMinimumHeight(pageHeight);
2815 page->setMaximumHeight(pageHeight);
2816 page->resize(page->width(), pageHeight);
2817 m_tabStack->setMinimumHeight(pageHeight);
2818 m_tabStack->setMaximumHeight(pageHeight);
2819 m_tabStack->resize(m_tabStack->width(), pageHeight);
2820 }
2821}
2822
2823void VfoWidget::relayoutToCurrentContent()
2824{

Callers

nothing calls this directly

Calls 4

countMethod · 0.80
invalidateMethod · 0.80
widgetMethod · 0.45
sizeHintMethod · 0.45

Tested by

no test coverage detected