mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
actually use defaultIconSize()
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
5a2db2db4b
commit
72b256de62
3 changed files with 8 additions and 21 deletions
|
@ -4,6 +4,7 @@
|
||||||
#include "dive.h"
|
#include "dive.h"
|
||||||
#include "profile.h"
|
#include "profile.h"
|
||||||
#include "membuffer.h"
|
#include "membuffer.h"
|
||||||
|
#include "metrics.h"
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
#include <QPen>
|
#include <QPen>
|
||||||
|
@ -138,15 +139,9 @@ ToolTipItem::ToolTipItem(QGraphicsItem *parent) : QGraphicsPathItem(parent),
|
||||||
timeAxis(0),
|
timeAxis(0),
|
||||||
lastTime(-1)
|
lastTime(-1)
|
||||||
{
|
{
|
||||||
// compute icon size, by rounding the font height to the nearest multiple of
|
// set icon sizes and spacing from the default icon size
|
||||||
// 16 (small), and setting medium, big and spacing proportionally
|
|
||||||
if (iconMetrics.small == -1) {
|
if (iconMetrics.small == -1) {
|
||||||
int height = QFontMetrics(title->font()).height();
|
iconMetrics.small = defaultIconSize();
|
||||||
iconMetrics.small = (height + 8)/16;
|
|
||||||
iconMetrics.small *= 16;
|
|
||||||
// enforce a minimum small
|
|
||||||
if (iconMetrics.small < 16)
|
|
||||||
iconMetrics.small = 16;
|
|
||||||
iconMetrics.medium = iconMetrics.small + iconMetrics.small/2;
|
iconMetrics.medium = iconMetrics.small + iconMetrics.small/2;
|
||||||
iconMetrics.big = iconMetrics.small*2;
|
iconMetrics.big = iconMetrics.small*2;
|
||||||
iconMetrics.spacing = iconMetrics.small/4;
|
iconMetrics.spacing = iconMetrics.small/4;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "starwidget.h"
|
#include "starwidget.h"
|
||||||
|
#include "metrics.h"
|
||||||
#include <QSvgRenderer>
|
#include <QSvgRenderer>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
|
@ -83,14 +84,9 @@ StarWidget::StarWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f),
|
||||||
current(0),
|
current(0),
|
||||||
readOnly(false)
|
readOnly(false)
|
||||||
{
|
{
|
||||||
// compute image size, by rounding the font height to the nearest multiple of 16
|
// set image size and spacing from the default icon size
|
||||||
if (imgMetrics.size == -1) {
|
if (imgMetrics.size == -1) {
|
||||||
int height = QFontMetrics(parent->font()).height();
|
imgMetrics.size = defaultIconSize();
|
||||||
imgMetrics.size = (height + 8)/16;
|
|
||||||
imgMetrics.size *= 16;
|
|
||||||
// enforce a minimum size
|
|
||||||
if (imgMetrics.size < 16)
|
|
||||||
imgMetrics.size = 16;
|
|
||||||
imgMetrics.spacing = imgMetrics.size/8;
|
imgMetrics.spacing = imgMetrics.size/8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,8 @@ TableView::TableView(QWidget *parent) : QWidget(parent)
|
||||||
QFontMetrics fm(defaultModelFont());
|
QFontMetrics fm(defaultModelFont());
|
||||||
int text_ht = fm.height();
|
int text_ht = fm.height();
|
||||||
int text_em = fm.width('m');
|
int text_em = fm.width('m');
|
||||||
// icon size is the closest multiple of 16 to the font height
|
// set icon and button size from the default icon size
|
||||||
metrics.icon_size = (text_ht + 8)/16;
|
metrics.icon_size = defaultIconSize(text_ht);
|
||||||
metrics.icon_size *= 16;
|
|
||||||
// enforce a minimum size
|
|
||||||
if (metrics.icon_size < 16)
|
|
||||||
metrics.icon_size = 16;
|
|
||||||
metrics.btn_size = metrics.icon_size + metrics.icon_size/2;
|
metrics.btn_size = metrics.icon_size + metrics.icon_size/2;
|
||||||
metrics.btn_gap = metrics.icon_size/8;
|
metrics.btn_gap = metrics.icon_size/8;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue