Skip to content

Conversation

ltoenning
Copy link
Contributor

This removes the --scale command line option.
Qt6 seems to have this already integrated to scale according to the native display settings: https://doc.qt.io/qt-6.8/highdpi.html
Adjusting the scale on a per-application basis is not intended (anymore) according to the documentation. Tested on a (near) high-dpi screen.

@ltoenning ltoenning requested a review from Copilot July 20, 2025 21:50
@ltoenning ltoenning self-assigned this Jul 20, 2025
Copilot

This comment was marked as outdated.

@ltoenning ltoenning force-pushed the high_dpi_scaling branch 2 times, most recently from 932a006 to 0c77b87 Compare July 21, 2025 19:49
This removes the --scale command line option.
Qt6 seems to have this already integrated to scale according to the
nativ display settings: https://doc.qt.io/qt-6.8/highdpi.html
Adjusting the scale on a per-application basis is not intended (anymore)
according to the documentation.
Tested on a (near) high-dpi screen.
@ltoenning ltoenning requested a review from Copilot September 1, 2025 20:45
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes high DPI scaling functionality from the codebase, as Qt6 now handles high DPI scaling automatically according to native display settings. The PR eliminates the manual --scale command line option and related scaling components that are no longer needed.

Key changes:

  • Removed scale screen factor component and related UI elements
  • Eliminated high DPI scaling methods and command line options
  • Updated Qt API usage to align with Qt6 standards (deprecated method replacements)

Reviewed Changes

Copilot reviewed 61 out of 61 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/gui/components/scalescreenfactor.* Completely removed scale screen factor component files
src/swiftlauncher/swiftlauncher.* Removed scale factor UI component and related functionality
src/gui/guiapplication.* Removed high DPI scaling methods and command line options
src/misc/variant.* Updated Qt API calls to use Qt6-compatible methods
samples/*/main.cpp Removed high DPI scaling initialization calls
Multiple test files Updated deprecated Qt datetime methods to use QTimeZone::utc()

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@@ -521,24 +522,23 @@ namespace swift::misc
}
}

QVariant fixQVariantFromDbusArgument(const QVariant &variant, int localUserType, const QString &typeName)
QVariant fixQVariantFromDbusArgument(const QVariant &variant, QMetaType localUserType, const QString &typeName)
Copy link
Preview

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The function signature has changed to accept QMetaType instead of int, but the function is still being called with QMetaType::fromName(...) at line 415. Consider updating the function name to reflect that it now works with QMetaType objects rather than type IDs.

Suggested change
QVariant fixQVariantFromDbusArgument(const QVariant &variant, QMetaType localUserType, const QString &typeName)
QVariant fixQVariantFromDbusArgumentMetaType(const QVariant &variant, QMetaType localUserType, const QString &typeName)

Copilot uses AI. Check for mistakes.

Comment on lines +826 to 841
if (value.userType() != element.m_metaType)
{
return CStatusMessage(this).error(u"Expected %1 but got %2 for %3")
<< QMetaType::typeName(element.m_metaType) << value.typeName() << element.m_nameWithKey;
<< QMetaType(element.m_metaType).name() << value.typeName() << element.m_nameWithKey;
}
else if (element.m_validator && !element.m_validator(value, reason))
if (element.m_validator && !element.m_validator(value, reason))
{
if (reason.isEmpty())
{
return CStatusMessage(this).error(u"%1 is not valid for %2")
<< value.toQString() << element.m_nameWithKey;
}
else
{
return CStatusMessage(this).error(u"%1 (%2 for %3)")
<< reason << value.toQString() << element.m_nameWithKey;
}
return CStatusMessage(this).error(u"%1 (%2 for %3)")
<< reason << value.toQString() << element.m_nameWithKey;
}
else { return {}; }
Copy link
Preview

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if-else chain has been restructured, but the final 'else' clause is missing. The code should include an explicit 'else' statement before the final return statement for clarity, or restructure to avoid the dangling return.

Copilot uses AI. Check for mistakes.

Comment on lines +136 to 137
q = QColor::fromString("#" + c);
this->setQColor(q);
Copy link
Preview

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] QColor::fromString() returns a QColor object by value, but the code assigns it to an existing QColor variable 'q'. This creates an unnecessary assignment. Consider using the return value directly in setQColor() call: 'this->setQColor(QColor::fromString("#" + c));'

Suggested change
q = QColor::fromString("#" + c);
this->setQColor(q);
this->setQColor(QColor::fromString("#" + c));

Copilot uses AI. Check for mistakes.

@@ -251,7 +251,7 @@ namespace swift::gui::components
void CNavigatorDialog::enterEvent(QEnterEvent *event)
{
// event called when mouse is over, acts as auto-focus
QApplication::setActiveWindow(this);
activateWindow();
Copy link
Preview

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The replacement of QApplication::setActiveWindow(this) with activateWindow() changes the behavior. QApplication::setActiveWindow() sets the active window globally, while activateWindow() only requests activation. This may not provide the same functionality as the original code.

Copilot uses AI. Check for mistakes.

Comment on lines +667 to +670
contextMenu->addAction("Max.data area", QKeySequence(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_M, Qt::Key_D),
this, &CDbMappingComponent::resizeForSelect);
contextMenu->addAction("Max.mapping area", QKeySequence(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_M, Qt::Key_M),
this, &CDbMappingComponent::resizeForMapping);
Copy link
Preview

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter order for QMenu::addAction() has been changed. The new order places the QKeySequence before the receiver and method. Verify this matches the Qt6 API signature for addAction(), as incorrect parameter order could cause compilation errors or runtime issues.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant