Repository navigation
DXCluster: spot list shows misaligned columns due to per-row dynamic padding #1142
Description
Summary
Spots shown in the DXCluster window (DXClusterWidget) are not vertically aligned. Depending on the length of the DX callsign or the spotter callsign, columns (frequency, comment, date) shift from one line to the next, making the list hard to read. This used to display aligned in earlier versions.
Root cause
In src/dxcluster/dxcluster.cpp, DXClusterWidget::printSpot(), the column width used to pad the DX call and spotter fields is computed per spot instead of being a fixed width for the whole list:
int callPad = 15;
if (spot.getDxCall().length()>11)
callPad = spot.getDxCall().length() + 3;
QString paddedDXCall = spot.getDxCall().leftJustified(callPad, ' ');
QString paddedFreq = ((spot.getFrequency()).toQString(MHz)).rightJustified(10, ' ');
callPad = 10;
if (spot.getSpotter().length()>11)
callPad = spot.getSpotter().length() + 3;
QString paddedSpotter = QString(spot.getSpotter()+ ":").leftJustified(callPad, ' ');
QString paddedComments = QString(spot.getComment()).leftJustified(28, ' ');Whenever a DX call or spotter call exceeds 11 characters (common with portable suffixes like /P, /MM, /QRP, or spotter node suffixes like -14), that specific row gets a different column width than every other row in the list, breaking alignment for the frequency/comment/date fields on that line.
The list widget (QListWidget) already uses a fixed-width font (QFontDatabase::FixedFont), so alignment is purely a matter of using consistent padding widths.
Proposed fix (Phase 1 of 2)
Replace the conditional, per-spot callPad logic with fixed column-width constants shared by every row (e.g. DXCALL_COLUMN_WIDTH, SPOTTER_COLUMN_WIDTH, COMMENT_COLUMN_WIDTH). Rows containing a callsign longer than the fixed width simply overflow that single field (as leftJustified already does when the input is longer than the target width) instead of resizing the whole column for that row.
This is a minimal, low-risk fix scoped to printSpot(). A more thorough long-term fix (migrating the plain-text list to a proper model/view table, as already done for the DX Assistant panel) is tracked separately as an enhancement.
Tasks
- Define fixed-width constants for DX call, spotter, and comment columns in
dxcluster.cpp(ordxcluster.h), replacing the current magic numbers (15, 10, 28) and the conditional resize logic. - Update
DXClusterWidget::printSpot()to use the fixed constants unconditionally (no per-row recalculation). - Manually verify alignment with a mix of short and long callsigns (including
/P,/MM,/QRPsuffixes and spotter node suffixes likeEA4K-14) to confirm all columns line up except for the intentional overflow on outlier rows. - Check
printSHDX()/printOther()paths (if they share similar padding logic) for the same issue.
Environment
- Observed in KLog 2.6
- File:
src/dxcluster/dxcluster.cpp
Activity