Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Algorithms Library Toolkit Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Algorithms Library Toolkit
Algorithms Library Toolkit Core
Commits
112024eb
Commit
112024eb
authored
6 years ago
by
Martin Hanzik
Committed by
Jan Trávníček
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Consider number of inputs for graphics box height
parent
2231233c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
agui2/src/Graphics/GraphicsBox.cpp
+5
-10
5 additions, 10 deletions
agui2/src/Graphics/GraphicsBox.cpp
agui2/src/Graphics/GraphicsBox.hpp
+0
-2
0 additions, 2 deletions
agui2/src/Graphics/GraphicsBox.hpp
with
5 additions
and
12 deletions
agui2/src/Graphics/GraphicsBox.cpp
+
5
−
10
View file @
112024eb
...
@@ -20,7 +20,10 @@ GraphicsBox::GraphicsBox(std::unique_ptr<ModelBox> modelBox, QPointF pos)
...
@@ -20,7 +20,10 @@ GraphicsBox::GraphicsBox(std::unique_ptr<ModelBox> modelBox, QPointF pos)
this
->
setPos
(
pos
);
this
->
setPos
(
pos
);
this
->
setFlags
(
ItemIsMovable
);
this
->
setFlags
(
ItemIsMovable
);
this
->
setZValue
(
1
);
this
->
setZValue
(
1
);
this
->
setBoundingRectangle
();
this
->
boundRect
=
QFontMetrics
(
this
->
font
).
boundingRect
(
this
->
text
);
this
->
boundRect
.
setHeight
(
std
::
max
(
this
->
boundRect
.
height
(),
std
::
max
(
this
->
modelBox
->
getMaxInputCount
(),
uint8_t
(
1
))
*
16.0
));
this
->
boundRect
.
adjust
(
-
20
,
-
20
,
20
,
20
);
uint8_t
maxInputCount
=
this
->
modelBox
->
getMaxInputCount
();
uint8_t
maxInputCount
=
this
->
modelBox
->
getMaxInputCount
();
for
(
uint8_t
i
=
0
;
i
<
maxInputCount
;
++
i
)
for
(
uint8_t
i
=
0
;
i
<
maxInputCount
;
++
i
)
...
@@ -36,12 +39,6 @@ GraphicsBox::GraphicsBox(std::unique_ptr<ModelBox> modelBox, QPointF pos)
...
@@ -36,12 +39,6 @@ GraphicsBox::GraphicsBox(std::unique_ptr<ModelBox> modelBox, QPointF pos)
}
}
}
}
void
GraphicsBox
::
setBoundingRectangle
()
{
this
->
boundRect
=
QFontMetrics
(
this
->
font
).
boundingRect
(
this
->
text
);
this
->
boundRect
.
adjust
(
-
20
,
-
20
,
20
,
20
);
}
QRectF
GraphicsBox
::
boundingRect
()
const
{
QRectF
GraphicsBox
::
boundingRect
()
const
{
return
this
->
boundRect
;
return
this
->
boundRect
;
}
}
...
@@ -50,7 +47,5 @@ void GraphicsBox::paint(QPainter* painter, const QStyleOptionGraphicsItem* optio
...
@@ -50,7 +47,5 @@ void GraphicsBox::paint(QPainter* painter, const QStyleOptionGraphicsItem* optio
painter
->
setFont
(
this
->
font
);
painter
->
setFont
(
this
->
font
);
painter
->
setPen
(
Qt
::
white
);
painter
->
setPen
(
Qt
::
white
);
painter
->
fillRect
(
this
->
boundRect
,
this
->
color
);
painter
->
fillRect
(
this
->
boundRect
,
this
->
color
);
prepareGeometryChange
();
painter
->
drawText
(
this
->
boundRect
,
Qt
::
AlignCenter
,
this
->
text
);
painter
->
drawText
(
this
->
boundRect
,
Qt
::
AlignCenter
,
this
->
text
,
&
this
->
boundRect
);
this
->
boundRect
.
adjust
(
-
20
,
-
20
,
20
,
20
);
}
}
This diff is collapsed.
Click to expand it.
agui2/src/Graphics/GraphicsBox.hpp
+
0
−
2
View file @
112024eb
...
@@ -12,8 +12,6 @@ class GraphicsBox : public QGraphicsObject {
...
@@ -12,8 +12,6 @@ class GraphicsBox : public QGraphicsObject {
public:
public:
GraphicsBox
(
std
::
unique_ptr
<
ModelBox
>
modelBox
,
QPointF
pos
);
GraphicsBox
(
std
::
unique_ptr
<
ModelBox
>
modelBox
,
QPointF
pos
);
void
setBoundingRectangle
();
QRectF
boundingRect
()
const
override
;
QRectF
boundingRect
()
const
override
;
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
override
;
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
override
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment