MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / RemoveView

Method RemoveView

App/Client/ViewSplitter.cpp:130–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130int CViewSplitter::RemoveView(QWidget *pView)
131{
132 int nRet = 0;
133 if(!pView)
134 return -1;
135
136 // Get view position
137 int nRow = -1;
138 int nCol = -1;
139 nRet = GetIndex(pView, nRow, nCol);
140 if(nRet)
141 return nRet;
142
143 CViewSplitterContainer* pContainerNext = nullptr;
144 QWidget* pCurView = GetCurrentView();
145 if(pView == pCurView)
146 {
147 // Get next
148 if(m_Row[nRow]->count() > nCol + 1)
149 pContainerNext = GetContainer(nRow, nCol + 1);
150 else if(m_Row[nRow]->count() - 1 == nCol && 0 != nCol)
151 pContainerNext = GetContainer(nRow, nCol -1);
152 else if(0 == nCol && nRow + 1 < m_nRow) {
153 for(int i = nRow + 1; i < m_nRow; i++) {
154 if(m_Row[i]->count() > 0) {
155 pContainerNext = GetContainer(nRow + 1, 0);
156 break;
157 }
158 }
159 }
160 if(!pContainerNext) {
161 for(int i = nRow - 1; i >= 0; i--) {
162 if(m_Row[i]->count() > 0) {
163 pContainerNext = GetContainer(i, m_Row[i]->count() - 1);
164 break;
165 }
166 }
167 }
168 }
169
170 // Delete view
171 pView->setParent(nullptr);
172 auto pContainer = GetContainer(pView);
173 if(pContainer) {
174 // Remove from QSplitter
175 pContainer->setParent(nullptr);
176 m_Container.remove(pView);
177 delete pContainer;
178 }
179 qDebug(log) << "Row:" << nRow << "remain:" << m_Row[nRow]->count();
180 m_nCount--;
181
182 qDebug(log) << "Row:" << m_nRow << "Count:" << m_nCount
183 << "Current row:" << m_nIdxRow << "Current col:" << m_nIdxCol;
184
185 if(pContainerNext) {
186 pCurView = pContainerNext->GetView();
187 // When full screen

Callers

nothing calls this directly

Calls 1

GetViewMethod · 0.45

Tested by

no test coverage detected