Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
90577c31
Commit
90577c31
authored
Feb 05, 2014
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better solution for error on text widget size error
parent
3cb904a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
10 deletions
+1
-10
UBGraphicsTextItem.cpp
src/domain/UBGraphicsTextItem.cpp
+1
-9
UBGraphicsTextItem.h
src/domain/UBGraphicsTextItem.h
+0
-1
No files found.
src/domain/UBGraphicsTextItem.cpp
View file @
90577c31
...
@@ -48,7 +48,6 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent)
...
@@ -48,7 +48,6 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent)
,
mLastMousePressTime
(
QTime
::
currentTime
())
,
mLastMousePressTime
(
QTime
::
currentTime
())
,
mTypeTextHereLabel
(
tr
(
"<Type Text Here>"
))
,
mTypeTextHereLabel
(
tr
(
"<Type Text Here>"
))
{
{
mEmptyTextWidth
=
QFontMetrics
(
font
()).
width
(
mTypeTextHereLabel
);
setDelegate
(
new
UBGraphicsTextItemDelegate
(
this
,
0
));
setDelegate
(
new
UBGraphicsTextItemDelegate
(
this
,
0
));
// TODO claudio remove this because in contrast with the fact the frame should be created on demand.
// TODO claudio remove this because in contrast with the fact the frame should be created on demand.
...
@@ -331,7 +330,7 @@ void UBGraphicsTextItem::contentsChanged()
...
@@ -331,7 +330,7 @@ void UBGraphicsTextItem::contentsChanged()
if
(
toPlainText
().
isEmpty
())
if
(
toPlainText
().
isEmpty
())
{
{
resize
(
textWidth
(),
textH
eight
());
resize
(
QFontMetrics
(
font
()).
width
(
mTypeTextHereLabel
),
QFontMetrics
(
font
()).
h
eight
());
}
}
}
}
...
@@ -344,15 +343,8 @@ UBGraphicsScene* UBGraphicsTextItem::scene()
...
@@ -344,15 +343,8 @@ UBGraphicsScene* UBGraphicsTextItem::scene()
void
UBGraphicsTextItem
::
resize
(
qreal
w
,
qreal
h
)
void
UBGraphicsTextItem
::
resize
(
qreal
w
,
qreal
h
)
{
{
#ifdef Q_WS_MACX
// Claudio Mac os x >= 10.8.
// on text widget creation sometimes the computed height is completely wrong (more than 10^10)
setTextWidth
(
w
>
10000
?
250
:
w
);
setTextHeight
(
h
>
10000
?
80
:
h
);
#else
setTextWidth
(
w
);
setTextWidth
(
w
);
setTextHeight
(
h
);
setTextHeight
(
h
);
#endif
if
(
Delegate
())
if
(
Delegate
())
Delegate
()
->
positionHandles
();
Delegate
()
->
positionHandles
();
}
}
...
...
src/domain/UBGraphicsTextItem.h
View file @
90577c31
...
@@ -99,7 +99,6 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
...
@@ -99,7 +99,6 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
void
setSelected
(
bool
selected
);
void
setSelected
(
bool
selected
);
QString
mTypeTextHereLabel
;
QString
mTypeTextHereLabel
;
int
mEmptyTextWidth
;
signals
:
signals
:
void
textUndoCommandAdded
(
UBGraphicsTextItem
*
textItem
);
void
textUndoCommandAdded
(
UBGraphicsTextItem
*
textItem
);
...
...
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