Giter Site home page Giter Site logo

Metrics are wrong on Linux about qtplugin HOT 5 CLOSED

probonopd avatar probonopd commented on June 23, 2024
Metrics are wrong on Linux

from qtplugin.

Comments (5)

probonopd avatar probonopd commented on June 23, 2024

We need to do something in styleplugin/basestyle.cpp

m.topMargin = 2; // static_cast<int>(fontHeight * MenuItem_VerticalMarginsFontRatio);
m.bottomMargin = 2; // static_cast<int>(fontHeight * MenuItem_VerticalMarginsFontRatio);

This seems to fix the menu item height.
Although we might want to hardcode the menu item height to an exact number of pixels instead of calculating it based on the font size; especially if we hardcode the absolute pixel height of the MainWindow that contains the menu. However, keep in mind that for non-global menus different font sizes and hence different menu item heights may be desirable.

For the menu(bar) height we need to change:

    case CT_MenuBarItem: {
        return QSize(size.width() + 10, 22);
    }

This hardcodes the height to 22px. Note that this value should always be kept the same as the height of the MainWindow of the Menu application. Can we make the MainWindow of the Menu application find out the height of the CT_MenuBarItem and just use that?

Text is still not centered.

from qtplugin.

probonopd avatar probonopd commented on June 23, 2024

Addressing this in 8db9bf2 and in helloSystem/Menu@6619aed

from qtplugin.

probonopd avatar probonopd commented on June 23, 2024

image

Defined by:

  1. QtPlugin CT_MenuBarItem (in helloSystem, we want 22px)
  2. QtPlugin
  3. QtPlugin CT_MenuBarItem (in helloSystem, we want 22px/2)
  4. QtPlugin MenuBar_ItemSpacing (in helloSystem, we want close to 0px)
  5. QtPlugin MenuItemMetrics totalHeight (in helloSystem, we want this depending on the font size; for the main menu we want 22px)
  6. Menu MainWindow height

from qtplugin.

probonopd avatar probonopd commented on June 23, 2024

Turns out we get different rendering of text in Debian vs. FreeBSD; the reason for this is not clear yet. Using an ugly ifdef for now: 02361ce

from qtplugin.

probonopd avatar probonopd commented on June 23, 2024

Also noteworthy: The Nimbus Sans in Debian/Ubuntu (fonts-urw-base35) behaves very differently than the Nimbus Sans from https://github.com/ArtifexSoftware/urw-base35-fonts/archive/20200910.zip. When using the latter in both places, I get consistent results. Hence closing.

from qtplugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.