PerScreenDpi | QLabels incorrectly handle scale for icons (#4070)
* Fixes to icon generation. Generating a pixmap out of a size won't take the screen scaling factor into account, resulting in blurry results. Note that this is not a catchall solution, every case needs to be addressed manually. Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com> * HighDpi fixes for startup splashscreen and About dialog Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com> * Add helper function to generate appropriate pixmaps for a screen based on its dpi settings. Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>
This commit is contained in:
+2
-2
@@ -47,9 +47,9 @@ namespace AzToolsFramework
|
||||
return QString();
|
||||
}
|
||||
|
||||
QPixmap EditorEntityUiHandlerBase::GenerateItemIcon(AZ::EntityId /*entityId*/) const
|
||||
QIcon EditorEntityUiHandlerBase::GenerateItemIcon(AZ::EntityId /*entityId*/) const
|
||||
{
|
||||
return QPixmap();
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
bool EditorEntityUiHandlerBase::CanToggleLockVisibility(AZ::EntityId /*entityId*/) const
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ namespace AzToolsFramework
|
||||
//! Returns the item tooltip text to display in the Outliner.
|
||||
virtual QString GenerateItemTooltip(AZ::EntityId entityId) const;
|
||||
//! Returns the item icon pixmap to display in the Outliner.
|
||||
virtual QPixmap GenerateItemIcon(AZ::EntityId entityId) const;
|
||||
virtual QIcon GenerateItemIcon(AZ::EntityId entityId) const;
|
||||
//! Returns whether the element's lock and visibility state should be accessible in the Outliner
|
||||
virtual bool CanToggleLockVisibility(AZ::EntityId entityId) const;
|
||||
//! Returns whether the element's name should be editable
|
||||
|
||||
@@ -66,9 +66,9 @@ namespace AzToolsFramework
|
||||
return result;
|
||||
}
|
||||
|
||||
QPixmap LayerUiHandler::GenerateItemIcon(AZ::EntityId /*entityId*/) const
|
||||
QIcon LayerUiHandler::GenerateItemIcon(AZ::EntityId /*entityId*/) const
|
||||
{
|
||||
return QPixmap(m_layerIconPath);
|
||||
return QIcon(m_layerIconPath);
|
||||
}
|
||||
|
||||
void LayerUiHandler::PaintItemBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace AzToolsFramework
|
||||
|
||||
// EditorEntityUiHandler...
|
||||
QString GenerateItemInfoString(AZ::EntityId entityId) const override;
|
||||
QPixmap GenerateItemIcon(AZ::EntityId entityId) const override;
|
||||
QIcon GenerateItemIcon(AZ::EntityId entityId) const override;
|
||||
void PaintItemBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
||||
void PaintDescendantBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index,
|
||||
const QModelIndex& descendantIndex) const override;
|
||||
|
||||
+7
-7
@@ -280,17 +280,17 @@ namespace AzToolsFramework
|
||||
QVariant EntityOutlinerListModel::GetEntityIcon(const AZ::EntityId& id) const
|
||||
{
|
||||
auto entityUiHandler = m_editorEntityFrameworkInterface->GetHandler(id);
|
||||
QPixmap pixmap;
|
||||
QIcon icon;
|
||||
|
||||
// Retrieve the icon from the handler
|
||||
if (entityUiHandler != nullptr)
|
||||
{
|
||||
pixmap = entityUiHandler->GenerateItemIcon(id);
|
||||
icon = entityUiHandler->GenerateItemIcon(id);
|
||||
}
|
||||
|
||||
if (!pixmap.isNull())
|
||||
if (!icon.isNull())
|
||||
{
|
||||
return QIcon(pixmap);
|
||||
return icon;
|
||||
}
|
||||
|
||||
// If no icon was returned by the handler, use the default one.
|
||||
@@ -299,7 +299,7 @@ namespace AzToolsFramework
|
||||
|
||||
if (isEditorOnly)
|
||||
{
|
||||
return QIcon(QPixmap(QString(":/Icons/Entity_Editor_Only.svg")));
|
||||
return QIcon(QString(":/Icons/Entity_Editor_Only.svg"));
|
||||
}
|
||||
|
||||
AZ::Entity* entity = nullptr;
|
||||
@@ -308,10 +308,10 @@ namespace AzToolsFramework
|
||||
|
||||
if (!isInitiallyActive)
|
||||
{
|
||||
return QIcon(QPixmap(QString(":/Icons/Entity_Not_Active.svg")));
|
||||
return QIcon(QString(":/Icons/Entity_Not_Active.svg"));
|
||||
}
|
||||
|
||||
return QIcon(QPixmap(QString(":/Icons/Entity.svg")));
|
||||
return QIcon(QString(":/Icons/Entity.svg"));
|
||||
}
|
||||
|
||||
QVariant EntityOutlinerListModel::GetEntityTooltip(const AZ::EntityId& id) const
|
||||
|
||||
@@ -41,9 +41,9 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
QPixmap LevelRootUiHandler::GenerateItemIcon(AZ::EntityId /*entityId*/) const
|
||||
QIcon LevelRootUiHandler::GenerateItemIcon(AZ::EntityId /*entityId*/) const
|
||||
{
|
||||
return QPixmap(m_levelRootIconPath);
|
||||
return QIcon(m_levelRootIconPath);
|
||||
}
|
||||
|
||||
QString LevelRootUiHandler::GenerateItemInfoString(AZ::EntityId entityId) const
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace AzToolsFramework
|
||||
~LevelRootUiHandler() override = default;
|
||||
|
||||
// EditorEntityUiHandler...
|
||||
QPixmap GenerateItemIcon(AZ::EntityId entityId) const override;
|
||||
QIcon GenerateItemIcon(AZ::EntityId entityId) const override;
|
||||
QString GenerateItemInfoString(AZ::EntityId entityId) const override;
|
||||
bool CanToggleLockVisibility(AZ::EntityId entityId) const override;
|
||||
bool CanRename(AZ::EntityId entityId) const override;
|
||||
|
||||
@@ -81,14 +81,14 @@ namespace AzToolsFramework
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
QPixmap PrefabUiHandler::GenerateItemIcon(AZ::EntityId entityId) const
|
||||
QIcon PrefabUiHandler::GenerateItemIcon(AZ::EntityId entityId) const
|
||||
{
|
||||
if (m_prefabEditInterface->IsOwningPrefabBeingEdited(entityId))
|
||||
{
|
||||
return QPixmap(m_prefabEditIconPath);
|
||||
return QIcon(m_prefabEditIconPath);
|
||||
}
|
||||
|
||||
return QPixmap(m_prefabIconPath);
|
||||
return QIcon(m_prefabIconPath);
|
||||
}
|
||||
|
||||
void PrefabUiHandler::PaintItemBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace AzToolsFramework
|
||||
// EditorEntityUiHandler...
|
||||
QString GenerateItemInfoString(AZ::EntityId entityId) const override;
|
||||
QString GenerateItemTooltip(AZ::EntityId entityId) const override;
|
||||
QPixmap GenerateItemIcon(AZ::EntityId entityId) const override;
|
||||
QIcon GenerateItemIcon(AZ::EntityId entityId) const override;
|
||||
void PaintItemBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
||||
void PaintDescendantBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index,
|
||||
const QModelIndex& descendantIndex) const override;
|
||||
|
||||
Reference in New Issue
Block a user