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
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
5f084028
Commit
5f084028
authored
Mar 18, 2013
by
Sebastian Eichelbaum
Browse files
[FIX] fixed GUI freeze when printing long messages using the WLogger.
parent
8bd3aca5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
19 deletions
+8
-19
src/qt4gui/WQtMessageDock.cpp
src/qt4gui/WQtMessageDock.cpp
+1
-1
src/qt4gui/guiElements/WScaleLabel.cpp
src/qt4gui/guiElements/WScaleLabel.cpp
+7
-18
No files found.
src/qt4gui/WQtMessageDock.cpp
View file @
5f084028
...
...
@@ -39,7 +39,7 @@
#include "WQtMessageDock.h"
#include "WQtMessageDock.moc"
#define MAXITEMS
2
5
#define MAXITEMS 5
0
WQtMessageDock
::
WQtMessageDock
(
QString
dockTitle
,
QWidget
*
parent
)
:
WQtDockWidget
(
dockTitle
,
parent
)
...
...
src/qt4gui/guiElements/WScaleLabel.cpp
View file @
5f084028
...
...
@@ -22,6 +22,8 @@
//
//---------------------------------------------------------------------------
#include <cmath>
#include "../WGuiConsts.h"
#include "WScaleLabel.h"
...
...
@@ -63,7 +65,7 @@ WScaleLabel::WScaleLabel( const QString &text, QWidget* parent ):
void
WScaleLabel
::
construct
()
{
setMinimumWidth
(
fontMetrics
().
width
(
m_orgText
.
left
(
m_minLength
)
+
tr
(
".."
)
)
+
m_additionalWidth
);
setMinimumWidth
(
fontMetrics
().
width
(
m_orgText
.
left
(
m_minLength
)
+
tr
(
"..
.
"
)
)
+
m_additionalWidth
);
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
Maximum
);
setMargin
(
WGLOBAL_MARGIN
);
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
);
...
...
@@ -86,33 +88,20 @@ QSize WScaleLabel::minimumSizeHint() const
size_t
WScaleLabel
::
calculateSize
(
size_t
chars
)
const
{
return
fontMetrics
().
width
(
m_orgText
.
left
(
chars
)
+
tr
(
".."
)
)
+
2
*
margin
()
+
m_additionalWidth
;
return
fontMetrics
().
width
(
m_orgText
.
left
(
chars
)
+
tr
(
"..
.
"
)
)
+
2
*
margin
()
+
m_additionalWidth
;
}
void
WScaleLabel
::
setText
(
const
QString
&
text
)
{
m_orgText
=
text
;
setMinimumWidth
(
fontMetrics
().
width
(
m_orgText
.
left
(
m_minLength
)
+
tr
(
".."
)
)
+
2
*
margin
()
+
m_additionalWidth
);
setMinimumWidth
(
fontMetrics
().
width
(
m_orgText
.
left
(
m_minLength
)
+
tr
(
"..
.
"
)
)
+
2
*
margin
()
+
m_additionalWidth
);
fitTextToSize
();
}
void
WScaleLabel
::
fitTextToSize
()
{
int
newwidth
=
width
();
QFontMetrics
fn
=
fontMetrics
();
if
(
newwidth
<
fn
.
width
(
m_orgText
)
)
{
QString
useText
=
m_orgText
.
left
(
m_orgText
.
length
()
-
1
);
while
(
fn
.
width
(
useText
+
tr
(
".."
)
)
>
newwidth
||
useText
.
length
()
==
0
)
{
useText
=
useText
.
left
(
useText
.
length
()
-
1
);
}
QLabel
::
setText
(
useText
+
tr
(
".."
)
);
}
else
{
QLabel
::
setText
(
m_orgText
);
}
QString
useText
=
fontMetrics
().
elidedText
(
m_orgText
,
Qt
::
ElideRight
,
width
()
);
QLabel
::
setText
(
useText
);
}
void
WScaleLabel
::
addAdditionalWidth
(
int
w
)
...
...
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