fix: scaling of display view#901
Conversation
- scaling shall be based on control view size instead of page size - scaling has to take into account the system scale factor - refactor: use center() function of QRect instead of own calculation
- complete area of control screen stays visible and usable - indicator of what is hidden on the display screen
|
According to the idea of @maehne in #846 I now indicate the visible area of the display screen on the control screen using a gray overlay. The area under the overlay can still be interacted with on the control screen. See here how it looks like: The four blue dots indicate the corners of the display screen. For the two forms it is clear on the control screen which part is visible and what is hidden on the display screen. |
|
@letsfindaway: I really like your suggested improvement! The different aspect ratios become increasingly a problem, because 16:10 and 3:2 screens have become more popular over the past years while video projectors typically use 16:9 aspect ratio. |
- DisplayManager::hasDisplay() wrongly returned true when mUseMultiScreen was false, but a second screen was available
- set system scale factor so that complete nominal page is visible on control screen - use the control view widget size instead of the screen size for calculation to account for the menu bar height
|
@letsfindaway Just found out that when moving the view, making any action centering the view (erase the board, or double cliking on the hand tool) make the grey borders not display correctly. Moving the hand again update the whole visible region correctly. |
Ok, I see. Looks as if the view is not properly updated in that case. I assume that this is a Qt problem. It does not happen for me with Qt6, but only with Qt5. I could mitigate the problem with this crude hack: void UBBoardController::centerOn(QPointF scenePoint)
{
QPointF offset{1, 1};
mControlView->centerOn(scenePoint - offset);
mControlView->translate(offset.x(), offset.y());
UBApplication::applicationController->adjustDisplayView();
}It seems that |
|
The idea of setting the scrollbar position instead of the center (see #1009 (comment)) also fixes this issue. So I will further work on that direction and store/restore the scrollbar position of the view instead of the center point of the scene. This solution is not a hack, but probably a better way to adjust the view position anyway. Edit: when further investigation the history of this code, I saw that it was introduced with commit 773dab5. Did you have a specific reason not to use the scrollbar positions, which were already present in the Because introducing the proposed fix would merely mean to replace the work of this commit and to reuse the scroll bar positions instead. Edit 2: some more tests answered my question: the scroll bar values are not updated when the view is moved. Instead a view transformation is used. So it is clear why the scrollbars cannot work. Next idea would be to save and update the view Transform and to test how the foreground behaves when the transform is changed. Edit 3: I don't get this working and still don't understand how |

This PR fixes the display view scaling issue reported in #887 as follows:
center()function ofQRectinstead of own calculationThe problem (and also the resolution using this PR) can be verified in a setup where control and display screen have different aspect ratios.