mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-08 08:54:41 -04:00
1. Moved font width calc for DXCC enitity display from LogBook to DisplayText.
2. The available character count is now updated by catching resizeEvents git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3545 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
@@ -2,9 +2,12 @@
|
||||
#include <QDebug>
|
||||
#include <QMouseEvent>
|
||||
|
||||
|
||||
DisplayText::DisplayText(QWidget *parent) :
|
||||
QTextBrowser(parent)
|
||||
{
|
||||
_fontWidth = 8; // typical
|
||||
_maxDisplayedCharacters = 48; // a nominal safe(?) value
|
||||
}
|
||||
|
||||
void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
@@ -14,3 +17,18 @@ void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
emit(selectCallsign(shift,ctrl));
|
||||
QTextBrowser::mouseDoubleClickEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void DisplayText::setFont(QFont font)
|
||||
{
|
||||
QFontMetrics qfm(font);
|
||||
_fontWidth = qfm.averageCharWidth()+1; // the plus one is emperical
|
||||
QTextBrowser::setFont(font);
|
||||
}
|
||||
|
||||
void DisplayText::resizeEvent(QResizeEvent * event)
|
||||
{
|
||||
if (_fontWidth > 0 && _fontWidth < 999)
|
||||
_maxDisplayedCharacters = width()/_fontWidth;
|
||||
QTextBrowser::resizeEvent(event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user