ui: Fixed icon sizes when scaling to highDPI screens fails
* Fixed gcc compile error
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
int GraphViewStyle::s_gridCellSize = 5;
|
||||
int GraphViewStyle::s_gridCellPadding = 10;
|
||||
|
||||
std::unordered_map<NodeType::StyleType, float> GraphViewStyle::s_charWidths;
|
||||
std::unordered_map<NodeType::StyleType, float> GraphViewStyle::s_charHeights;
|
||||
std::map<NodeType::StyleType, float> GraphViewStyle::s_charWidths;
|
||||
std::map<NodeType::StyleType, float> GraphViewStyle::s_charHeights;
|
||||
|
||||
std::shared_ptr<GraphViewStyleImpl> GraphViewStyle::s_impl;
|
||||
|
||||
@@ -704,7 +704,7 @@ const GraphViewStyle::NodeColor& GraphViewStyle::getScreenMatchColor(bool focus)
|
||||
|
||||
float GraphViewStyle::getCharWidth(NodeType::StyleType type)
|
||||
{
|
||||
std::unordered_map<NodeType::StyleType, float>::const_iterator it = s_charWidths.find(type);
|
||||
std::map<NodeType::StyleType, float>::const_iterator it = s_charWidths.find(type);
|
||||
|
||||
if (it != s_charWidths.end())
|
||||
{
|
||||
@@ -718,7 +718,7 @@ float GraphViewStyle::getCharWidth(NodeType::StyleType type)
|
||||
|
||||
float GraphViewStyle::getCharHeight(NodeType::StyleType type)
|
||||
{
|
||||
std::unordered_map<NodeType::StyleType, float>::const_iterator it = s_charHeights.find(type);
|
||||
std::map<NodeType::StyleType, float>::const_iterator it = s_charHeights.find(type);
|
||||
|
||||
if (it != s_charHeights.end())
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "utility/math/Vector2.h"
|
||||
|
||||
@@ -150,8 +149,8 @@ private:
|
||||
static float getCharWidth(NodeType::StyleType type);
|
||||
static float getCharHeight(NodeType::StyleType type);
|
||||
|
||||
static std::unordered_map<NodeType::StyleType, float> s_charWidths;
|
||||
static std::unordered_map<NodeType::StyleType, float> s_charHeights;
|
||||
static std::map<NodeType::StyleType, float> s_charWidths;
|
||||
static std::map<NodeType::StyleType, float> s_charHeights;
|
||||
|
||||
static std::shared_ptr<GraphViewStyleImpl> s_impl;
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeNavigator* navigator)
|
||||
// m_minimizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/minimize_inactive.png").c_str(), "#5E5D5D");
|
||||
m_minimizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/minimize_inactive.png").c_str(), QColor(0x5E, 0x5D, 0x5D));
|
||||
m_minimizeButton->addState(QtIconStateButton::STATE_DISABLED, (ResourcePaths::getGuiPath().str() + "code_view/images/minimize_inactive.png").c_str());
|
||||
m_minimizeButton->setIconSize(QSize(16, 16));
|
||||
m_minimizeButton->setObjectName("file_button");
|
||||
m_minimizeButton->setToolTip("minimize");
|
||||
titleLayout->addWidget(m_minimizeButton);
|
||||
@@ -74,6 +75,7 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeNavigator* navigator)
|
||||
// m_snippetButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/snippet_inactive.png").c_str(), "#5E5D5D");
|
||||
m_snippetButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/snippet_inactive.png").c_str(), QColor(0x5E, 0x5D, 0x5D));
|
||||
m_snippetButton->addState(QtIconStateButton::STATE_DISABLED, (ResourcePaths::getGuiPath().str() + "code_view/images/snippet_inactive.png").c_str());
|
||||
m_snippetButton->setIconSize(QSize(16, 16));
|
||||
m_snippetButton->setObjectName("file_button");
|
||||
m_snippetButton->setToolTip("show snippets");
|
||||
titleLayout->addWidget(m_snippetButton);
|
||||
@@ -83,6 +85,7 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeNavigator* navigator)
|
||||
// m_maximizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/maximize_inactive.png").c_str(), "#5E5D5D");
|
||||
m_maximizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/maximize_inactive.png").c_str(), QColor(0x5E, 0x5D, 0x5D));
|
||||
m_maximizeButton->addState(QtIconStateButton::STATE_DISABLED, (ResourcePaths::getGuiPath().str() + "code_view/images/maximize_inactive.png").c_str());
|
||||
m_maximizeButton->setIconSize(QSize(16, 16));
|
||||
m_maximizeButton->setObjectName("file_button");
|
||||
m_maximizeButton->setToolTip("maximize");
|
||||
titleLayout->addWidget(m_maximizeButton);
|
||||
|
||||
@@ -22,6 +22,8 @@ QtCodeFileTitleButton::QtCodeFileTitleButton(QWidget* parent)
|
||||
setFixedHeight(std::max(fontMetrics().height() * 1.2, 28.0));
|
||||
setSizePolicy(sizePolicy().horizontalPolicy(), QSizePolicy::Fixed);
|
||||
|
||||
setIconSize(QSize(16, 16));
|
||||
|
||||
connect(this, &QtCodeFileTitleButton::clicked, this, &QtCodeFileTitleButton::clickedTitle);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ QtListItemWidget::QtListItemWidget(QtDirectoryListBox* list, QListWidgetItem* it
|
||||
m_button = new QtIconButton(
|
||||
(ResourcePaths::getGuiPath().str() + "window/dots.png").c_str(),
|
||||
(ResourcePaths::getGuiPath().str() + "window/dots_hover.png").c_str());
|
||||
m_button->setIconSize(QSize(16, 16));
|
||||
m_button->setObjectName("dotsButton");
|
||||
|
||||
layout->addWidget(m_data);
|
||||
@@ -126,6 +127,7 @@ QtDirectoryListBox::QtDirectoryListBox(QWidget *parent, const QString& listName,
|
||||
m_addButton = new QtIconButton(
|
||||
(ResourcePaths::getGuiPath().str() + "window/plus.png").c_str(),
|
||||
(ResourcePaths::getGuiPath().str() + "window/plus_hover.png").c_str());
|
||||
m_addButton->setIconSize(QSize(16, 16));
|
||||
m_addButton->setObjectName("plusButton");
|
||||
m_addButton->setToolTip("add line");
|
||||
innerLayout->addWidget(m_addButton);
|
||||
@@ -133,6 +135,7 @@ QtDirectoryListBox::QtDirectoryListBox(QWidget *parent, const QString& listName,
|
||||
m_removeButton = new QtIconButton(
|
||||
(ResourcePaths::getGuiPath().str() + "window/minus.png").c_str(),
|
||||
(ResourcePaths::getGuiPath().str() + "window/minus_hover.png").c_str());
|
||||
m_removeButton->setIconSize(QSize(16, 16));
|
||||
m_removeButton->setObjectName("minusButton");
|
||||
m_removeButton->setToolTip("remove line");
|
||||
innerLayout->addWidget(m_removeButton);
|
||||
@@ -148,6 +151,7 @@ QtDirectoryListBox::QtDirectoryListBox(QWidget *parent, const QString& listName,
|
||||
QPushButton* editButton = new QtIconButton(
|
||||
(ResourcePaths::getGuiPath().str() + "code_view/images/edit.png").c_str(),
|
||||
QString());
|
||||
editButton->setIconSize(QSize(16, 16));
|
||||
editButton->setObjectName("editButton");
|
||||
editButton->setToolTip("edit plain text");
|
||||
innerLayout->addWidget(editButton);
|
||||
|
||||
@@ -17,6 +17,7 @@ QtHelpButton::QtHelpButton(const QString& helpTitle, const QString& helpText, QW
|
||||
setMouseTracking(true);
|
||||
|
||||
setToolTip("help");
|
||||
setIconSize(QSize(16, 16));
|
||||
|
||||
leaveEvent(nullptr);
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ QtLocationPicker::QtLocationPicker(QWidget *parent)
|
||||
m_button = new QtIconButton(
|
||||
(ResourcePaths::getGuiPath().str() + "window/dots.png").c_str(),
|
||||
(ResourcePaths::getGuiPath().str() + "window/dots_hover.png").c_str());
|
||||
m_button->setIconSize(QSize(16, 16));
|
||||
m_button->setObjectName("dotsButton");
|
||||
m_button->setToolTip("pick file");
|
||||
connect(m_button, &QPushButton::clicked, this, &QtLocationPicker::handleButtonPress);
|
||||
|
||||
@@ -49,4 +49,8 @@ void QtRefreshBar::refreshStyle()
|
||||
ResourcePaths::getGuiPath().str() + "refresh_view/images/refresh.png",
|
||||
"search/button"
|
||||
));
|
||||
|
||||
int iconSize = int(height / 4) * 2 + 2;
|
||||
|
||||
m_refreshButton->setIconSize(QSize(iconSize, iconSize));
|
||||
}
|
||||
|
||||
@@ -111,6 +111,11 @@ void QtSearchBar::refreshStyle()
|
||||
"search/button"
|
||||
));
|
||||
|
||||
int iconSize = int((m_searchBox->height() + 5) / 4) * 2 + 2;
|
||||
|
||||
m_searchButton->setIconSize(QSize(iconSize, iconSize));
|
||||
m_homeButton->setIconSize(QSize(iconSize, iconSize));
|
||||
|
||||
m_searchBox->refreshStyle();
|
||||
}
|
||||
|
||||
|
||||
@@ -148,4 +148,10 @@ void QtUndoRedo::refreshStyle()
|
||||
ResourcePaths::getGuiPath().str() + "undoredo_view/images/history.png",
|
||||
"search/button"
|
||||
));
|
||||
|
||||
int iconSize = int(height / 4) * 2 + 2;
|
||||
|
||||
m_undoButton->setIconSize(QSize(iconSize, iconSize));
|
||||
m_redoButton->setIconSize(QSize(iconSize, iconSize));
|
||||
m_historyButton->setIconSize(QSize(iconSize, iconSize));
|
||||
}
|
||||
|
||||
@@ -269,4 +269,9 @@ void QtBookmarkView::refreshStyle()
|
||||
ResourcePaths::getGuiPath().str() + "bookmark_view/images/bookmark_list_icon.png",
|
||||
"search/button"
|
||||
));
|
||||
|
||||
int iconSize = int(height / 4) * 2 + 2;
|
||||
|
||||
m_createBookmarkButton->setIconSize(QSize(iconSize, iconSize));
|
||||
m_showBookmarksButton->setIconSize(QSize(iconSize, iconSize));
|
||||
}
|
||||
|
||||
@@ -178,6 +178,9 @@ void QtGraphView::refreshView()
|
||||
"search/button"
|
||||
));
|
||||
|
||||
m_expandButton->setIconSize(QSize(16, 16));
|
||||
m_collapseButton->setIconSize(QSize(16, 16));
|
||||
|
||||
updateTrailButtons();
|
||||
});
|
||||
}
|
||||
@@ -764,6 +767,9 @@ void QtGraphView::updateTrailButtons()
|
||||
ResourcePaths::getGuiPath().str() + "graph_view/images/" + forwardImagePath,
|
||||
"search/button"
|
||||
));
|
||||
|
||||
m_backwardTrailButton->setIconSize(QSize(16, 16));
|
||||
m_forwardTrailButton->setIconSize(QSize(16, 16));
|
||||
}
|
||||
|
||||
void QtGraphView::switchToNewGraphData()
|
||||
|
||||
Reference in New Issue
Block a user