further improvements to layouts and sizes for high DPI screens

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8554 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-06-25 20:11:39 +00:00
parent 7334e4d5de
commit 7d541318b3
8 changed files with 65 additions and 27 deletions

View file

@ -235,6 +235,9 @@ RSGraphWidget::RSGraphWidget(QWidget *parent)
_y_scale = 1.0f ;
_timer->start(1000);
float FS = QFontMetricsF(font()).height();
setMinimumHeight(12*FS);
}
void RSGraphWidget::updateIfPossible()
@ -320,6 +323,22 @@ void RSGraphWidget::paintEvent(QPaintEvent *)
_painter->end();
}
QSizeF RSGraphWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
{
float FS = QFontMetricsF(font()).height();
float fact = FS/14.0 ;
switch(which)
{
defaut:
case Qt::MinimumSize:
case Qt::PreferredSize:
return QSizeF(70*FS,12*FS);
case Qt::MaximumSize:
return QSizeF(700*FS,120*FS);
}
}
QColor RSGraphWidget::getColor(int i)
{
// shuffle the colors a little bit
@ -598,7 +617,7 @@ void RSGraphWidget::paintLegend()
QPen oldPen = _painter->pen();
_painter->setPen(QPen(getColor(i), Qt::SolidLine));
_painter->drawLine(QPointF(SCALE_WIDTH*fact+10.0*fact, pos), QPointF(SCALE_WIDTH*fact+30.0*fact, pos));
_painter->drawLine(QPointF(SCALE_WIDTH*fact+10.0*fact, pos+FS/3), QPointF(SCALE_WIDTH*fact+30.0*fact, pos+FS/3));
_painter->setPen(oldPen);
_painter->setPen(SCALE_COLOR);

View file

@ -153,6 +153,8 @@ class RSGraphWidget: public QFrame
/** Overloaded QWidget::paintEvent() */
void paintEvent(QPaintEvent *event);
virtual QSizeF sizeHint( Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const;
protected slots:
void updateIfPossible() ;