Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
c5df0a1d
Commit
c5df0a1d
authored
Mar 09, 2010
by
Jens Bache-Wiig
Browse files
Fix text eliding on progress bars
We need this for translations. I also added the label to the tool tip.
parent
3999651f
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/progressmanager/futureprogress.cpp
View file @
c5df0a1d
...
...
@@ -149,42 +149,33 @@ void FutureProgress::cancel()
m_watcher
.
future
().
cancel
();
}
void
FutureProgress
::
updateToolTip
(
const
QString
&
text
)
{
setToolTip
(
"<b>"
+
title
()
+
"</b><br>"
+
text
);
}
void
FutureProgress
::
setStarted
()
{
m_progress
->
reset
();
m_progress
->
setError
(
false
);
m_progress
->
setRange
(
m_watcher
.
progressMinimum
(),
m_watcher
.
progressMaximum
());
m_progress
->
setValue
(
m_watcher
.
progressValue
());
// if (m_watcher.progressMinimum() == 0 && m_watcher.progressMaximum() == 0)
// m_progress->startAnimation();
}
void
FutureProgress
::
setFinished
()
{
// m_progress->stopAnimation();
setToolTip
(
m_watcher
.
future
().
progressText
());
updateToolTip
(
m_watcher
.
future
().
progressText
());
if
(
m_watcher
.
future
().
isCanceled
())
{
m_progress
->
setError
(
true
);
// m_progress->execGlowOut(true);
}
else
{
m_progress
->
setError
(
false
);
// m_progress->execGlowOut(false);
}
// m_progress->showToolTip();
emit
finished
();
}
void
FutureProgress
::
setProgressRange
(
int
min
,
int
max
)
{
m_progress
->
setRange
(
min
,
max
);
if
(
min
!=
0
||
max
!=
0
)
{
// m_progress->setUsingAnimation(false);
}
else
{
// m_progress->setUsingAnimation(true);
if
(
m_watcher
.
future
().
isRunning
())
{
//m_progress->startAnimation();
}
}
}
void
FutureProgress
::
setProgressValue
(
int
val
)
...
...
@@ -194,7 +185,7 @@ void FutureProgress::setProgressValue(int val)
void
FutureProgress
::
setProgressText
(
const
QString
&
text
)
{
set
ToolTip
(
text
);
update
ToolTip
(
text
);
}
/*!
...
...
src/plugins/coreplugin/progressmanager/futureprogress.h
View file @
c5df0a1d
...
...
@@ -73,6 +73,7 @@ protected:
void
mousePressEvent
(
QMouseEvent
*
event
);
private
slots
:
void
updateToolTip
(
const
QString
&
);
void
cancel
();
void
setStarted
();
void
setFinished
();
...
...
src/plugins/coreplugin/progressmanager/progressbar.cpp
View file @
c5df0a1d
...
...
@@ -161,18 +161,24 @@ void ProgressBar::paintEvent(QPaintEvent *)
textBounds
.
moveCenter
(
rect
().
center
());
int
alignment
=
Qt
::
AlignHCenter
;
// If there is not enough room when centered, we left align the text
if
(
value
()
<
maximum
()
&&
!
m_error
&&
textBounds
.
right
()
>
rect
().
right
()
-
CANCEL_WIDTH
)
int
textSpace
=
rect
().
width
()
-
CANCEL_WIDTH
-
8
;
// If there is not enough room when centered, we left align and
// elide the text
QString
elidedtitle
=
m_title
;
if
(
value
()
<
maximum
()
&&
!
m_error
&&
textBounds
.
right
()
>
textSpace
)
{
alignment
=
Qt
::
AlignLeft
;
elidedtitle
=
fm
.
elidedText
(
m_title
,
Qt
::
ElideRight
,
textSpace
);
}
QRect
textRect
=
rect
().
adjusted
(
INDENT
+
1
,
1
,
-
INDENT
-
1
,
0
);
textRect
.
setHeight
(
h
+
5
);
p
.
setPen
(
QColor
(
0
,
0
,
0
,
120
));
p
.
drawText
(
textRect
,
alignment
|
Qt
::
AlignBottom
,
m_
title
);
p
.
drawText
(
textRect
,
alignment
|
Qt
::
AlignBottom
,
elided
title
);
p
.
translate
(
0
,
-
1
);
p
.
setPen
(
Utils
::
StyleHelper
::
panelTextColor
());
p
.
drawText
(
textRect
,
alignment
|
Qt
::
AlignBottom
,
m_
title
);
p
.
drawText
(
textRect
,
alignment
|
Qt
::
AlignBottom
,
elided
title
);
p
.
translate
(
0
,
1
);
m_progressHeight
=
PROGRESSBAR_HEIGHT
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment