Skip to content

Commit

Permalink
Fix placeholder text margins (open-eid#1093)
Browse files Browse the repository at this point in the history
IB-7450

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma authored Jul 14, 2022
1 parent 3365785 commit 0b158fc
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
MACOSX_DEPLOYMENT_TARGET: 10.14
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive
- name: Download artifact
Expand All @@ -25,7 +25,7 @@ jobs:
- name: Install dependencies
run: |
HASH=($(shasum prepare_osx_build_environment.sh))
curl -O -L -s https://installer.id.ee/media/github/opensc_0.20.0.2.pkg
curl -O -L -s https://installer.id.ee/media/github/opensc_0.22.0.pkg
curl -O -L -s https://installer.id.ee/media/github/${HASH}.zip
sudo installer -verboseR -pkg libdigidocpp-pkg/libdigidocpp*.pkg -target /
sudo installer -verboseR -pkg opensc_*.pkg -target /
Expand All @@ -40,7 +40,7 @@ jobs:
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -B build -S .
cmake --build build --target zipdebug macdeployqt zip
- name: Archive artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: pkgs
path: build/qdigidoc4*.zip
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
- name: Lintian
run: lintian *.deb;
- name: Archive artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: debs
path: qdigidoc4*.*
Expand All @@ -96,7 +96,7 @@ jobs:
container: ${{ matrix.container }}
strategy:
matrix:
container: ['fedora:34']
container: ['fedora:35']
env:
MAKEFLAGS: -j3
steps:
Expand All @@ -121,7 +121,7 @@ jobs:
cmake -DCMAKE_INSTALL_PREFIX=/usr -B build -S .
cmake --build build --target all package
- name: Archive artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: rpms
path: build/qdigidoc4*.rpm
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
toolset: 14.29
- vcver: 142
arch: x64
qtver: 6.3.0
qtver: 6.3.1
qtmodules: qt5compat
qt: win64_msvc2019_64
image: windows-2019
Expand All @@ -162,7 +162,7 @@ jobs:
VER_SUFFIX: .VS${{ matrix.vcver }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive
- name: Download artifact
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:
cmake --build build --target msi
cmake --build build --target appx
- name: Archive artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: msi
path: |
Expand All @@ -221,7 +221,7 @@ jobs:
PROJECTNAME: open-eid/DigiDoc4-Client
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
Expand Down
11 changes: 5 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ set_env( SMARTID_URL "https://dd-sid.ria.ee/v1" CACHE STRING "URL for Smart-ID"
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION YES)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_DEBUG NO)
set(CPACK_PACKAGE_VERSION ${VERSION})
set(CPACK_GENERATOR "RPM")
set(CPACK_PACKAGE_NAME "qdigidoc4")
set(CPACK_PACKAGE_RELEASE 1)
set(CPACK_GENERATOR RPM)
set(CPACK_PACKAGE_CONTACT "RIA <[email protected]>")
set(CPACK_PACKAGE_VENDOR "RIA")
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_PACKAGE_VENDOR RIA)
set(CPACK_PACKAGING_INSTALL_PREFIX /usr)
set(CPACK_RPM_FILE_NAME RPM-DEFAULT)
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
include(CPack)
if(APPLE)
add_subdirectory(extensions/DigiDocQL)
Expand Down
6 changes: 6 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
DigiDoc4 version [4.2.12](https://github.com/open-eid/DigiDoc4-Client/releases/tag/v4.2.12) release notes
--------------------------------------
- Code, Text and translation improvements and updates

[Full Changelog](https://github.com/open-eid/DigiDoc4-Client/compare/v4.2.11...v4.2.12)

DigiDoc4 version [4.2.11](https://github.com/open-eid/DigiDoc4-Client/releases/tag/v4.2.11) release notes
--------------------------------------
- Code, Text and translation improvements and updates
Expand Down
12 changes: 10 additions & 2 deletions client/widgets/LineEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "LineEdit.h"

#include <QtGui/QPainter>
#include <QtWidgets/QStyleOptionButton>

LineEdit::LineEdit(QWidget *parent)
: QLineEdit(parent)
Expand All @@ -34,17 +35,24 @@ void LineEdit::paintEvent(QPaintEvent *event)
if(!placeholderText().isEmpty())
{
placeholder = placeholderText();
setPlaceholderText(QString());
setPlaceholderText({});
}
QLineEdit::paintEvent(event);

QStyleOptionFrame opt;
initStyleOption(&opt);
QPainter p(this);
#ifdef Q_OS_WIN
QRect lineRect = style()->subElementRect(QStyle::SE_LineEditContents, &opt, this);
#else
QRect lineRect = rect();
#endif
p.setClipRect(lineRect);
QColor color = palette().color(QPalette::PlaceholderText);
color.setAlpha(63);
p.setPen(color);
QFontMetrics fm = fontMetrics();
int minLB = qMax(0, -fm.minLeftBearing());
QRect lineRect = this->rect();
QRect ph = lineRect.adjusted(minLB + 3, 0, 0, 0);
QString elidedText = fm.elidedText(placeholder, Qt::ElideRight, ph.width());
p.drawText(ph, Qt::AlignVCenter, elidedText);
Expand Down

0 comments on commit 0b158fc

Please sign in to comment.