diff --git a/dust3d.pro b/dust3d.pro index 4cd08568..060a12ee 100644 --- a/dust3d.pro +++ b/dust3d.pro @@ -4,10 +4,10 @@ DEFINES += NDEBUG RESOURCES += resources.qrc isEmpty(HUMAN_VERSION) { - HUMAN_VERSION = "1.0.0-beta.9" + HUMAN_VERSION = "1.0.0-beta.10" } isEmpty(VERSION) { - VERSION = 1.0.0.9 + VERSION = 1.0.0.10 } REPOSITORY_URL = "https://github.com/huxingyi/dust3d" diff --git a/src/documentwindow.cpp b/src/documentwindow.cpp index 0c31ce8c..245d8933 100644 --- a/src/documentwindow.cpp +++ b/src/documentwindow.cpp @@ -117,7 +117,7 @@ DocumentWindow::DocumentWindow() : QVBoxLayout *toolButtonLayout = new QVBoxLayout; toolButtonLayout->setSpacing(0); - toolButtonLayout->setContentsMargins(Theme::dp2px(5), Theme::dp2px(10), Theme::dp2px(4), 0); + toolButtonLayout->setContentsMargins(5, 10, 4, 0); QPushButton *addButton = new QPushButton(QChar(fa::plus)); Theme::initAwesomeButton(addButton); @@ -177,15 +177,15 @@ DocumentWindow::DocumentWindow() : toolButtonLayout->addWidget(dragButton); toolButtonLayout->addWidget(zoomInButton); toolButtonLayout->addWidget(zoomOutButton); - toolButtonLayout->addSpacing(Theme::dp2px(10)); + toolButtonLayout->addSpacing(10); toolButtonLayout->addWidget(m_xlockButton); toolButtonLayout->addWidget(m_ylockButton); toolButtonLayout->addWidget(m_zlockButton); toolButtonLayout->addWidget(m_radiusLockButton); - toolButtonLayout->addSpacing(Theme::dp2px(10)); + toolButtonLayout->addSpacing(10); toolButtonLayout->addWidget(rotateCounterclockwiseButton); toolButtonLayout->addWidget(rotateClockwiseButton); - toolButtonLayout->addSpacing(Theme::dp2px(10)); + toolButtonLayout->addSpacing(10); toolButtonLayout->addWidget(regenerateButton); @@ -204,7 +204,7 @@ DocumentWindow::DocumentWindow() : mainLeftLayout->addLayout(toolButtonLayout); mainLeftLayout->addStretch(); mainLeftLayout->addLayout(logoLayout); - mainLeftLayout->addSpacing(Theme::dp2px(10)); + mainLeftLayout->addSpacing(10); SkeletonGraphicsWidget *graphicsWidget = new SkeletonGraphicsWidget(m_document); m_graphicsWidget = graphicsWidget; @@ -298,7 +298,7 @@ DocumentWindow::DocumentWindow() : mainLayout->setContentsMargins(0, 0, 0, 0); mainLayout->addLayout(mainLeftLayout); mainLayout->addWidget(containerWidget); - mainLayout->addSpacing(Theme::dp2px(3)); + mainLayout->addSpacing(3); QWidget *centralWidget = new QWidget; centralWidget->setLayout(mainLayout); diff --git a/src/floatnumberwidget.cpp b/src/floatnumberwidget.cpp index c13fb35e..584ba761 100644 --- a/src/floatnumberwidget.cpp +++ b/src/floatnumberwidget.cpp @@ -9,7 +9,7 @@ FloatNumberWidget::FloatNumberWidget(QWidget *parent, bool singleLine) : { m_slider = new QSlider(Qt::Horizontal, this); m_slider->setRange(0, 100); - m_slider->setFixedWidth(Theme::dp2px(120)); + m_slider->setFixedWidth(120); m_label = new QLabel(this); m_label->setAlignment(Qt::AlignLeft); diff --git a/src/theme.cpp b/src/theme.cpp index dd2526ba..65a29a50 100644 --- a/src/theme.cpp +++ b/src/theme.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include "theme.h" // Red @@ -43,30 +43,20 @@ int Theme::posePreviewImageSize = 0; int Theme::motionPreviewImageSize = 0; int Theme::sidebarPreferredWidth = 0; int Theme::normalButtonSize = 0; -double Theme::dpi = 0; - -float Theme::dp2px(float dp) -{ - return dp / 72 * Theme::dpi; -} void Theme::initAwsomeBaseSizes() { - Theme::dpi = QGuiApplication::primaryScreen()->physicalDotsPerInch(); - - Theme::toolIconFontSize = QApplication::font().pixelSize(); - if (-1 == Theme::toolIconFontSize) { - Theme::toolIconFontSize = Theme::dp2px(QApplication::font().pointSize()); - } + QFontMetrics fontMetrics(QApplication::font()); + Theme::toolIconFontSize = fontMetrics.height(); Theme::toolIconSize = (int)(Theme::toolIconFontSize * 1.5); Theme::miniIconFontSize = (int)(Theme::toolIconFontSize * 0.64); Theme::miniIconSize = (int)(Theme::miniIconFontSize * 1.67); Theme::partPreviewImageSize = (Theme::miniIconSize * 3); - Theme::materialPreviewImageSize = Theme::dp2px(62); - Theme::posePreviewImageSize = Theme::dp2px(62); - Theme::motionPreviewImageSize = Theme::dp2px(62); - Theme::sidebarPreferredWidth = Theme::dp2px(150); + Theme::materialPreviewImageSize = 75; + Theme::posePreviewImageSize = 75; + Theme::motionPreviewImageSize = 75; + Theme::sidebarPreferredWidth = 200; Theme::normalButtonSize = Theme::toolIconSize * 2; qDebug() << "Theme::toolIconFontSize:" << Theme::toolIconFontSize; diff --git a/src/theme.h b/src/theme.h index 8991cc31..b8a32433 100644 --- a/src/theme.h +++ b/src/theme.h @@ -42,7 +42,6 @@ public: static int miniIconSize; static int sidebarPreferredWidth; static int normalButtonSize; - static double dpi; public: static void initAwesomeButton(QPushButton *button); static void initAwesomeLabel(QLabel *label); @@ -52,7 +51,6 @@ public: static void initAwesomeToolButton(QPushButton *button); static void initAwesomeToolButtonWithoutFont(QPushButton *button); static void initAwsomeBaseSizes(); - static float dp2px(float dp); }; #endif