depending on the OS use different heights

This commit is contained in:
Martin Marmsoler 2022-03-15 21:41:52 +01:00
parent 69e88672c7
commit d937efc70d
4 changed files with 15 additions and 10 deletions

View File

@ -64,6 +64,7 @@ endif()
find_package(Qt5 5.12 COMPONENTS ${QT_MODULES} LinguistTools REQUIRED)
if (FLATPAK)
find_package(Qt5 5.15 COMPONENTS XcbQpa REQUIRED)
add_compile_definitions(FLATPAK)
endif()
set(QT_TRANSLATIONS_DIR "${Qt5_DIR}/../../../translations")

View File

@ -194,7 +194,14 @@ void TextEditor::applySettings()
// Initialize markers.
QColor background = palette().color(QPalette::Base);
int fontHeight = pointSize * textHeightFactorCheckBoxSize;
int fontHeight;
// On windows it looks ugly when using pointSize, but on
// linux with flatpak textHeight looks strange
#if defined(FLATPAK)
fontHeight = pointSize * textHeightFactorCheckBoxSize;
#else
fontHeight = textHeight(0);
#endif
setStatusDiff(mStatusDiff); // to apply margin width
mStagedIcon = stagedUnstagedIcon(
true, background, fontHeight);
@ -299,7 +306,12 @@ void TextEditor::setStatusDiff(bool statusDiff)
{
mStatusDiff = statusDiff;
if (mStatusDiff) {
setMarginWidthN(Staged, fontPointSize(0) * textHeightFactorCheckBoxSize);
#if defined(FLATPAK)
setMarginWidthN(Staged, fontPointSize(0) * textHeightFactorCheckBoxSize);
#else
setMarginWidthN(Staged, textHeight(0));
#endif
setMarginSensitiveN(Staged, true); // to change by mouseclick staged/unstaged
} else {
setMarginWidthN(Staged, 0);

View File

@ -6,10 +6,6 @@ add_library(tools
ShowTool.cpp
)
if (FLATPAK)
target_compile_definitions(tools PRIVATE FLATPAK)
endif()
target_link_libraries(tools
conf
git

View File

@ -60,10 +60,6 @@ add_library(ui
target_compile_definitions(ui PRIVATE BUILD_DESCRIPTION="${BUILD_DESCRIPTION}")
if (FLATPAK)
target_compile_definitions(ui PRIVATE FLATPAK)
endif()
target_include_directories(ui PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
)