Mercurial > hg > svgui
comparison view/PaneStack.cpp @ 1530:34311e135695
Don't create alignment views at all if not requested (now that the request is made only at construction time)
author | Chris Cannam |
---|---|
date | Mon, 07 Oct 2019 14:30:13 +0100 |
parents | adbc3f1c4c4e |
children | 01a41a37bd26 |
comparison
equal
deleted
inserted
replaced
1529:adbc3f1c4c4e | 1530:34311e135695 |
---|---|
89 QFrame *frame = new QFrame; | 89 QFrame *frame = new QFrame; |
90 | 90 |
91 QGridLayout *layout = new QGridLayout; | 91 QGridLayout *layout = new QGridLayout; |
92 layout->setMargin(0); | 92 layout->setMargin(0); |
93 layout->setHorizontalSpacing(m_viewManager->scalePixelSize(2)); | 93 layout->setHorizontalSpacing(m_viewManager->scalePixelSize(2)); |
94 | |
95 AlignmentView *av = nullptr; | |
96 | |
94 if (m_options & int(Option::ShowAlignmentViews)) { | 97 if (m_options & int(Option::ShowAlignmentViews)) { |
95 layout->setVerticalSpacing(0); | 98 layout->setVerticalSpacing(0); |
99 av = new AlignmentView(frame); | |
100 av->setFixedHeight(ViewManager::scalePixelSize(20)); | |
101 av->setViewManager(m_viewManager); | |
102 av->setVisible(false); // for now | |
103 layout->addWidget(av, 0, 1); | |
96 } else { | 104 } else { |
97 layout->setVerticalSpacing(m_viewManager->scalePixelSize(2)); | 105 layout->setVerticalSpacing(m_viewManager->scalePixelSize(2)); |
98 } | 106 } |
99 | |
100 AlignmentView *av = new AlignmentView(frame); | |
101 av->setFixedHeight(ViewManager::scalePixelSize(20)); | |
102 av->setViewManager(m_viewManager); | |
103 av->setVisible(false); // for now | |
104 layout->addWidget(av, 0, 1); | |
105 | 107 |
106 QPushButton *xButton = new QPushButton(frame); | 108 QPushButton *xButton = new QPushButton(frame); |
107 xButton->setIcon(IconLoader().load("cross")); | 109 xButton->setIcon(IconLoader().load("cross")); |
108 xButton->setFixedSize(QSize(16, 16)); | 110 xButton->setFixedSize(QSize(16, 16)); |
109 xButton->setFlat(true); | 111 xButton->setFlat(true); |
206 | 208 |
207 void | 209 void |
208 PaneStack::relinkAlignmentViews() | 210 PaneStack::relinkAlignmentViews() |
209 { | 211 { |
210 if (m_panes.empty()) return; | 212 if (m_panes.empty()) return; |
211 m_panes[0].alignmentView->hide(); | 213 auto av = m_panes[0].alignmentView; |
214 if (av) av->hide(); | |
212 for (int i = 1; in_range_for(m_panes, i); ++i) { | 215 for (int i = 1; in_range_for(m_panes, i); ++i) { |
216 av = m_panes[i].alignmentView; | |
217 if (!av) continue; | |
213 if (!(m_options & int(Option::ShowAlignmentViews))) { | 218 if (!(m_options & int(Option::ShowAlignmentViews))) { |
214 m_panes[i].alignmentView->hide(); | 219 av->hide(); |
215 } else { | 220 } else { |
216 m_panes[i].alignmentView->setViewAbove(m_panes[i-1].pane); | 221 av->setViewAbove(m_panes[i-1].pane); |
217 m_panes[i].alignmentView->setViewBelow(m_panes[i].pane); | 222 av->setViewBelow(m_panes[i].pane); |
218 m_panes[i].alignmentView->show(); | 223 av->show(); |
219 } | 224 } |
220 } | 225 } |
221 } | 226 } |
222 | 227 |
223 void | 228 void |
224 PaneStack::unlinkAlignmentViews() | 229 PaneStack::unlinkAlignmentViews() |
225 { | 230 { |
226 for (int i = 0; in_range_for(m_panes, i); ++i) { | 231 for (int i = 0; in_range_for(m_panes, i); ++i) { |
227 m_panes[i].alignmentView->setViewAbove(nullptr); | 232 auto av = m_panes[i].alignmentView; |
228 m_panes[i].alignmentView->setViewBelow(nullptr); | 233 if (!av) continue; |
234 av->setViewAbove(nullptr); | |
235 av->setViewBelow(nullptr); | |
229 } | 236 } |
230 } | 237 } |
231 | 238 |
232 void | 239 void |
233 PaneStack::setPropertyStackMinWidth(int mw) | 240 PaneStack::setPropertyStackMinWidth(int mw) |