Browse Source

QR code changes

onryo
fekt 1 year ago
parent
commit
370cb7623b
  1. 2
      application.qrc
  2. 46
      src/mainwindow.ui
  3. 6
      src/qrcodelabel.cpp

2
application.qrc

@ -45,7 +45,6 @@
<file>res/money-mouth.png</file>
<file>res/money-outgoing.png</file>
<file>res/hush-money-white.png</file>
</qresource>
<qresource prefix="/img">
<file>res/hushdlogo.png</file>
@ -56,6 +55,7 @@
<file>res/silentdragonlite-animated-startup-dark.gif</file>
<file>res/loaderblack.gif</file>
<file>res/loaderwhite.gif</file>
<file>res/logobig.gif</file>
</qresource>
<qresource prefix="/emoji">
<file>res/emoji/emoji1.png</file>

46
src/mainwindow.ui

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1308</width>
<height>779</height>
<width>1379</width>
<height>781</height>
</rect>
</property>
<property name="palette">
@ -93,7 +93,6 @@
<widget class="QLabel" name="contactNameMemo">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -711,7 +710,6 @@
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -724,7 +722,6 @@
<widget class="QLabel" name="balTotal">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -883,7 +880,6 @@
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -956,8 +952,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1268</width>
<height>519</height>
<width>1301</width>
<height>493</height>
</rect>
</property>
<layout class="QVBoxLayout" name="sendToLayout">
@ -1311,6 +1307,9 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<property name="topMargin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
@ -1427,16 +1426,37 @@
</item>
</layout>
</item>
<item>
<item alignment="Qt::AlignTop">
<widget class="QRCodeLabel" name="qrcodeDisplay">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>228</width>
<height>228</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: #fff</string>
<string notr="true"/>
</property>
<property name="text">
<string/>
@ -1909,8 +1929,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1308</width>
<height>30</height>
<width>1379</width>
<height>24</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">

6
src/qrcodelabel.cpp

@ -26,7 +26,7 @@ QPixmap QRCodeLabel::scaledPixmap() const {
pm.fill(Qt::white);
QPainter painter(&pm);
qrcodegen::QrCode qr = qrcodegen::QrCode::encodeText(str.toUtf8().constData(), qrcodegen::QrCode::Ecc::LOW);
qrcodegen::QrCode qr = qrcodegen::QrCode::encodeText(str.toUtf8().constData(), qrcodegen::QrCode::Ecc::HIGH);
const int s = qr.getSize()>0?qr.getSize():1;
const double w = pm.width();
const double h = pm.height();
@ -50,6 +50,10 @@ QPixmap QRCodeLabel::scaledPixmap() const {
}
}
// TODO: Maybe add logo if it doesn't break QR code - requires setting Ecc to HIGH
painter.drawPixmap((w/2)-50, (h/2)-50, 100, 100, QPixmap(":/img/logobig.gif"));
painter.end();
return pm;
}

Loading…
Cancel
Save