Skip to content

Commit

Permalink
Fixed #157 - After entering longer QTH, the field content is not left…
Browse files Browse the repository at this point in the history
…-aligned
  • Loading branch information
foldynl committed May 17, 2023
1 parent 08f9652 commit db2d1d9
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 65 deletions.
2 changes: 2 additions & 0 deletions QLog.pro
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ SOURCES += \
ui/DxFilterDialog.cpp \
ui/DxWidget.cpp \
ui/DxccTableWidget.cpp \
ui/EditLine.cpp \
ui/Eqsldialog.cpp \
ui/ExportDialog.cpp \
ui/ImportDialog.cpp \
Expand Down Expand Up @@ -215,6 +216,7 @@ HEADERS += \
ui/DxFilterDialog.h \
ui/DxWidget.h \
ui/DxccTableWidget.h \
ui/EditLine.h \
ui/Eqsldialog.h \
ui/ExportDialog.h \
ui/ImportDialog.h \
Expand Down
25 changes: 25 additions & 0 deletions ui/EditLine.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "EditLine.h"

NewContactEditLine::NewContactEditLine(QWidget *parent) :
QLineEdit(parent)
{

}

void NewContactEditLine::focusInEvent(QFocusEvent *event)
{
QLineEdit::focusInEvent(event);

// Deselect text when focus - maybe later
// if ( hasSelectedText() )
// {
// deselect();
// }

}

void NewContactEditLine::focusOutEvent(QFocusEvent *event)
{
QLineEdit::focusOutEvent(event);
home(false);
}
19 changes: 19 additions & 0 deletions ui/EditLine.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef EDITLINE_H
#define EDITLINE_H

#include <QObject>
#include <QLineEdit>

class NewContactEditLine : public QLineEdit
{
Q_OBJECT

public:
explicit NewContactEditLine(QWidget *parent = nullptr);

protected:
void focusInEvent(QFocusEvent* event) override;
void focusOutEvent(QFocusEvent* event) override;
};

#endif // EDITLINE_H
56 changes: 32 additions & 24 deletions ui/NewContactWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="callsignEdit">
<widget class="NewContactEditLine" name="callsignEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -153,7 +153,7 @@
</widget>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="rstRcvdEdit">
<widget class="NewContactEditLine" name="rstRcvdEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand All @@ -180,7 +180,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="rstSentEdit">
<widget class="NewContactEditLine" name="rstSentEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -431,7 +431,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="nameEdit">
<widget class="NewContactEditLine" name="nameEdit">
<property name="maximumSize">
<size>
<width>180</width>
Expand All @@ -444,7 +444,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="qthEdit">
<widget class="NewContactEditLine" name="qthEdit">
<property name="maximumSize">
<size>
<width>250</width>
Expand All @@ -470,7 +470,7 @@
</widget>
</item>
<item row="1" column="3">
<widget class="QLineEdit" name="commentEdit">
<widget class="NewContactEditLine" name="commentEdit">
<property name="maximumSize">
<size>
<width>16777215</width>
Expand All @@ -480,7 +480,7 @@
</widget>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="gridEdit">
<widget class="NewContactEditLine" name="gridEdit">
<property name="maximumSize">
<size>
<width>120</width>
Expand Down Expand Up @@ -1129,6 +1129,9 @@
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_6">
<attribute name="title">
<string>&amp;Details</string>
Expand Down Expand Up @@ -1213,7 +1216,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="ituEdit">
<widget class="NewContactEditLine" name="ituEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1242,7 +1245,7 @@
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="cqEdit">
<widget class="NewContactEditLine" name="cqEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1271,7 +1274,7 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="stateEdit">
<widget class="NewContactEditLine" name="stateEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand All @@ -1297,7 +1300,7 @@
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="countyEdit">
<widget class="NewContactEditLine" name="countyEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand All @@ -1323,7 +1326,7 @@
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="ageEdit">
<widget class="NewContactEditLine" name="ageEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand All @@ -1349,7 +1352,7 @@
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="vuccEdit">
<widget class="NewContactEditLine" name="vuccEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1385,7 +1388,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="dokEdit">
<widget class="NewContactEditLine" name="dokEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1414,7 +1417,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="iotaEdit">
<widget class="NewContactEditLine" name="iotaEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand All @@ -1440,7 +1443,7 @@
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="potaEdit">
<widget class="NewContactEditLine" name="potaEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand All @@ -1466,7 +1469,7 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="sotaEdit">
<widget class="NewContactEditLine" name="sotaEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand All @@ -1492,7 +1495,7 @@
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="wwffEdit">
<widget class="NewContactEditLine" name="wwffEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1521,7 +1524,7 @@
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="sigEdit">
<widget class="NewContactEditLine" name="sigEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand All @@ -1547,7 +1550,7 @@
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="sigInfoEdit">
<widget class="NewContactEditLine" name="sigInfoEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1770,7 +1773,7 @@
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="qslViaEdit">
<widget class="NewContactEditLine" name="qslViaEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1878,7 +1881,7 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="emailEdit">
<widget class="NewContactEditLine" name="emailEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand All @@ -1898,7 +1901,7 @@
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="urlEdit">
<widget class="NewContactEditLine" name="urlEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -1968,7 +1971,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="satNameEdit">
<widget class="NewContactEditLine" name="satNameEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -2394,6 +2397,11 @@
<extends>QTableView</extends>
<header>ui/DxccTableWidget.h</header>
</customwidget>
<customwidget>
<class>NewContactEditLine</class>
<extends>QLineEdit</extends>
<header>ui/EditLine.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>callsignEdit</tabstop>
Expand Down
Loading

0 comments on commit db2d1d9

Please sign in to comment.