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
5c30e20f
Commit
5c30e20f
authored
Feb 11, 2013
by
Sebastian Eichelbaum
Browse files
[FIX
#243
] title text now visible unscaled as long as possible
parent
41f0f1e7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
7 deletions
+20
-7
src/qt4gui/WQtGLDockWidget.cpp
src/qt4gui/WQtGLDockWidget.cpp
+1
-2
src/qt4gui/WQtGLDockWidget.h
src/qt4gui/WQtGLDockWidget.h
+3
-1
src/qt4gui/guiElements/WScaleLabel.cpp
src/qt4gui/guiElements/WScaleLabel.cpp
+7
-4
src/qt4gui/guiElements/WScaleLabel.h
src/qt4gui/guiElements/WScaleLabel.h
+9
-0
No files found.
src/qt4gui/WQtGLDockWidget.cpp
View file @
5c30e20f
...
...
@@ -32,7 +32,6 @@
#include <QtGui/QToolButton>
#include <QtGui/QToolBar>
#include "guiElements/WScaleLabel.h"
#include "WQt4Gui.h"
#include "WMainWindow.h"
...
...
@@ -235,7 +234,7 @@ WQtGLDockWidgetTitle::WQtGLDockWidgetTitle( WQtGLDockWidget* parent, const QStri
void
WQtGLDockWidgetTitle
::
resizeEvent
(
QResizeEvent
*
event
)
{
int
required
=
m_title
->
minimumSizeHint
().
wid
th
()
+
m_tools
->
sizeHint
().
width
()
+
m_closeBtn
->
sizeHint
().
width
();
int
required
=
m_title
->
calculateSize
(
m_title
->
text
().
leng
th
()
)
+
m_tools
->
sizeHint
().
width
()
+
m_closeBtn
->
sizeHint
().
width
();
if
(
event
->
size
().
width
()
<
required
)
{
m_tools
->
setHidden
(
true
);
...
...
src/qt4gui/WQtGLDockWidget.h
View file @
5c30e20f
...
...
@@ -35,6 +35,8 @@
#include "core/graphicsEngine/WGECamera.h"
#include "guiElements/WScaleLabel.h"
#include "WQtGLWidget.h"
/**
...
...
@@ -198,7 +200,7 @@ private:
/**
* Title label
*/
Q
Label
*
m_title
;
WScale
Label
*
m_title
;
/**
* Close button
...
...
src/qt4gui/guiElements/WScaleLabel.cpp
View file @
5c30e20f
...
...
@@ -76,14 +76,17 @@ void WScaleLabel::resizeEvent( QResizeEvent* /*event*/ )
QSize
WScaleLabel
::
sizeHint
()
const
{
return
QSize
(
fontMetrics
().
width
(
m_orgText
)
+
2
*
margin
()
+
m_additionalWidth
,
QLabel
::
sizeHint
().
height
()
);
return
QSize
(
calculateSize
(
m_orgText
.
length
()
),
QLabel
::
sizeHint
().
height
()
);
}
QSize
WScaleLabel
::
minimumSizeHint
()
const
{
return
QSize
(
fontMetrics
().
width
(
m_orgText
.
left
(
m_minLength
)
+
tr
(
".."
)
)
+
2
*
margin
()
+
m_additionalWidth
,
QLabel
::
minimumSizeHint
().
height
()
);
return
QSize
(
calculateSize
(
m_minLength
),
QLabel
::
minimumSizeHint
().
height
()
);
}
size_t
WScaleLabel
::
calculateSize
(
size_t
chars
)
const
{
return
fontMetrics
().
width
(
m_orgText
.
left
(
chars
)
+
tr
(
".."
)
)
+
2
*
margin
()
+
m_additionalWidth
;
}
void
WScaleLabel
::
setText
(
const
QString
&
text
)
...
...
src/qt4gui/guiElements/WScaleLabel.h
View file @
5c30e20f
...
...
@@ -111,6 +111,15 @@ public:
* \return the number of chars visible all the time
*/
virtual
size_t
getMinimalLength
()
const
;
/**
* Calculate the size that is needed for the given number of chars.
*
* \param chars number of chars
*
* \return the size in pixels
*/
virtual
size_t
calculateSize
(
size_t
chars
)
const
;
protected:
/**
* custom implementation of the resize event
...
...
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