From 64f1241f6419ca5e8e26a84db1e2f055f9919d1e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 3 May 2010 12:43:26 +0200 Subject: Add diagrams for illustrating the process of moving rows. --- doc/src/diagrams/modelview-move-rows-1.sk | 271 +++++++++++++++++++++ doc/src/diagrams/modelview-move-rows-2.sk | 271 +++++++++++++++++++++ doc/src/diagrams/modelview-move-rows-3.sk | 137 +++++++++++ doc/src/diagrams/modelview-move-rows-4.sk | 137 +++++++++++ .../code/src_corelib_kernel_qabstractitemmodel.cpp | 20 ++ src/corelib/kernel/qabstractitemmodel.cpp | 56 +++++ 6 files changed, 892 insertions(+) create mode 100644 doc/src/diagrams/modelview-move-rows-1.sk create mode 100644 doc/src/diagrams/modelview-move-rows-2.sk create mode 100644 doc/src/diagrams/modelview-move-rows-3.sk create mode 100644 doc/src/diagrams/modelview-move-rows-4.sk diff --git a/doc/src/diagrams/modelview-move-rows-1.sk b/doc/src/diagrams/modelview-move-rows-1.sk new file mode 100644 index 0000000..3679dc7 --- /dev/null +++ b/doc/src/diagrams/modelview-move-rows-1.sk @@ -0,0 +1,271 @@ +##Sketch 1 2 +document() +layout('A4',0) +layer('Layer 1',1,1,0,0,(0,0,0)) +fp((1,1,1)) +lw(1) +ld((5, 5)) +r(30,0,0,-30,220,515) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,220,665) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,415.038,664.044) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,219.351,425.18) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,414.389,337.792) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,220,605) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,415.038,515.177) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,220,575) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,415.038,485.177) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,277.5,575) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,219.351,335.18) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,414.389,574.044) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,220,545) +fp((1,1,1)) +lw(1) +r(30.6087,0,0,-30,218.435,305.442) +fp((1,1,1)) +lw(1) +r(31.2174,0,0,-30,414.082,306.92) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,415.038,455.177) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,220,635) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,415.038,545.177) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,220,695) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,415.038,694.044) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,219.351,455.18) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,414.389,367.792) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,277.5,605) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,219.351,365.18) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,414.389,604.044) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,277.5,635) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,219.351,395.18) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,414.389,634.044) +le() +lw(1) +r(165,0,0,-230,210,705) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('0',(229.44,673.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('0',(424.478,672.184)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('0',(228.791,433.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('0',(423.829,345.932)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('1',(229.44,643.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('1',(424.478,642.184)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('1',(228.791,403.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('1',(423.829,315.932)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(229.44,613.14)) +fp((0.503,0.503,0.503)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(424.478,523.317)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(286.94,613.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(228.791,373.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(423.829,612.184)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('3',(229.44,583.14)) +fp((0.503,0.503,0.503)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('3',(424.478,493.317)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('3',(286.94,583.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('3',(228.791,343.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('3',(423.829,582.184)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('4',(229.44,553.14)) +fp((0.503,0.503,0.503)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('4',(424.478,463.317)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('4',(286.94,553.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('4',(228.791,313.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('4',(423.829,552.184)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('5',(229.44,523.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('5',(228.484,283.582)) +fp((0.503,0.503,0.503)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('5',(423.522,285.06)) +fp((0.503,0.503,0.503)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('5',(424.478,433.317)) +lw(1.5) +la2(([(-4.0, 3.0), (2.0, 0.0), (-4.0, -3.0), (-4.0, 3.0)], 1)) +b() +bs(275,635,0) +bs(255,635,0) +lw(1.5) +la2(([(-4.0, 3.0), (2.0, 0.0), (-4.0, -3.0), (-4.0, 3.0)], 1)) +b() +bs(294.508,380.772,0) +bs(293.986,545.115,0) +lw(1.5) +la2(([(-4.0, 3.0), (2.0, 0.0), (-4.0, -3.0), (-4.0, 3.0)], 1)) +b() +bs(249.466,380.772,0) +bs(291.551,380.772,0) +guidelayer('Guide Lines',1,0,0,1,(0,0,1)) +grid((0,0,2.5,2.5),1,(0,0,1),'Grid') diff --git a/doc/src/diagrams/modelview-move-rows-2.sk b/doc/src/diagrams/modelview-move-rows-2.sk new file mode 100644 index 0000000..c453a78 --- /dev/null +++ b/doc/src/diagrams/modelview-move-rows-2.sk @@ -0,0 +1,271 @@ +##Sketch 1 2 +document() +layout('A4',0) +layer('Layer 1',1,1,0,0,(0,0,0)) +fp((1,1,1)) +lw(1) +ld((5, 5)) +r(30,0,0,-30,220,515) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,220,665) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,415.038,664.044) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,219.351,425.18) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,414.389,337.792) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,220,605) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,415,605) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,220,575) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,415,575) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,275,455) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,219.351,335.18) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,415,455) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,220,545) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,415,545) +fp((1,1,1)) +lw(1) +r(30.6087,0,0,-30,218.435,305.442) +fp((1,1,1)) +lw(1) +r(31.2174,0,0,-30,414.082,306.92) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,220,635) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,415,635) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,220,695) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,415.038,694.044) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,219.351,455.18) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,414.389,367.792) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,275,485) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,219.351,365.18) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,415,485) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,275,515) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,219.351,395.18) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,415,515) +le() +lw(1) +r(165,0,0,-230,210,705) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('0',(229.44,673.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('0',(424.478,672.184)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('0',(228.791,433.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('0',(423.829,345.932)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('1',(229.44,643.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('1',(424.478,642.184)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('1',(228.791,403.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('1',(423.829,315.932)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(229.44,613.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(424.44,613.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(284.44,493.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(228.791,373.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(424.44,493.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('3',(229.44,583.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('3',(424.44,583.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('3',(284.44,463.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('3',(228.791,343.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('3',(424.44,463.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('4',(229.44,553.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('4',(424.44,553.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('4',(284.44,433.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('4',(228.791,313.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('4',(424.44,433.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('5',(229.44,523.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('5',(424.44,523.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('5',(228.484,283.582)) +fp((0.503,0.503,0.503)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('5',(423.522,285.06)) +lw(1.5) +la2(([(-4.0, 3.0), (2.0, 0.0), (-4.0, -3.0), (-4.0, 3.0)], 1)) +b() +bs(272.5,515,0) +bs(252.5,515,0) +lw(1.5) +la2(([(-4.0, 3.0), (2.0, 0.0), (-4.0, -3.0), (-4.0, 3.0)], 1)) +b() +bs(294.508,380.772,0) +bs(295,425,0) +lw(1.5) +la2(([(-4.0, 3.0), (2.0, 0.0), (-4.0, -3.0), (-4.0, 3.0)], 1)) +b() +bs(249.466,380.772,0) +bs(291.551,380.772,0) +guidelayer('Guide Lines',1,0,0,1,(0,0,1)) +grid((0,0,2.5,2.5),1,(0,0,1),'Grid') diff --git a/doc/src/diagrams/modelview-move-rows-3.sk b/doc/src/diagrams/modelview-move-rows-3.sk new file mode 100644 index 0000000..d320900 --- /dev/null +++ b/doc/src/diagrams/modelview-move-rows-3.sk @@ -0,0 +1,137 @@ +##Sketch 1 2 +document() +layout('A4',0) +layer('Layer 1',1,1,0,0,(0,0,0)) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,219.351,425.18) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,345.913,400) +lw(1) +r(30,0,0,-30,219.351,335.18) +lw(1) +r(30,0,0,-30,345.916,339.739) +fp((1,1,1)) +lw(1) +r(30.6087,0,0,-30,218.435,305.442) +fp((1,1,1)) +lw(1) +r(30.6087,0,0,-30,345,310) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,219.351,455.18) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,345.913,430) +lw(1) +r(30,0,0,-30,219.351,365.18) +lw(1) +r(30,0,0,-30,345.916,369.739) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,272.5,455) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,345,460) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,219.351,395.18) +le() +lw(1) +r(165,0,0,-230,210,705) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('0',(228.791,433.32)) +fp((0.503,0.503,0.503)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('0',(355.353,408.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('1',(228.791,403.32)) +fp((0.503,0.503,0.503)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('1',(355.353,378.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(281.94,433.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(354.44,438.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(228.791,373.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('3',(228.791,343.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('3',(355.356,347.879)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('4',(228.791,313.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('4',(355.356,317.879)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('5',(228.484,283.582)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('5',(355.049,288.14)) +lw(1.5) +la2(([(-4.0, 3.0), (2.0, 0.0), (-4.0, -3.0), (-4.0, 3.0)], 1)) +b() +bs(270,455,0) +bs(250,455,0) +lw(1.5) +la2(([(-4.0, 3.0), (2.0, 0.0), (-4.0, -3.0), (-4.0, 3.0)], 1)) +b() +bs(294.508,380.772,0) +bs(295,425,0) +lw(1.5) +la2(([(-4.0, 3.0), (2.0, 0.0), (-4.0, -3.0), (-4.0, 3.0)], 1)) +b() +bs(249.466,380.772,0) +bs(291.551,380.772,0) +guidelayer('Guide Lines',1,0,0,1,(0,0,1)) +grid((0,0,2.5,2.5),1,(0,0,1),'Grid') diff --git a/doc/src/diagrams/modelview-move-rows-4.sk b/doc/src/diagrams/modelview-move-rows-4.sk new file mode 100644 index 0000000..a8a1157 --- /dev/null +++ b/doc/src/diagrams/modelview-move-rows-4.sk @@ -0,0 +1,137 @@ +##Sketch 1 2 +document() +layout('A4',0) +layer('Layer 1',1,1,0,0,(0,0,0)) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,219.351,425.18) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,345,430) +lw(1) +r(30,0,0,-30,219.351,335.18) +lw(1) +r(30,0,0,-30,345,339.739) +fp((1,1,1)) +lw(1) +r(30.6087,0,0,-30,218.435,305.442) +fp((1,1,1)) +lw(1) +r(30.6087,0,0,-30,344.084,310) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,219.351,455.18) +fp((1,1,1)) +lw(1) +r(30,0,0,-30,345,460) +lw(1) +r(30,0,0,-30,219.351,365.18) +lw(1) +r(30,0,0,-30,345,400) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,272.5,335) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,345,370) +fp((0.753,0.753,1)) +lw(1) +r(30,0,0,-30,219.351,395.18) +le() +lw(1) +r(165,0,0,-230,210,705) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('0',(228.791,433.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('0',(354.44,438.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('1',(228.791,403.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('1',(354.44,408.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(281.94,313.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(354.44,348.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('2',(228.791,373.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('3',(228.791,343.32)) +fp((0.503,0.503,0.503)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('3',(354.44,378.14)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('4',(228.791,313.32)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('4',(354.44,317.879)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('5',(228.484,283.582)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(20) +txt('5',(354.133,288.14)) +lw(1.5) +la2(([(-4.0, 3.0), (2.0, 0.0), (-4.0, -3.0), (-4.0, 3.0)], 1)) +b() +bs(270,335,0) +bs(250,335,0) +lw(1.5) +la2(([(-4.0, 3.0), (2.0, 0.0), (-4.0, -3.0), (-4.0, 3.0)], 1)) +b() +bs(294.508,380.772,0) +bs(295,335,0) +lw(1.5) +la2(([(-4.0, 3.0), (2.0, 0.0), (-4.0, -3.0), (-4.0, 3.0)], 1)) +b() +bs(249.466,380.772,0) +bs(291.551,380.772,0) +guidelayer('Guide Lines',1,0,0,1,(0,0,1)) +grid((0,0,2.5,2.5),1,(0,0,1),'Grid') diff --git a/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp b/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp index 22ea240..e3ad483 100644 --- a/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp +++ b/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp @@ -67,3 +67,23 @@ beginInsertColumns(parent, 6, 8); //! [5] beginRemoveColumns(parent, 4, 6); //! [5] + + +//! [6] +beginMoveRows(sourceParent, 2, 4, destinationParent, 2); +//! [6] + + +//! [7] +beginMoveRows(sourceParent, 2, 4, destinationParent, 6); +//! [7] + + +//! [8] +beginMoveRows(parent, 2, 2, parent, 0); +//! [8] + + +//! [9] +beginMoveRows(parent, 2, 2, parent, 4); +//! [9] diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index b0503be..3660a3c 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -2530,6 +2530,62 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star condition is true, in which case you should abort your move operation. + \table 80% + \row + \o \inlineimage modelview-move-rows-1.png Moving rows to another parent + \o Specify the first and last row numbers for the span of rows in + the source parent you want to move in the model. Also specify + the row in the destination parent to move the span to. + + For example, as shown in the diagram, we move three rows from + row 2 to 4 in the source, so \a sourceFirst is 2 and \a sourceLast is 4. + We move those items to above row 2 in the destination, so \a destinationRow is 2. + + \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 6 + + This moves the three rows rows 2, 3, and 4 in the source to become 2, 3 and 4 in + the destination. Other affected siblings are displaced accordingly. + \row + \o \inlineimage modelview-move-rows-2.png Moving rows to append to another parent + \o To append rows to another parent, move them to after the last row. + + For example, as shown in the diagram, we move three rows to a + collection of 6 existing rows (ending in row 5), so \a destinationStart is 6: + + \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 7 + + This moves the target rows to the end of the target parent as 6, 7 and 8. + \row + \o \inlineimage modelview-move-rows-3.png Moving rows in the same parent up + \o To move rows within the same parent, specify the row to move them to. + + For example, as shown in the diagram, we move one item from row 2 to row 0, + so \a sourceFirst and \a sourceLast are 2 and \a destinationChild is 0. + + \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 8 + + Note that other rows may be displaced accordingly. Note also that when moving + items within the same parent you should not attempt invalid or no-op moves. In + the above example, item 2 is at row 2 before the move, so it can not be moved + to row 2 (where it is already) or row 3 (no-op as row 3 means above row 3, where + it is already) + + \row + \o \inlineimage modelview-move-rows-4.png Moving rows in the same parent down + \o To move rows within the same parent, specify the row to move them to. + + For example, as shown in the diagram, we move one item from row 2 to row 4, + so \a sourceFirst and \a sourceLast are 2 and \a destinationChild is 4. + + \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 9 + + Note that other rows may be displaced accordingly. + \endtable + + \note This function emits the rowsAboutToBeInserted() signal which + connected views (or proxies) must handle before the data is inserted. + Otherwise, the views may end up in an invalid state. + \sa endMoveRows() \since 4.6 -- cgit v0.12