Fit toolbar button size #19

master
Jeremy Hu 2018-12-02 22:02:34 +09:30
parent 52ca647b5e
commit 5704525505
5 changed files with 43 additions and 14 deletions

View File

@ -4,10 +4,10 @@ DEFINES += NDEBUG
RESOURCES += resources.qrc RESOURCES += resources.qrc
isEmpty(HUMAN_VERSION) { isEmpty(HUMAN_VERSION) {
HUMAN_VERSION = "1.0.0-beta.7" HUMAN_VERSION = "1.0.0-beta.8"
} }
isEmpty(VERSION) { isEmpty(VERSION) {
VERSION = 1.0.0.7 VERSION = 1.0.0.8
} }
REPOSITORY_URL = "https://github.com/huxingyi/dust3d" REPOSITORY_URL = "https://github.com/huxingyi/dust3d"
@ -16,7 +16,7 @@ REFERENCE_GUIDE_URL = "http://docs.dust3d.org"
QMAKE_TARGET_COMPANY = Dust3D QMAKE_TARGET_COMPANY = Dust3D
QMAKE_TARGET_PRODUCT = Dust3D QMAKE_TARGET_PRODUCT = Dust3D
QMAKE_TARGET_DESCRIPTION = "Aim to be a quick modeling tool for game development" QMAKE_TARGET_DESCRIPTION = "Dust3D is a cross-platform open-source 3D modeling software"
QMAKE_TARGET_COPYRIGHT = "Copyright (C) 2018 Dust3D Project. All Rights Reserved." QMAKE_TARGET_COPYRIGHT = "Copyright (C) 2018 Dust3D Project. All Rights Reserved."
DEFINES += "PROJECT_DEFINED_APP_COMPANY=\"\\\"$$QMAKE_TARGET_COMPANY\\\"\"" DEFINES += "PROJECT_DEFINED_APP_COMPANY=\"\\\"$$QMAKE_TARGET_COMPANY\\\"\""

View File

@ -1031,7 +1031,7 @@ void DocumentWindow::initLockButton(QPushButton *button)
{ {
QFont font; QFont font;
font.setWeight(QFont::Light); font.setWeight(QFont::Light);
//font.setPixelSize(Theme::toolIconFontSize); font.setPixelSize(Theme::toolIconFontSize);
font.setBold(false); font.setBold(false);
button->setFont(font); button->setFont(font);

View File

@ -46,6 +46,8 @@ int main(int argc, char ** argv)
font.setBold(false); font.setBold(false);
QApplication::setFont(font); QApplication::setFont(font);
Theme::initAwsomeBaseSizes();
DocumentWindow::createDocumentWindow(); DocumentWindow::createDocumentWindow();
return app.exec(); return app.exec();

View File

@ -1,3 +1,7 @@
#include <QApplication>
#include <QGuiApplication>
#include <QDebug>
#include <QScreen>
#include "theme.h" #include "theme.h"
// Red // Red
@ -29,16 +33,38 @@ float Theme::edgeAlpha = 1.0;
float Theme::fillAlpha = 50.0 / 255; float Theme::fillAlpha = 50.0 / 255;
int Theme::skeletonNodeBorderSize = 0; int Theme::skeletonNodeBorderSize = 0;
int Theme::skeletonEdgeWidth = 0; int Theme::skeletonEdgeWidth = 0;
int Theme::toolIconFontSize = 16; int Theme::toolIconFontSize = 0;
int Theme::toolIconSize = 24; int Theme::toolIconSize = 0;
int Theme::miniIconFontSize = 9; int Theme::miniIconFontSize = 0;
int Theme::miniIconSize = 15; int Theme::miniIconSize = 0;
int Theme::partPreviewImageSize = (Theme::miniIconSize * 3); int Theme::partPreviewImageSize = 0;
int Theme::materialPreviewImageSize = 75; int Theme::materialPreviewImageSize = 0;
int Theme::posePreviewImageSize = 75; int Theme::posePreviewImageSize = 0;
int Theme::motionPreviewImageSize = 75; int Theme::motionPreviewImageSize = 0;
int Theme::sidebarPreferredWidth = 200; int Theme::sidebarPreferredWidth = 0;
int Theme::normalButtonSize = Theme::toolIconSize * 2; int Theme::normalButtonSize = 0;
void Theme::initAwsomeBaseSizes()
{
Theme::toolIconFontSize = QApplication::font().pixelSize();
if (-1 == Theme::toolIconFontSize) {
double dpi = QGuiApplication::primaryScreen()->physicalDotsPerInch();
Theme::toolIconFontSize = (float)QApplication::font().pointSize() / 72 * dpi;
}
Theme::toolIconFontSize *= 0.7;
Theme::toolIconSize = (int)(Theme::toolIconFontSize * 1.67);
Theme::miniIconFontSize = (int)(Theme::toolIconFontSize * 0.64);
Theme::miniIconSize = (int)(Theme::miniIconFontSize * 1.67);
Theme::partPreviewImageSize = (Theme::miniIconSize * 3);
Theme::materialPreviewImageSize = 75;
Theme::posePreviewImageSize = 75;
Theme::motionPreviewImageSize = 75;
Theme::sidebarPreferredWidth = 200;
Theme::normalButtonSize = Theme::toolIconSize * 2;
qDebug() << "Theme::toolIconFontSize:" << Theme::toolIconFontSize;
}
QtAwesome *Theme::awesome() QtAwesome *Theme::awesome()
{ {

View File

@ -50,6 +50,7 @@ public:
static void updateAwesomeMiniButton(QPushButton *button, QChar icon, bool highlighted, bool unnormal=false); static void updateAwesomeMiniButton(QPushButton *button, QChar icon, bool highlighted, bool unnormal=false);
static void initAwesomeToolButton(QPushButton *button); static void initAwesomeToolButton(QPushButton *button);
static void initAwesomeToolButtonWithoutFont(QPushButton *button); static void initAwesomeToolButtonWithoutFont(QPushButton *button);
static void initAwsomeBaseSizes();
}; };
#endif #endif