mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -04:00
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:
parent
7334e4d5de
commit
7d541318b3
8 changed files with 65 additions and 27 deletions
|
@ -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);
|
||||
|
|
|
@ -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() ;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue