View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0017576 | Scribus | General | public | 2025-07-09 15:20 | 2025-07-22 16:27 |
Reporter | tropion | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Product Version | 1.7.1.svn | ||||
Summary | 0017576: When moving multiple items in the outline window only the first item is actually moved | ||||
Description | When you select multiple items in the 'Outline' window and move them to a different position in the outline window, everything looks fine until you save and reload the file. Only then you see that the move operation failed partially. Only the first item is actually moved. | ||||
Steps To Reproduce | Load groups.sla. Open the 'Outline' window. Select a and c in group d. Drag and drop them in the outline window between E and F in group S. Check in the outline window where a and c are now. Save and reload the file. Check again in the outline window where a and c are now. Scratch head. | ||||
Additional Information | I suggest the attached patch. | ||||
Tags | No tags attached. | ||||
Patch | No | ||||
|
moveItems.diff (1,410 bytes)
diff --git a/scribus/ui/outlinepalette.cpp b/scribus/ui/outlinepalette.cpp index eba2f42..65788f9 100644 --- a/scribus/ui/outlinepalette.cpp +++ b/scribus/ui/outlinepalette.cpp @@ -150,9 +150,9 @@ void OutlineWidget::dropEvent(QDropEvent *e) qFatal("OutlineWidget::dropEvent !itemPg 3"); } } - if (itemPl->indexOfChild(it) != itemPl->childCount() - 1) + if (itemPl->indexOfChild(its.at(0)) < itemPl->childCount() - idxs.size()) { - OutlineTreeItem *itemBe = dynamic_cast<OutlineTreeItem*>(itemPl->child(itemPl->indexOfChild(it) + 1)); + OutlineTreeItem *itemBe = dynamic_cast<OutlineTreeItem*>(itemPl->child(itemPl->indexOfChild(its.at(0)) + idxs.size())); if (!itemBe) qFatal("OutlineWidget::dropEvent !itemBe"); if ((itemBe->type == 1) || (itemBe->type == 3) || (itemBe->type == 4)) @@ -164,7 +164,7 @@ void OutlineWidget::dropEvent(QDropEvent *e) if (itemBe->PageItemObject->isGroupChild()) { PageItem* group = itemBe->PageItemObject->Parent; - int d = group->groupItemList.indexOf(itemBe->PageItemObject); + int d = group->groupItemList.indexOf(itemBe->PageItemObject) + 1; double xx = item->PageItemObject->xPos() - itemPar->PageObject->xOffset() + itemPg->PageObject->xOffset(); double yy = item->PageItemObject->yPos() - itemPar->PageObject->yOffset() + itemPg->PageObject->yOffset(); item->PageItemObject->setXYPos(xx, yy); groups.sla (19,961 bytes)
<?xml version="1.0" encoding="UTF-8"?> <SCRIBUSUTF8NEW Version="1.5.8"> <DOCUMENT ANZPAGES="1" PAGEWIDTH="612" PAGEHEIGHT="792" BORDERLEFT="40" BORDERRIGHT="40" BORDERTOP="40" BORDERBOTTOM="40" PRESET="0" BleedTop="0" BleedLeft="0" BleedRight="0" BleedBottom="0" ORIENTATION="0" PAGESIZE="US_Letter" FIRSTNUM="1" BOOK="0" AUTOSPALTEN="1" ABSTSPALTEN="11" UNITS="2" DFONT="Arial Regular" DSIZE="12" DCOL="1" DGAP="0" TabFill="" TabWidth="36" TextDistLeft="0" TextDistRight="0" TextDistBottom="0" TextDistTop="0" FirstLineOffset="1" AUTHOR="" COMMENTS="" KEYWORDS="" PUBLISHER="" DOCDATE="" DOCTYPE="" DOCFORMAT="" DOCIDENT="" DOCSOURCE="" DOCLANGINFO="" DOCRELATION="" DOCCOVER="" DOCRIGHTS="" DOCCONTRIB="" TITLE="" SUBJECT="" VHOCH="33" VHOCHSC="66" VTIEF="33" VTIEFSC="66" VKAPIT="75" BASEGRID="14.4" BASEO="0" AUTOL="100" UnderlinePos="-1" UnderlineWidth="-1" StrikeThruPos="-1" StrikeThruWidth="-1" GROUPC="3" HCMS="0" DPSo="0" DPSFo="0" DPuse="0" DPgam="0" DPbla="1" DPPr="ISO Coated v2 300% (basICColor)" DPIn="sRGB display profile (ICC v2.2)" DPInCMYK="ISO Coated v2 300% (basICColor)" DPIn2="sRGB display profile (ICC v2.2)" DPIn3="ISO Coated v2 300% (basICColor)" DISc="1" DIIm="0" ALAYER="0" LANGUAGE="en_US" AUTOMATIC="1" AUTOCHECK="0" GUIDELOCK="0" SnapToGuides="0" SnapToGrid="0" SnapToElement="0" MINGRID="20.002" MAJGRID="100.001" SHOWGRID="0" SHOWGUIDES="1" showcolborders="1" SHOWFRAME="1" SHOWControl="0" SHOWLAYERM="0" SHOWMARGIN="1" SHOWBASE="0" SHOWPICT="1" SHOWLINK="0" rulerMode="1" showrulers="1" showBleed="1" rulerXoffset="0" rulerYoffset="0" GuideRad="10" GRAB="4" POLYC="4" POLYF="0.502" POLYR="0" POLYIR="0" POLYCUR="0" POLYOCUR="0" POLYS="0" arcStartAngle="30" arcSweepAngle="300" spiralStartAngle="0" spiralEndAngle="1080" spiralFactor="1.2" AutoSave="1" AutoSaveTime="600000" AutoSaveCount="1" AutoSaveKeep="0" AUtoSaveInDocDir="1" AutoSaveDir="" ScratchBottom="20.002" ScratchLeft="100.001" ScratchRight="100.001" ScratchTop="20.002" GapHorizontal="0" GapVertical="40.003" StartArrow="0" EndArrow="0" PEN="Black" BRUSH="None" PENLINE="Black" PENTEXT="Black" StrokeText="Black" TextBackGround="None" TextLineColor="None" TextBackGroundShade="100" TextLineShade="100" TextPenShade="100" TextStrokeShade="100" STIL="1" STILLINE="1" WIDTH="1" WIDTHLINE="1" PENSHADE="100" LINESHADE="100" BRUSHSHADE="100" CPICT="None" PICTSHADE="100" CSPICT="None" PICTSSHADE="100" PICTSCX="1" PICTSCY="1" PSCALE="1" PASPECT="1" EmbeddedPath="0" HalfRes="1" dispX="10.001" dispY="10.001" constrain="15" MINORC="#00ff00" MAJORC="#00ff00" GuideC="#000080" BaseC="#c0c0c0" renderStack="2 0 4 1 3" GridType="0" PAGEC="#ffffff" MARGC="#0000ff" RANDF="0" currentProfile="PDF 1.4" calligraphicPenFillColor="Black" calligraphicPenLineColor="Black" calligraphicPenFillColorShade="100" calligraphicPenLineColorShade="100" calligraphicPenLineWidth="1" calligraphicPenAngle="0" calligraphicPenWidth="10" calligraphicPenStyle="1"> <CheckProfile Name="PDF 1.3" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="1" minResolution="144" maxResolution="2400" checkAnnotations="0" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="0" checkDeviceColorsAndOutputIntent="0" checkFontNotEmbedded="1" checkFontIsOpenType="1" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/> <CheckProfile Name="PDF 1.4" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="0" minResolution="144" maxResolution="2400" checkAnnotations="0" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="0" checkDeviceColorsAndOutputIntent="0" checkFontNotEmbedded="1" checkFontIsOpenType="1" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/> <CheckProfile Name="PDF 1.5" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="0" minResolution="144" maxResolution="2400" checkAnnotations="0" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="0" checkDeviceColorsAndOutputIntent="0" checkFontNotEmbedded="1" checkFontIsOpenType="1" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/> <CheckProfile Name="PDF 1.6" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="0" minResolution="144" maxResolution="2400" checkAnnotations="0" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="0" checkDeviceColorsAndOutputIntent="0" checkFontNotEmbedded="1" checkFontIsOpenType="0" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/> <CheckProfile Name="PDF/X-1a" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="1" minResolution="144" maxResolution="2400" checkAnnotations="1" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="1" checkDeviceColorsAndOutputIntent="0" checkFontNotEmbedded="1" checkFontIsOpenType="1" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/> <CheckProfile Name="PDF/X-3" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="1" minResolution="144" maxResolution="2400" checkAnnotations="1" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="0" checkDeviceColorsAndOutputIntent="1" checkFontNotEmbedded="1" checkFontIsOpenType="1" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/> <CheckProfile Name="PDF/X-4" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="0" minResolution="144" maxResolution="2400" checkAnnotations="1" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="0" checkDeviceColorsAndOutputIntent="1" checkFontNotEmbedded="1" checkFontIsOpenType="0" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/> <CheckProfile Name="PostScript" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="1" minResolution="144" maxResolution="2400" checkAnnotations="0" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="0" checkDeviceColorsAndOutputIntent="0" checkFontNotEmbedded="0" checkFontIsOpenType="0" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/> <COLOR NAME="Black" SPACE="CMYK" C="0" M="0" Y="0" K="100"/> <COLOR NAME="Blue" SPACE="RGB" R="0" G="0" B="255"/> <COLOR NAME="Cool Black" SPACE="CMYK" C="60" M="0" Y="0" K="100"/> <COLOR NAME="Cyan" SPACE="CMYK" C="100" M="0" Y="0" K="0"/> <COLOR NAME="Green" SPACE="RGB" R="0" G="255" B="0"/> <COLOR NAME="Magenta" SPACE="CMYK" C="0" M="100" Y="0" K="0"/> <COLOR NAME="Red" SPACE="RGB" R="255" G="0" B="0"/> <COLOR NAME="Registration" SPACE="CMYK" C="100" M="100" Y="100" K="100" Register="1"/> <COLOR NAME="Rich Black" SPACE="CMYK" C="60" M="40" Y="40" K="100"/> <COLOR NAME="Warm Black" SPACE="CMYK" C="0" M="60" Y="29.8039215686275" K="100"/> <COLOR NAME="White" SPACE="CMYK" C="0" M="0" Y="0" K="0"/> <COLOR NAME="Yellow" SPACE="CMYK" C="0" M="0" Y="100" K="0"/> <HYPHEN/> <CHARSTYLE CNAME="Default Character Style" DefaultStyle="1" FONT="Arial Regular" FONTSIZE="12" FONTFEATURES="" FEATURES="inherit" FCOLOR="Black" FSHADE="100" HyphenWordMin="3" SCOLOR="Black" BGCOLOR="None" BGSHADE="100" SSHADE="100" TXTSHX="5" TXTSHY="-5" TXTOUT="1" TXTULP="-0.1" TXTULW="-0.1" TXTSTP="-0.1" TXTSTW="-0.1" SCALEH="100" SCALEV="100" BASEO="0" KERN="0" LANGUAGE="en_US"/> <STYLE NAME="Default Paragraph Style" DefaultStyle="1" ALIGN="0" DIRECTION="0" LINESPMode="0" LINESP="15" INDENT="0" RMARGIN="0" FIRST="0" VOR="0" NACH="0" ParagraphEffectOffset="0" DROP="0" DROPLIN="2" Bullet="0" Numeration="0" HyphenConsecutiveLines="2" BCOLOR="None" BSHADE="100"/> <TableStyle NAME="Default Table Style" DefaultStyle="1" FillColor="None" FillShade="100"> <TableBorderLeft> <TableBorderLine Width="1" PenStyle="1" Color="Black" Shade="100"/> </TableBorderLeft> <TableBorderRight> <TableBorderLine Width="1" PenStyle="1" Color="Black" Shade="100"/> </TableBorderRight> <TableBorderTop> <TableBorderLine Width="1" PenStyle="1" Color="Black" Shade="100"/> </TableBorderTop> <TableBorderBottom> <TableBorderLine Width="1" PenStyle="1" Color="Black" Shade="100"/> </TableBorderBottom> </TableStyle> <CellStyle NAME="Default Cell Style" DefaultStyle="1" FillColor="None" FillShade="100" LeftPadding="1" RightPadding="1" TopPadding="1" BottomPadding="1"/> <LAYERS NUMMER="0" LEVEL="0" NAME="Hintergrund" SICHTBAR="1" DRUCKEN="1" EDIT="1" SELECT="0" FLOW="1" TRANS="1" BLEND="0" OUTL="0" LAYERC="#000000"/> <Printer firstUse="1" toFile="0" useAltPrintCommand="0" outputSeparations="0" useSpotColors="1" useColor="1" mirrorH="0" mirrorV="0" useICC="0" doGCR="0" doClip="0" setDevParam="0" useDocBleeds="1" cropMarks="0" bleedMarks="0" registrationMarks="0" colorMarks="0" includePDFMarks="1" PSLevel="3" PrintEngine="4" markLength="20.0016" markOffset="0" BleedTop="0" BleedLeft="0" BleedRight="0" BleedBottom="0" printer="Microsoft Print to PDF" filename="" separationName="All" printerCommand=""/> <PDF firstUse="1" Thumbnails="0" Articles="0" Bookmarks="0" Compress="1" CMethod="0" Quality="0" EmbedPDF="0" MirrorH="0" MirrorV="0" Clip="0" rangeSel="0" rangeTxt="" RotateDeg="0" PresentMode="0" RecalcPic="0" FontEmbedding="0" Grayscale="0" RGBMode="1" UseProfiles="0" UseProfiles2="0" Binding="0" PicRes="300" Resolution="300" Version="14" Intent="1" Intent2="0" SolidP="sRGB display profile (ICC v2.2)" ImageP="sRGB display profile (ICC v2.2)" PrintP="ISO Coated v2 300% (basICColor)" InfoString="" BTop="0" BLeft="0" BRight="0" BBottom="0" useDocBleeds="1" cropMarks="0" bleedMarks="0" registrationMarks="0" colorMarks="0" docInfoMarks="0" markLength="20.0016" markOffset="0" ImagePr="0" PassOwner="" PassUser="" Permissions="-4" Encrypt="0" UseLayers="0" UseLpi="0" UseSpotColors="1" doMultiFile="0" displayBookmarks="0" displayFullscreen="0" displayLayers="0" displayThumbs="0" hideMenuBar="0" hideToolBar="0" fitWindow="0" openAfterExport="0" PageLayout="0" openAction=""> <LPI Color="" Frequency="0" Angle="0" SpotFunction="0"/> <LPI Color="Black" Frequency="133" Angle="45" SpotFunction="3"/> <LPI Color="Cyan" Frequency="133" Angle="105" SpotFunction="3"/> <LPI Color="Magenta" Frequency="133" Angle="75" SpotFunction="3"/> <LPI Color="Yellow" Frequency="133" Angle="90" SpotFunction="3"/> </PDF> <DocItemAttributes/> <TablesOfContents/> <NotesStyles> <notesStyle Name="Default" Start="1" Endnotes="0" Type="Type_1_2_3" Range="0" Prefix="" Suffix=")" AutoHeight="1" AutoWidth="1" AutoRemove="1" AutoWeld="1" SuperNote="1" SuperMaster="1" MarksStyle="" NotesStyle=""/> </NotesStyles> <PageSets> <Set Name="Single Page" FirstPage="0" Rows="1" Columns="1"/> <Set Name="Facing Pages" FirstPage="1" Rows="1" Columns="2"> <PageNames Name="Left Page"/> <PageNames Name="Right Page"/> </Set> <Set Name="3-Fold" FirstPage="0" Rows="1" Columns="3"> <PageNames Name="Left Page"/> <PageNames Name="Middle"/> <PageNames Name="Right Page"/> </Set> <Set Name="4-Fold" FirstPage="0" Rows="1" Columns="4"> <PageNames Name="Left Page"/> <PageNames Name="Middle Left"/> <PageNames Name="Middle Right"/> <PageNames Name="Right Page"/> </Set> </PageSets> <Sections> <Section Number="0" Name="Abschnitt 1" From="0" To="0" Type="Type_1_2_3" Start="1" Reversed="0" Active="1" FillChar="0" FieldWidth="0"/> </Sections> <MASTERPAGE PAGEXPOS="100.001" PAGEYPOS="20.002" PAGEWIDTH="612" PAGEHEIGHT="792" BORDERLEFT="40" BORDERRIGHT="40" BORDERTOP="40" BORDERBOTTOM="40" NUM="0" NAM="Normal" MNAM="" Size="US_Letter" Orientation="0" LEFT="0" PRESET="0" VerticalGuides="" HorizontalGuides="" AGhorizontalAutoGap="0" AGverticalAutoGap="0" AGhorizontalAutoCount="0" AGverticalAutoCount="0" AGhorizontalAutoRefer="0" AGverticalAutoRefer="0" AGSelection="0 0 0 0" pageEffectDuration="1" pageViewDuration="1" effectType="0" Dm="0" M="0" Di="0"/> <PAGE PAGEXPOS="100.001" PAGEYPOS="20.002" PAGEWIDTH="612" PAGEHEIGHT="792" BORDERLEFT="40" BORDERRIGHT="40" BORDERTOP="40" BORDERBOTTOM="40" NUM="0" NAM="" MNAM="Normal" Size="US_Letter" Orientation="0" LEFT="0" PRESET="0" VerticalGuides="" HorizontalGuides="" AGhorizontalAutoGap="0" AGverticalAutoGap="0" AGhorizontalAutoCount="0" AGverticalAutoCount="0" AGhorizontalAutoRefer="0" AGverticalAutoRefer="0" AGSelection="0 0 0 0" pageEffectDuration="1" pageViewDuration="1" effectType="0" Dm="0" M="0" Di="0"/> <PAGEOBJECT XPOS="271.001" YPOS="132.510638297872" OwnPage="0" ItemID="660241323" PTYPE="12" WIDTH="121.935170212766" HEIGHT="78.1276595744681" FRTYPE="0" CLIPEDIT="0" ANNAME="d" groupWidth="121.935170212766" groupHeight="78.1276595744681" groupClips="1" path="M0 0 L121.935 0 L121.935 78.1277 L0 78.1277 L0 0 Z" copath="M0 0 L121.935 0 L121.935 78.1277 L0 78.1277 L0 0 Z" gXpos="271.001" gYpos="132.510638297872" gWidth="0" gHeight="0" LAYER="0"> <PAGEOBJECT XPOS="271.001" YPOS="132.510638297872" OwnPage="0" ItemID="1797554343" PTYPE="4" WIDTH="52.2330425531915" HEIGHT="33.7021276595745" FRTYPE="0" CLIPEDIT="0" PWIDTH="1" PLINEART="1" ANNAME="c" LOCALSCX="1" LOCALSCY="1" LOCALX="0" LOCALY="0" LOCALROT="0" PICART="1" SCALETYPE="1" RATIO="1" COLUMNS="1" COLGAP="0" AUTOTEXT="0" EXTRA="0" TEXTRA="0" BEXTRA="0" REXTRA="0" VAlign="0" FLOP="1" PLTSHOW="0" BASEOF="0" textPathType="0" textPathFlipped="0" path="M0 0 L52.233 0 L52.233 33.7021 L0 33.7021 L0 0 Z" copath="M0 0 L52.233 0 L52.233 33.7021 L0 33.7021 L0 0 Z" gXpos="0" gYpos="0" gWidth="121.935170212766" gHeight="78.1276595744681" LAYER="0" NEXTITEM="-1" BACKITEM="-1"> <StoryText> <DefaultStyle/> <trail/> </StoryText> </PAGEOBJECT> <PAGEOBJECT XPOS="343.914893617021" YPOS="173.002" OwnPage="0" ItemID="1100164286" PTYPE="4" WIDTH="49.0212765957447" HEIGHT="37.6362978723404" FRTYPE="0" CLIPEDIT="0" PWIDTH="1" PLINEART="1" ANNAME="b" LOCALSCX="1" LOCALSCY="1" LOCALX="0" LOCALY="0" LOCALROT="0" PICART="1" SCALETYPE="1" RATIO="1" COLUMNS="1" COLGAP="0" AUTOTEXT="0" EXTRA="0" TEXTRA="0" BEXTRA="0" REXTRA="0" VAlign="0" FLOP="1" PLTSHOW="0" BASEOF="0" textPathType="0" textPathFlipped="0" path="M0 0 L49.0213 0 L49.0213 37.6363 L0 37.6363 L0 0 Z" copath="M0 0 L49.0213 0 L49.0213 37.6363 L0 37.6363 L0 0 Z" gXpos="72.9138936170213" gYpos="40.4913617021277" gWidth="121.935170212766" gHeight="78.1276595744681" LAYER="0" NEXTITEM="-1" BACKITEM="-1"> <StoryText> <DefaultStyle/> <trail/> </StoryText> </PAGEOBJECT> <PAGEOBJECT XPOS="301.787234042553" YPOS="180" OwnPage="0" ItemID="2039710724" PTYPE="4" WIDTH="25.2765957446809" HEIGHT="16.8510638297872" FRTYPE="0" CLIPEDIT="0" PWIDTH="1" PLINEART="1" ANNAME="a" LOCALSCX="1" LOCALSCY="1" LOCALX="0" LOCALY="0" LOCALROT="0" PICART="1" SCALETYPE="1" RATIO="1" COLUMNS="1" COLGAP="0" AUTOTEXT="0" EXTRA="0" TEXTRA="0" BEXTRA="0" REXTRA="0" VAlign="0" FLOP="1" PLTSHOW="0" BASEOF="0" textPathType="0" textPathFlipped="0" path="M0 0 L25.2766 0 L25.2766 16.8511 L0 16.8511 L0 0 Z" copath="M0 0 L25.2766 0 L25.2766 16.8511 L0 16.8511 L0 0 Z" gXpos="30.7862340425532" gYpos="47.4893617021277" gWidth="0" gHeight="0" LAYER="0" NEXTITEM="-1" BACKITEM="-1"> <StoryText> <DefaultStyle/> <trail/> </StoryText> </PAGEOBJECT> </PAGEOBJECT> <PAGEOBJECT XPOS="244.63829787234" YPOS="278.50763829787" OwnPage="0" ItemID="216610932" PTYPE="12" WIDTH="264.255319148936" HEIGHT="159.31914893617" FRTYPE="0" CLIPEDIT="0" ANNAME="S" groupWidth="264.255319148936" groupHeight="159.31914893617" groupClips="1" path="M0 0 L264.255 0 L264.255 159.319 L0 159.319 L0 0 Z" copath="M0 0 L264.255 0 L264.255 159.319 L0 159.319 L0 0 Z" gXpos="244.63829787234" gYpos="1110.51063829787" gWidth="0" gHeight="0" LAYER="0"> <PAGEOBJECT XPOS="246.63829787234" YPOS="1032.51063829787" OwnPage="0" ItemID="292717928" PTYPE="4" WIDTH="52.8510638297873" HEIGHT="48.2553191489362" FRTYPE="0" CLIPEDIT="0" PWIDTH="1" PLINEART="1" ANNAME="H" LOCALSCX="1" LOCALSCY="1" LOCALX="0" LOCALY="0" LOCALROT="0" PICART="1" SCALETYPE="1" RATIO="1" COLUMNS="1" COLGAP="0" AUTOTEXT="0" EXTRA="0" TEXTRA="0" BEXTRA="0" REXTRA="0" VAlign="0" FLOP="1" PLTSHOW="0" BASEOF="0" textPathType="0" textPathFlipped="0" path="M0 0 L52.8511 0 L52.8511 48.2553 L0 48.2553 L0 0 Z" copath="M0 0 L52.8511 0 L52.8511 48.2553 L0 48.2553 L0 0 Z" gXpos="0" gYpos="0" gWidth="264.255319148936" gHeight="159.31914893617" LAYER="0" NEXTITEM="-1" BACKITEM="-1"> <StoryText> <DefaultStyle/> <trail/> </StoryText> </PAGEOBJECT> <PAGEOBJECT XPOS="469.531914893617" YPOS="1033.27659574468" OwnPage="0" ItemID="844644602" PTYPE="4" WIDTH="41.3617021276596" HEIGHT="37.5319148936169" FRTYPE="0" CLIPEDIT="0" PWIDTH="1" PLINEART="1" ANNAME="F" LOCALSCX="1" LOCALSCY="1" LOCALX="0" LOCALY="0" LOCALROT="0" PICART="1" SCALETYPE="1" RATIO="1" COLUMNS="1" COLGAP="0" AUTOTEXT="0" EXTRA="0" TEXTRA="0" BEXTRA="0" REXTRA="0" VAlign="0" FLOP="1" PLTSHOW="0" BASEOF="0" textPathType="0" textPathFlipped="0" path="M0 0 L41.3617 0 L41.3617 37.5319 L0 37.5319 L0 0 Z" copath="M0 0 L41.3617 0 L41.3617 37.5319 L0 37.5319 L0 0 Z" gXpos="222.893617021277" gYpos="0.76595744680867" gWidth="264.255319148936" gHeight="159.31914893617" LAYER="0" NEXTITEM="-1" BACKITEM="-1"> <StoryText> <DefaultStyle/> <trail/> </StoryText> </PAGEOBJECT> <PAGEOBJECT XPOS="370.723404255319" YPOS="1129.02127659574" OwnPage="0" ItemID="641562678" PTYPE="4" WIDTH="57.4468085106383" HEIGHT="62.8085106382978" FRTYPE="0" CLIPEDIT="0" PWIDTH="1" PLINEART="1" ANNAME="E" LOCALSCX="1" LOCALSCY="1" LOCALX="0" LOCALY="0" LOCALROT="0" PICART="1" SCALETYPE="1" RATIO="1" COLUMNS="1" COLGAP="0" AUTOTEXT="0" EXTRA="0" TEXTRA="0" BEXTRA="0" REXTRA="0" VAlign="0" FLOP="1" PLTSHOW="0" BASEOF="0" textPathType="0" textPathFlipped="0" path="M0 0 L57.4468 0 L57.4468 62.8085 L0 62.8085 L0 0 Z" copath="M0 0 L57.4468 0 L57.4468 62.8085 L0 62.8085 L0 0 Z" gXpos="124.085106382979" gYpos="96.5106382978724" gWidth="264.255319148936" gHeight="159.31914893617" LAYER="0" NEXTITEM="-1" BACKITEM="-1"> <StoryText> <DefaultStyle/> <trail/> </StoryText> </PAGEOBJECT> </PAGEOBJECT> </DOCUMENT> </SCRIBUSUTF8NEW> |
|
personally, i struggle a bit to understand the change. the code was already rather complex and it did not get simpler. would you mind adding some documentation? maybe, just renaming itemBe and d to something more meaningful would already help much... and maybe explain in here the meaning of your change. we should really avoid a line by line documentation, but here the code looks like magics to me... maybe it help to get this merged (even if jean probably understand it better...) |
|
Most of the magic happens in QTreeWidget::dropEvent(e); This moves the items in the QTreeWidget. So before that item->parent is source, and after that item->parent is destination. Took me a while to understand. Explanation of the change: - if (itemPl->indexOfChild(it) != itemPl->childCount() - 1) + if (itemPl->indexOfChild(its.at(0)) < itemPl->childCount() - idxs.size()) This was to check if the drop was at the end of a groupItemList or document->Items or somewhere before the end. It fails when more than one item is dropped, because the other items where also dropped at the end, but they do not meet the condition. The other part that fails when dropping more than one item is - OutlineTreeItem *itemBe = dynamic_cast<OutlineTreeItem*>(itemPl->child(itemPl->indexOfChild(it) + 1)); + OutlineTreeItem *itemBe = dynamic_cast<OutlineTreeItem*>(itemPl->child(itemPl->indexOfChild(its.at(0)) + idxs.size())); For each dropped item after the first itemBe is the previous of the moved items, and thus the item gets moved to wherever that nth-1 item came from. There is a new patch. I tried to simplify the code and renamed some of the items. I find it a bit annoying that nobody bothered to document what all the OutlineTreeItem::type mean. moveItems2.diff (11,136 bytes)
diff --git a/scribus/ui/outlinepalette.cpp b/scribus/ui/outlinepalette.cpp index eba2f42..1ffeb19 100644 --- a/scribus/ui/outlinepalette.cpp +++ b/scribus/ui/outlinepalette.cpp @@ -76,23 +76,24 @@ void OutlineWidget::dropEvent(QDropEvent *e) bool haveLayers = false; QModelIndex id; QList<QTreeWidgetItem*> its; - QList<OutlineTreeItem*> itemPars; + QList<OutlineTreeItem*> sourcePages; QList<QModelIndex> idxs = selectedIndexes(); for (int i = 0; i < idxs.count(); ++i) { id = idxs.at(i); QTreeWidgetItem* it = id.isValid() ? itemFromIndex(id) : nullptr; - OutlineTreeItem *itemPar = it ? dynamic_cast<OutlineTreeItem*>(it->parent()) : nullptr; - while (itemPar && (itemPar->type != 2)) + OutlineTreeItem* sourcePage = it ? dynamic_cast<OutlineTreeItem*>(it->parent()) : nullptr; + while (sourcePage && (sourcePage->type != 2)) { - if (itemPar->type == 5) + if (sourcePage->type == 5) haveLayers = true; - itemPar = dynamic_cast<OutlineTreeItem*>(itemPar->parent()); + sourcePage = dynamic_cast<OutlineTreeItem*>(sourcePage->parent()); } its.append(it); - itemPars.append(itemPar); + sourcePages.append(sourcePage); } + // this moves the selected items in the QTreeWidgets QTreeWidget::dropEvent(e); QList<QTreeWidgetItem*> selList; @@ -101,156 +102,121 @@ void OutlineWidget::dropEvent(QDropEvent *e) QTreeWidgetItem* it = its.at(i); if (it == nullptr) continue; - OutlineTreeItem *itemPar = itemPars.at(i); - OutlineTreeItem *item = dynamic_cast<OutlineTreeItem*>(it); + OutlineTreeItem* sourcePage = sourcePages.at(i); + OutlineTreeItem* item = dynamic_cast<OutlineTreeItem*>(it); if (!item) qFatal("OutlineWidget::dropEvent !item"); - OutlineTreeItem *itemPl = dynamic_cast<OutlineTreeItem*>(it->parent()); - if (!itemPl) - qFatal("OutlineWidget::dropEvent !itemPl"); - OutlineTreeItem *itemPg; - if (itemPl->type == 5) + OutlineTreeItem* destParent = dynamic_cast<OutlineTreeItem*>(it->parent()); + if (!destParent) + qFatal("OutlineWidget::dropEvent !destParent"); + OutlineTreeItem* destPage; + if (destParent->type == 2) { - itemPg = dynamic_cast<OutlineTreeItem*>(it->parent()->parent()); - if (!itemPg) - qFatal("OutlineWidget::dropEvent !itemPg 1"); - } - else if (itemPl->type == 2) - { - itemPg = dynamic_cast<OutlineTreeItem*>(it->parent()); - if (!itemPg) - qFatal("OutlineWidget::dropEvent !itemPg 2"); + destPage = dynamic_cast<OutlineTreeItem*>(it->parent()); + if (!destPage) + qFatal("OutlineWidget::dropEvent !destPage 2"); if (haveLayers) { - itemPl = dynamic_cast<OutlineTreeItem*>(itemPg->child(0)); - if (!itemPl) - qFatal("OutlineWidget::dropEvent !itemPl"); - for (int j = 0; j < itemPg->childCount(); ++j) + /* + we want to be able to drop items on a different page + without having to care about the layer. This here ensures the dropped items + appear on the same layer they came from. + */ + destParent = dynamic_cast<OutlineTreeItem*>(destPage->child(0)); + if (!destParent) + qFatal("OutlineWidget::dropEvent !destParent"); + for (int j = 0; j < destPage->childCount(); ++j) { - OutlineTreeItem* childItem = dynamic_cast<OutlineTreeItem*>(itemPg->child(j)); + OutlineTreeItem* childItem = dynamic_cast<OutlineTreeItem*>(destPage->child(j)); if (!childItem) qFatal("OutlineWidget::dropEvent !childItem"); if (item->PageItemObject->m_layerID == childItem->LayerID) { - itemPl = childItem; + destParent = childItem; break; } } - itemPg->removeChild(it); - itemPl->addChild(it); + destPage->removeChild(it); + destParent->addChild(it); } } else { - itemPg = (OutlineTreeItem*)it->parent(); - while (itemPg->type != 2) + destPage = (OutlineTreeItem*)it->parent(); + while (destPage->type != 2) { - itemPg = dynamic_cast<OutlineTreeItem*>(itemPg->parent()); - if (!itemPg) - qFatal("OutlineWidget::dropEvent !itemPg 3"); + destPage = dynamic_cast<OutlineTreeItem*>(destPage->parent()); + if (!destPage) + qFatal("OutlineWidget::dropEvent !destPage 3"); } } - if (itemPl->indexOfChild(it) != itemPl->childCount() - 1) - { - OutlineTreeItem *itemBe = dynamic_cast<OutlineTreeItem*>(itemPl->child(itemPl->indexOfChild(it) + 1)); - if (!itemBe) - qFatal("OutlineWidget::dropEvent !itemBe"); - if ((itemBe->type == 1) || (itemBe->type == 3) || (itemBe->type == 4)) + + // inserts into a groupItemList or the documents Items list + auto insertTo = [destParent, item, its, &idxs](QList<PageItem*>* list) { - if (item->PageItemObject->isGroupChild()) - item->DocObject->removeFromGroup(item->PageItemObject); - else - item->DocObject->Items->removeOne(item->PageItemObject); - if (itemBe->PageItemObject->isGroupChild()) - { - PageItem* group = itemBe->PageItemObject->Parent; - int d = group->groupItemList.indexOf(itemBe->PageItemObject); - double xx = item->PageItemObject->xPos() - itemPar->PageObject->xOffset() + itemPg->PageObject->xOffset(); - double yy = item->PageItemObject->yPos() - itemPar->PageObject->yOffset() + itemPg->PageObject->yOffset(); - item->PageItemObject->setXYPos(xx, yy); - item->DocObject->addToGroup(group, item->PageItemObject); - group->groupItemList.insert(d, item->PageItemObject); - item->PageItemObject->setLayer(group->m_layerID); - } - else - { - int d = item->DocObject->Items->indexOf(itemBe->PageItemObject); - item->DocObject->Items->insert(d+1, item->PageItemObject); - if (itemPl->type == 5) - item->PageItemObject->setLayer(itemPl->LayerID); - double xx = item->PageItemObject->xPos() - itemPar->PageObject->xOffset() + itemPg->PageObject->xOffset(); - double yy = item->PageItemObject->yPos() - itemPar->PageObject->yOffset() + itemPg->PageObject->yOffset(); - item->PageItemObject->setXYPos(xx, yy); - } - item->PageItemObject->setRedrawBounding(); - item->DocObject->setModified(true); - item->DocObject->scMW()->showLayer(); - item->DocObject->scMW()->closeActiveWindowMasterPageEditor(); - if (item->PageItemObject->isGroup()) - { - item->DocObject->GroupOnPage(item->PageItemObject); - item->DocObject->scMW()->selectItemsFromOutlines(item->PageItemObject, false); - } - else + size_t d{ 0 }; + if (destParent->indexOfChild(its.at(0)) < destParent->childCount() - idxs.size()) { - item->PageItemObject->OwnPage = item->DocObject->OnPage(item->PageItemObject); - item->DocObject->scMW()->selectItemsFromOutlines(item->PageItemObject, true); + OutlineTreeItem* dest = dynamic_cast<OutlineTreeItem*>(destParent->child(destParent->indexOfChild(its.at(0)) + idxs.size())); + if (!dest) + qFatal("OutlineWidget::dropEvent !dest 2"); + d = list->indexOf(dest->PageItemObject) + 1; } - selList.append(it); + list->insert(d, item->PageItemObject); + }; + + // moves the item. + // do not use this while the item is in a group + auto moveItem = [item, sourcePage, destPage]() { + double xx = item->PageItemObject->xPos() - sourcePage->PageObject->xOffset() + destPage->PageObject->xOffset(); + double yy = item->PageItemObject->yPos() - sourcePage->PageObject->yOffset() + destPage->PageObject->yOffset(); + item->PageItemObject->setXYPos(xx, yy); + }; + + if ((destParent->type == 2) || (destParent->type == 5)) + { + if (item->PageItemObject->isGroupChild()) + { + item->DocObject->removeFromGroup(item->PageItemObject); + insertTo(item->DocObject->Items); } + if (destParent->type == 5) + item->PageItemObject->setLayer(destParent->LayerID); + moveItem(); } else { - // itemPl->insertChild(0, itemPl->takeChild(itemPl->indexOfChild(it))); - if ((itemPl->type == 2) || (itemPl->type == 5)) + if (!destParent) + qFatal("OutlineWidget::dropEvent !destParent 2"); + double preRemoveyy = item->PageItemObject->yPos(); + if ((destParent->type == 1) || (destParent->type == 3) || (destParent->type == 4)) { if (item->PageItemObject->isGroupChild()) - { item->DocObject->removeFromGroup(item->PageItemObject); - item->DocObject->Items->append(item->PageItemObject); - } - if (itemPl->type == 5) - item->PageItemObject->setLayer(itemPl->LayerID); - double xx = item->PageItemObject->xPos() - itemPar->PageObject->xOffset() + itemPg->PageObject->xOffset(); - double yy = item->PageItemObject->yPos() - itemPar->PageObject->yOffset() + itemPg->PageObject->yOffset(); - item->PageItemObject->setXYPos(xx, yy); - } - else - { - OutlineTreeItem *itemBe = dynamic_cast<OutlineTreeItem*>(it->parent()); - if (!itemBe) - qFatal("OutlineWidget::dropEvent !itemBe 2"); - if ((itemBe->type == 1) || (itemBe->type == 3) || (itemBe->type == 4)) - { - if (item->PageItemObject->isGroupChild()) - item->DocObject->removeFromGroup(item->PageItemObject); - else - item->DocObject->Items->removeOne(item->PageItemObject); - PageItem* group = itemBe->PageItemObject; - double xx = item->PageItemObject->xPos() - itemPar->PageObject->xOffset() + itemPg->PageObject->xOffset(); - double yy = item->PageItemObject->yPos() - itemPar->PageObject->yOffset() + itemPg->PageObject->yOffset(); - item->PageItemObject->setXYPos(xx, yy); - item->DocObject->addToGroup(group, item->PageItemObject); - group->groupItemList.append(item->PageItemObject); - item->PageItemObject->setLayer(group->m_layerID); - } - } - item->PageItemObject->setRedrawBounding(); - item->DocObject->setModified(true); - item->DocObject->scMW()->showLayer(); - item->DocObject->scMW()->closeActiveWindowMasterPageEditor(); - if (item->PageItemObject->isGroup()) - { - item->DocObject->GroupOnPage(item->PageItemObject); - item->DocObject->scMW()->selectItemsFromOutlines(item->PageItemObject, false); - } - else - { - item->PageItemObject->OwnPage = item->DocObject->OnPage(item->PageItemObject); - item->DocObject->scMW()->selectItemsFromOutlines(item->PageItemObject, true, 1); + else + item->DocObject->Items->removeOne(item->PageItemObject); + moveItem(); + PageItem* destGroup = destParent->PageItemObject; + item->DocObject->addToGroup(destGroup, item->PageItemObject); + insertTo(&destGroup->groupItemList); + item->PageItemObject->setLayer(destGroup->m_layerID); } - selList.append(it); } + item->PageItemObject->setRedrawBounding(); + item->DocObject->setModified(true); + item->DocObject->scMW()->showLayer(); + item->DocObject->scMW()->closeActiveWindowMasterPageEditor(); + if (item->PageItemObject->isGroup()) + { + item->DocObject->GroupOnPage(item->PageItemObject); + item->DocObject->scMW()->selectItemsFromOutlines(item->PageItemObject, false); + } + else + { + item->PageItemObject->OwnPage = item->DocObject->OnPage(item->PageItemObject); + item->DocObject->scMW()->selectItemsFromOutlines(item->PageItemObject, true, 1); + } + selList.append(it); } selectItems(selList); } |
Date Modified | Username | Field | Change |
---|---|---|---|
2025-07-09 15:20 | tropion | New Issue | |
2025-07-09 15:20 | tropion | File Added: moveItems.diff | |
2025-07-09 15:20 | tropion | File Added: groups.sla | |
2025-07-14 18:58 | ale | Note Added: 0052887 | |
2025-07-22 16:27 | tropion | Note Added: 0052911 | |
2025-07-22 16:27 | tropion | File Added: moveItems2.diff |