Skip to content
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

Huge Icons in OS X #550

Closed
fny opened this issue Feb 4, 2016 · 8 comments
Closed

Huge Icons in OS X #550

fny opened this issue Feb 4, 2016 · 8 comments
Labels

Comments

@fny
Copy link

fny commented Feb 4, 2016

After an upgrade to v2.4, all the icons are huge. I'm running OS X 10.11.2 with Qt v4.8.7.

screen shot 2016-02-04 at 10 01 04 am

@Vdragon Vdragon added the bug label Feb 8, 2016
@davvid
Copy link
Member

davvid commented Feb 10, 2016

Thanks for the heads-up. I want to see if there's something we can do about this. I think this is mainly defaulted by the OS, as we do not set explicit sizes, but previously we were "getting lucky" by using PNGs that have an implicit size.

We now use SVGs which automatically scale up, but perhaps in an unfortunate way. We don't seem to see this issue on Linux, tho.

Using stylesheets it's supposedly possible to set the icon sizes, but I haven't dug too deep into that. I would also need an OSX laptop (I let my friend borrow my retina laptop) since I'm full-time on my debian/sid laptop these days so it might be a bit before I get a chance to poke at this.

I do have a non-retina mac laptop around.. do you know if this is reproducible on non-retina OSX?

@fny
Copy link
Author

fny commented Feb 10, 2016

No idea about non-retina, but I could check. If you point me to where the modifications would have to be made, I'd be more than happy to poke around myself. 😄

davvid added a commit that referenced this issue Feb 11, 2016
Later we can adjust create_menu() to apply styling, which can help get
us towards solving #550.

Signed-off-by: David Aguilar <davvid@gmail.com>
@davvid
Copy link
Member

davvid commented Feb 11, 2016

The place to apply styling would be in cola/qtutils.py in def create_menu. I pushed some stuff up that makes that the single place to tweak as far as menu styling goes.

Something like this diff applied against the latest in master:

diff --git a/cola/qtutils.py b/cola/qtutils.py
index 5de7f7b..edc6a21 100644
--- a/cola/qtutils.py
+++ b/cola/qtutils.py
@@ -707,6 +707,17 @@ def create_dock(title, parent, stretch=True):
 def create_menu(title, parent):
     """Create a menu and set its title."""
     qmenu = QtGui.QMenu(title, parent)
+
+    style = """
+        QMenu {
+            icon-size: %(size)dpx;
+        }
+        QMenu::item {
+            icon-size: %(size)dpx;
+        }
+    """ % dict(size=defs.small_icon)
+
+    qmenu.setStyleSheet(style)
     return qmenu



but this does not seem to work, specifically on OS X it seems. It seems that the icon sizes cannot be customized there, as OS X sets the icon sizes itself:

https://forum.qt.io/topic/63483/qmenu-icon-size/3

I wonder if there's a way to have a 2nd svg file include the main icon, and apply some image scale to internally add some buffer. Or just have a 2nd version of the icons. If you can tweak things to look good there I'd be happy to work those changes in.

@davvid
Copy link
Member

davvid commented Feb 11, 2016

Also, the single place where icon paths are defined is in cola/icons.py. The icon files themselves are in share/git-cola/icons/. Let me know if you have any questions.

@fny
Copy link
Author

fny commented Feb 11, 2016

You can't really modify the SVGs or wrap them in another because they'll always expand to the size of the container Qt wants them to filll. The closest I've gotten is wrapping the SVG path with a transformation and changing the height while leaving the width fixed:

<svg height="512" width="768" xmlns="http://www.w3.org/2000/svg">
  <g transform="scale(0.5)">
    <path d="M768 320L256 832 0 576l96-96 160 160 416-416 96 96z" />
  </g>
</svg>

Thoughts/other approaches:

  • Maybe there's a way to do this with pixmaps? (I honestly don't know enough Qt.)
  • PNGs could be used for OS X instead
  • Qt 5 may have solved this already

Also this is a retina problem. Frescobaldi seemed to have the same issue before Qt fixed the bug.

@alexpusch
Copy link

Upgrading to 2.5 fixed the problem for me

@fny
Copy link
Author

fny commented May 16, 2016

You had me excited for a moment... I'm still having the same issue while running 2.6. 😞

@davvid
Copy link
Member

davvid commented Sep 29, 2016

Haven't heard from the OS X folks about Qt5, so I'm assuming that moving to Qt5 fixed it.

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

No branches or pull requests

4 participants