-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2209 font sizes too small #2222
2209 font sizes too small #2222
Conversation
Removes one of the several calls to pointSizeF. This method seems to return a font which has the same height in pixels on all displays (regardless of the display's actual DPI value). In the long run these calls will all have to be removed to make LMMS usable on high DPI displays.
ControllerRackView now uses a layout to organize the ControllerViews. The ControllerViews in turn use layouts to organize their widgets (labels and push button). ControllerView now inherits from QFrame instead of QWidget. The (static) background image for controllers was deleted because the ControllerView can now be resized dynamically. Song: Added specific signals for added and removed controllers. Also removed a TODO by putting the functionality to remove all controllers in a method (removeAllControllers). Deleted Controllers now don't unregister from Song during deletion. This has to be done by the client (Hollywood principle - "Don't call us, we call you."). TODO: For some strange reason I cannot programmatically resize the controller rack to make it fit the controllers on my screen.
The PluginDescWidget doesn't use calls to pointSize anymore. Also the name of the plugin is only painted bold when hovered over with the mouse. The animation speed was increased a bit as well. Hope it is not too fast for displays with smaller resolutions. The problem with the current implementation is that it increases the height by incremental steps of 1 pixel (triggered by a QTimer) which gives a slower speed on high DPI displays. In the future this implementation might be improved, e.g. by using the animation classes provided by Qt. The SideBarWidget also does not use calls to pointSize anymore. Instead the standard font is increased by 2 (typographical) points and then rendered at the right place using information from QFontMetrics. In the long run the header of the SideBarWidget should be organized using a layout, e.g. a layout with one QLabel to render the icon and one QLabel to render the header text. This would ensure that the black background would always be large enough and that the fonts do not protude into the actual content.
Fixed the rendering of the tact numbers in the timeline widget. Before this fix they were not readable because they were too big. Interestingly in this case the fix is to use a font size in pixels (half the height of the widget). The numbers are now also rendered a bit darker than the lines. Also removed the pixmap for the timeline from the code and from the filesystem. It was only used to determine the fixed height of the widget but not rendered. Therefore it was removed and the height is now directly set to 18 pixels which was the height of the pixmap.
setWindowIcon( embed::getIconPixmap( "controller" ) ); | ||
setWindowTitle( tr( "Controller Rack" ) ); | ||
|
||
m_scrollArea = new QScrollArea( this ); | ||
m_scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); | ||
m_scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I agree with this.
Previously, it was impossible to resize the controller rack small enough to where it had a horizontal scrollbar. Now it is possible. I prefer the old behavior, mainly because now when I open an empty controller rack & add a new controller, the window will not be large enough to fit all of it.
I'm don't know if this is a result of removing the setHorizontalScrollBarPolicy or setMinimumWidth calls. FWIW I do agree with you making the vertical scrollbar behavior automatic.
Other than that one comment I Ieft, this looks great & works fine on my system. Those fonts used to be hard to read even on my low-dpi 1366x768 monitor. |
@michaelgregorius can you address my line comment above? I would like to merge this, but that comment needs to be discussed first. |
Removes the potential horizontal scrollbar from the controller rack view. Also sets the MDI window of the controller rack to a bigger size in the constructor and moves it towards the other windows. This code is active in the case where there is no default template from which the window states are loaded.
@Wallacoloo: I have removed the horizontal scrollbar as proposed. I have also changed the default size of the controller rack to a sensible size in case there is no default template and moved the controller rack window more towards the other windows. To see the results of these changes you will have to delete or temporarily rename the file |
@michaelgregorius that's exactly what I had in mind. Thanks. One minor issue - whereas all the other windows seem to have some minimum allowable height (see photo below), I can actually shrink the ControllerRack vertically to where even the window decoration is no longer visible, and thus the window can never be moved, resized, or really even used ever again: So some minimum vertical height may also be required. |
@Wallacoloo On which platform? I'm using Ubuntu and I cannot reduce the controller window height more than its default size although it does not resize well horizontally. Only the frame is resized but not its contents. |
@Wallacoloo Unfortunately I cannot reproduce this in my version as well. Are there any specific steps that you took? Or is it possible that this is somehow related to the window manager being used? Although I would assume that all the window management for the MDI windows is handled by Qt and should therefore be independent. |
Yes, should be. 😺 |
Ah, sorry. Looks like I forgot to recompile after switching from a different branch... T_T This error doesn't occur on your branch. Anyway, on your branch, the minimum width isn't maintained - I can resize the ControllerRack to look like this, which isn't all that useful: What I had in mind was restricting the minimal width of the window such that the contents could always be viewed without needing to scroll horizontally. This patch to your code seems to do that: diff --git a/src/gui/widgets/ControllerRackView.cpp b/src/gui/widgets/ControllerRackView.cpp
index 2bf7054..0ce1cdd 100644
--- a/src/gui/widgets/ControllerRackView.cpp
+++ b/src/gui/widgets/ControllerRackView.cpp
@@ -88,6 +88,7 @@ ControllerRackView::ControllerRackView( ) :
subWin->setAttribute( Qt::WA_DeleteOnClose, false );
subWin->move( 680, 310 );
subWin->resize(400, 200);
+ subWin->setMinimumWidth( 300 );
} and then I can no longer shrink it further than this: Unfortunately, adding that patch in re-introduces the above error where I could resize it vertically to no minimum, so instead it should maybe be @midi-pascal I am also on Ubuntu. |
@Wallacoloo That's also what I tried to do. I tried to compute the minimum widget of the That's why I decided to give the controller rack a bigger default width (which unfortunately only work if there is no default template with a small width) as a first solution. Perhaps someone else can find a more elegant solution but I have to admit that I am not that knowledgeable concerning the Qt layout rules. |
You could use:
|
Thanks for sharing your solution @midi-pascal, but it does appear to be fairly limited. And as @michaelgregorius points out, there is no constant width for which we can guarantee all controllers will fit into, because of the variable length of their names. So a dynamically-resizing window is pretty much the only thing that would prevent the horizontal scrollbar from ever appearing, and I'm not entirely in favor of that. Given that there is no ideal solution to this, I'm happy to merge as-is. Is everyone OK with merging? |
👍 |
The "Controls" button will now keep its minimal size when the ControllerView is resized.
@tres Thanks for the link! I think most of the widgets in the I assume that the problem with dynamic widget sizes will keep cropping up in other places as well once more and more code is switched away from using fixed sizes. I guess I will need to play around more with Qt's layout system and experiment with custom widgets to get a feeling of how all that stuff works together. But for now I'd also vote to commit what we have so far. I know that the current state is not optimal but on the other hand it's not that it is unusable. Merging #2273 might also alleviate the problem a bit because it will make saving and using (default) templates simpler. Once this is done the user can enlarge the controller rack to a reasonable size and then store this as the default template. |
And we merge. I tested @michaelgregorius 's latest commit, and it's still working fine. |
New pull request for #2209 because I have rebased my branch which does not seem to be a good idea when it was already pushed to origin.
Fixes the font size in the file browsers and enables dynamic rendering of controllers.