Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Krita
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tusooa Zhu
Krita
Commits
9bf975cb
Commit
9bf975cb
authored
Mar 25, 2007
by
Thomas Zander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature to KoShape::absolutePosition
svn path=/trunk/koffice/; revision=646453
parent
1f04ffa7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
5 deletions
+31
-5
libs/flake/KoFlake.h
libs/flake/KoFlake.h
+9
-0
libs/flake/KoShape.cpp
libs/flake/KoShape.cpp
+18
-2
libs/flake/KoShape.h
libs/flake/KoShape.h
+4
-3
No files found.
libs/flake/KoFlake.h
View file @
9bf975cb
...
...
@@ -54,6 +54,15 @@ public:
ShapeOnTop
///< return the shape highest z-ordering, regardless of selection.
};
/// position. See KoShape::absolutePosition()
enum
Position
{
TopLeftCorner
,
TopRightCorner
,
BottomLeftCorner
,
BottomRightCorner
,
CenteredPositon
};
private:
KoFlake
();
...
...
libs/flake/KoShape.cpp
View file @
9bf975cb
...
...
@@ -416,8 +416,24 @@ const QPainterPath KoShape::outline() const {
return
path
;
}
QPointF
KoShape
::
absolutePosition
()
const
{
return
d
->
matrix
.
map
(
QPointF
(
size
().
width
()
/
2.0
,
size
().
height
()
/
2.0
));
QPointF
KoShape
::
absolutePosition
(
KoFlake
::
Position
anchor
)
const
{
QPointF
point
;
switch
(
anchor
)
{
case
KoFlake
::
TopLeftCorner
:
break
;
case
KoFlake
::
TopRightCorner
:
point
=
QPointF
(
size
().
width
(),
0.0
);
break
;
case
KoFlake
::
BottomLeftCorner
:
point
=
QPointF
(
0.0
,
size
().
height
());
break
;
case
KoFlake
::
BottomRightCorner
:
point
=
QPointF
(
size
().
width
(),
size
().
height
());
break
;
case
KoFlake
::
CenteredPositon
:
point
=
QPointF
(
size
().
width
()
/
2.0
,
size
().
height
()
/
2.0
);
break
;
}
return
d
->
matrix
.
map
(
point
);
}
void
KoShape
::
setAbsolutePosition
(
QPointF
newPosition
)
{
...
...
libs/flake/KoShape.h
View file @
9bf975cb
...
...
@@ -23,6 +23,7 @@
#define KOSHAPE_H
#include "KoInsets.h"
#include "KoFlake.h"
#include <QMatrix>
#include <QVector>
...
...
@@ -448,10 +449,10 @@ public:
/**
* Return the position of this shape regardless of rotation/skew/scaling and regardless of
* this shape having a parent (being in a group) or not.<br>
*
The returned value is the center of the shape
.
*
@param anchor The place on the (unaltered) shape that you want the position of
.
* @return the point that is the absolute, centered position of this shape.
*/
QPointF
absolutePosition
()
const
;
QPointF
absolutePosition
(
KoFlake
::
Position
anchor
=
KoFlake
::
CenteredPositon
)
const
;
/**
* Move this shape to an absolute position where the end location will be the same
...
...
@@ -558,7 +559,7 @@ protected:
* @see saveOdf()
*/
virtual
const
char
*
odfTagName
()
const
{
return
""
;
}
/**
* @brief Save the data that is special by each shape
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment