Changeset View
Changeset View
Standalone View
Standalone View
src/qmlwidgets/treeview2.cpp
Show First 20 Lines • Show All 201 Lines • ▼ Show 20 Line(s) | 185 | public: | |||
---|---|---|---|---|---|
202 | 202 | | |||
203 | typedef bool(TreeView2Private::*StateF)(); | 203 | typedef bool(TreeView2Private::*StateF)(); | ||
204 | 204 | | |||
205 | static const State m_fStateMap [5][5]; | 205 | static const State m_fStateMap [5][5]; | ||
206 | static const StateF m_fStateMachine[5][5]; | 206 | static const StateF m_fStateMachine[5][5]; | ||
207 | 207 | | |||
208 | bool m_UniformRowHeight {false}; | 208 | bool m_UniformRowHeight {false}; | ||
209 | bool m_UniformColumnWidth {false}; | 209 | bool m_UniformColumnWidth {false}; | ||
210 | bool m_Collapsable {true }; | 210 | bool m_Collapsible {true }; | ||
211 | bool m_AutoExpand {false}; | 211 | bool m_AutoExpand {false}; | ||
212 | int m_MaxDepth { -1 }; | 212 | int m_MaxDepth { -1 }; | ||
213 | int m_CacheBuffer { 10 }; | 213 | int m_CacheBuffer { 10 }; | ||
214 | int m_PoolSize { 10 }; | 214 | int m_PoolSize { 10 }; | ||
215 | int m_FailedCount { 0 }; | 215 | int m_FailedCount { 0 }; | ||
216 | TreeView2::RecyclingMode m_RecyclingMode { | 216 | TreeView2::RecyclingMode m_RecyclingMode { | ||
217 | TreeView2::RecyclingMode::NoRecycling | 217 | TreeView2::RecyclingMode::NoRecycling | ||
218 | }; | 218 | }; | ||
▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Line(s) | 371 | { | |||
372 | return d_ptr->m_UniformColumnWidth; | 372 | return d_ptr->m_UniformColumnWidth; | ||
373 | } | 373 | } | ||
374 | 374 | | |||
375 | void TreeView2::setUniformColumnColumnWidth(bool value) | 375 | void TreeView2::setUniformColumnColumnWidth(bool value) | ||
376 | { | 376 | { | ||
377 | d_ptr->m_UniformColumnWidth = value; | 377 | d_ptr->m_UniformColumnWidth = value; | ||
378 | } | 378 | } | ||
379 | 379 | | |||
380 | bool TreeView2::isCollapsable() const | 380 | bool TreeView2::isCollapsible() const | ||
381 | { | 381 | { | ||
382 | return d_ptr->m_Collapsable; | 382 | return d_ptr->m_Collapsible; | ||
383 | } | 383 | } | ||
384 | 384 | | |||
385 | void TreeView2::setCollapsable(bool value) | 385 | void TreeView2::setCollapsible(bool value) | ||
386 | { | 386 | { | ||
387 | d_ptr->m_Collapsable = value; | 387 | d_ptr->m_Collapsible = value; | ||
388 | } | 388 | } | ||
389 | 389 | | |||
390 | bool TreeView2::isAutoExpand() const | 390 | bool TreeView2::isAutoExpand() const | ||
391 | { | 391 | { | ||
392 | return d_ptr->m_AutoExpand; | 392 | return d_ptr->m_AutoExpand; | ||
393 | } | 393 | } | ||
394 | 394 | | |||
395 | void TreeView2::setAutoExpand(bool value) | 395 | void TreeView2::setAutoExpand(bool value) | ||
▲ Show 20 Lines • Show All 352 Lines • ▼ Show 20 Line(s) | 738 | for (int i = first; i <= last; i++) { | |||
748 | 748 | | |||
749 | //FIXME It can happen if the previous is out of the visible range | 749 | //FIXME It can happen if the previous is out of the visible range | ||
750 | Q_ASSERT( e->m_pPrevious || e->m_Index.row() == 0); | 750 | Q_ASSERT( e->m_pPrevious || e->m_Index.row() == 0); | ||
751 | 751 | | |||
752 | //TODO merge with bridgeGap | 752 | //TODO merge with bridgeGap | ||
753 | if (prev) | 753 | if (prev) | ||
754 | bridgeGap(prev, e, true); | 754 | bridgeGap(prev, e, true); | ||
755 | 755 | | |||
756 | // This is required before ::ATTACH because otherwise ::down() wont work | 756 | // This is required before ::ATTACH because otherwise ::down() won't work | ||
757 | if ((!pitem->m_pFirstChild) || e->m_Index.row() <= pitem->m_pFirstChild->m_Index.row()) { | 757 | if ((!pitem->m_pFirstChild) || e->m_Index.row() <= pitem->m_pFirstChild->m_Index.row()) { | ||
758 | e->m_pNext = pitem->m_pFirstChild; | 758 | e->m_pNext = pitem->m_pFirstChild; | ||
759 | pitem->m_pFirstChild = e; | 759 | pitem->m_pFirstChild = e; | ||
760 | } | 760 | } | ||
761 | 761 | | |||
762 | e->performAction(TreeTraversalItems::Action::ATTACH); | 762 | e->performAction(TreeTraversalItems::Action::ATTACH); | ||
763 | 763 | | |||
764 | if ((!pitem->m_pFirstChild) || e->m_Index.row() <= pitem->m_pFirstChild->m_Index.row()) { | 764 | if ((!pitem->m_pFirstChild) || e->m_Index.row() <= pitem->m_pFirstChild->m_Index.row()) { | ||
▲ Show 20 Lines • Show All 208 Lines • ▼ Show 20 Line(s) | |||||
973 | // Q_ASSERT(second->up() == first); | 973 | // Q_ASSERT(second->up() == first); | ||
974 | // } | 974 | // } | ||
975 | } | 975 | } | ||
976 | 976 | | |||
977 | void TreeView2Private::setTemporaryIndices(const QModelIndex &parent, int start, int end, | 977 | void TreeView2Private::setTemporaryIndices(const QModelIndex &parent, int start, int end, | ||
978 | const QModelIndex &destination, int row) | 978 | const QModelIndex &destination, int row) | ||
979 | { | 979 | { | ||
980 | //FIXME list only | 980 | //FIXME list only | ||
981 | // Before moving them, set a temporary now/col value because it wont be set | 981 | // Before moving them, set a temporary now/col value because it won't be set | ||
982 | // on the index until before slotRowsMoved2 is called (but after this | 982 | // on the index until before slotRowsMoved2 is called (but after this | ||
983 | // method returns //TODO do not use the hashmap, it is already known | 983 | // method returns //TODO do not use the hashmap, it is already known | ||
984 | if (parent == destination) { | 984 | if (parent == destination) { | ||
985 | const auto pitem = parent.isValid() ? m_hMapper.value(parent) : m_pRoot; | 985 | const auto pitem = parent.isValid() ? m_hMapper.value(parent) : m_pRoot; | ||
986 | for (int i = start; i <= end; i++) { | 986 | for (int i = start; i <= end; i++) { | ||
987 | auto idx = q_ptr->model()->index(i, 0, parent); | 987 | auto idx = q_ptr->model()->index(i, 0, parent); | ||
988 | 988 | | |||
989 | auto elem = pitem->m_hLookup.value(idx); | 989 | auto elem = pitem->m_hLookup.value(idx); | ||
Show All 12 Lines | |||||
1002 | } | 1002 | } | ||
1003 | } | 1003 | } | ||
1004 | } | 1004 | } | ||
1005 | 1005 | | |||
1006 | void TreeView2Private::resetTemporaryIndices(const QModelIndex &parent, int start, int end, | 1006 | void TreeView2Private::resetTemporaryIndices(const QModelIndex &parent, int start, int end, | ||
1007 | const QModelIndex &destination, int row) | 1007 | const QModelIndex &destination, int row) | ||
1008 | { | 1008 | { | ||
1009 | //FIXME list only | 1009 | //FIXME list only | ||
1010 | // Before moving them, set a temporary now/col value because it wont be set | 1010 | // Before moving them, set a temporary now/col value because it won't be set | ||
1011 | // on the index until before slotRowsMoved2 is called (but after this | 1011 | // on the index until before slotRowsMoved2 is called (but after this | ||
1012 | // method returns //TODO do not use the hashmap, it is already known | 1012 | // method returns //TODO do not use the hashmap, it is already known | ||
1013 | if (parent == destination) { | 1013 | if (parent == destination) { | ||
1014 | const auto pitem = parent.isValid() ? m_hMapper.value(parent) : m_pRoot; | 1014 | const auto pitem = parent.isValid() ? m_hMapper.value(parent) : m_pRoot; | ||
1015 | for (int i = start; i <= end; i++) { | 1015 | for (int i = start; i <= end; i++) { | ||
1016 | auto idx = q_ptr->model()->index(i, 0, parent); | 1016 | auto idx = q_ptr->model()->index(i, 0, parent); | ||
1017 | auto elem = pitem->m_hLookup.value(idx); | 1017 | auto elem = pitem->m_hLookup.value(idx); | ||
1018 | Q_ASSERT(elem); | 1018 | Q_ASSERT(elem); | ||
▲ Show 20 Lines • Show All 633 Lines • Show Last 20 Lines |