Added log window population via double click of words in the rx window
This commit is contained in:
parent
c9f0cce564
commit
fd29d6a931
13
keyeater.cpp
13
keyeater.cpp
@ -42,3 +42,16 @@ bool MousePressEater::eventFilter(QObject *obj, QEvent *event){
|
|||||||
return QObject::eventFilter(obj, event);
|
return QObject::eventFilter(obj, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MouseDoubleClickEater::eventFilter(QObject *obj, QEvent *event){
|
||||||
|
if (event->type() == QEvent::MouseButtonDblClick) {
|
||||||
|
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||||
|
bool processed = false;
|
||||||
|
emit this->mouseDoubleClicked(obj, mouseEvent, &processed);
|
||||||
|
if(processed){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// standard event processing
|
||||||
|
return QObject::eventFilter(obj, event);
|
||||||
|
}
|
||||||
|
12
keyeater.h
12
keyeater.h
@ -44,7 +44,19 @@ public:
|
|||||||
Q_SIGNAL void mousePressed(QObject *obj, QMouseEvent *evt, bool *pProcessed);
|
Q_SIGNAL void mousePressed(QObject *obj, QMouseEvent *evt, bool *pProcessed);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MouseDoubleClickEater : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
MouseDoubleClickEater(){}
|
||||||
|
virtual ~MouseDoubleClickEater(){}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool eventFilter(QObject *obj, QEvent *event);
|
||||||
|
|
||||||
|
public:
|
||||||
|
Q_SIGNAL void mouseDoubleClicked(QObject *obj, QMouseEvent *evt, bool *pProcessed);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
20
logqso.cpp
20
logqso.cpp
@ -34,6 +34,26 @@ LogQSO::~LogQSO ()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LogQSO::acceptText(QString text){
|
||||||
|
auto w = focusWidget();
|
||||||
|
if(!w){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto name = QString(w->metaObject()->className());
|
||||||
|
if(name != "QLineEdit"){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto l = static_cast<QLineEdit*>(w);
|
||||||
|
if(!l->text().isEmpty()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
l->setText(text);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void LogQSO::on_start_now_button_pressed(){
|
void LogQSO::on_start_now_button_pressed(){
|
||||||
ui->start_date_time->setDateTime(DriftingDateTime::currentDateTimeUtc());
|
ui->start_date_time->setDateTime(DriftingDateTime::currentDateTimeUtc());
|
||||||
}
|
}
|
||||||
|
1
logqso.h
1
logqso.h
@ -37,6 +37,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void accept();
|
void accept();
|
||||||
|
bool acceptText(QString text);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void acceptQSO (QDateTime const& QSO_date_off, QString const& call, QString const& grid
|
void acceptQSO (QDateTime const& QSO_date_off, QString const& call, QString const& grid
|
||||||
|
@ -1176,6 +1176,12 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
|||||||
});
|
});
|
||||||
ui->extFreeTextMsgEdit->installEventFilter(enterFilter);
|
ui->extFreeTextMsgEdit->installEventFilter(enterFilter);
|
||||||
|
|
||||||
|
auto doubleClickFilter = new MouseDoubleClickEater();
|
||||||
|
connect(doubleClickFilter, &MouseDoubleClickEater::mouseDoubleClicked, this, [this](QObject *, QMouseEvent *, bool *){
|
||||||
|
QTimer::singleShot(150, this, &MainWindow::on_textEditRX_mouseDoubleClicked);
|
||||||
|
});
|
||||||
|
ui->textEditRX->viewport()->installEventFilter(doubleClickFilter);
|
||||||
|
|
||||||
auto clearActionSep = new QAction(nullptr);
|
auto clearActionSep = new QAction(nullptr);
|
||||||
clearActionSep->setSeparator(true);
|
clearActionSep->setSeparator(true);
|
||||||
|
|
||||||
@ -6217,6 +6223,30 @@ QPair<QString, int> MainWindow::popMessageFrame(){
|
|||||||
return m_txFrameQueue.dequeue();
|
return m_txFrameQueue.dequeue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_textEditRX_mouseDoubleClicked(){
|
||||||
|
auto c = ui->textEditRX->textCursor();
|
||||||
|
auto text = c.selectedText();
|
||||||
|
if(text.isEmpty()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int start = c.selectionStart();
|
||||||
|
int end = c.selectionEnd();
|
||||||
|
|
||||||
|
c.clearSelection();
|
||||||
|
c.setPosition(start);
|
||||||
|
c.movePosition(QTextCursor::PreviousCharacter, QTextCursor::MoveAnchor);
|
||||||
|
c.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, 1 + end-start);
|
||||||
|
|
||||||
|
auto prev = c.selectedText();
|
||||||
|
if(prev.startsWith("-") || prev.startsWith("+")){
|
||||||
|
ui->textEditRX->setTextCursor(c);
|
||||||
|
text = prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_logDlg->acceptText(text);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::on_nextFreeTextMsg_currentTextChanged (QString const& text)
|
void MainWindow::on_nextFreeTextMsg_currentTextChanged (QString const& text)
|
||||||
{
|
{
|
||||||
msgtype(text, ui->nextFreeTextMsg);
|
msgtype(text, ui->nextFreeTextMsg);
|
||||||
|
@ -326,6 +326,7 @@ private slots:
|
|||||||
void on_tableWidgetCalls_cellDoubleClicked(int row, int col);
|
void on_tableWidgetCalls_cellDoubleClicked(int row, int col);
|
||||||
void on_tableWidgetCalls_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
void on_tableWidgetCalls_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
||||||
void on_freeTextMsg_currentTextChanged (QString const&);
|
void on_freeTextMsg_currentTextChanged (QString const&);
|
||||||
|
void on_textEditRX_mouseDoubleClicked();
|
||||||
void on_nextFreeTextMsg_currentTextChanged (QString const&);
|
void on_nextFreeTextMsg_currentTextChanged (QString const&);
|
||||||
void on_extFreeTextMsgEdit_currentTextChanged (QString const&);
|
void on_extFreeTextMsgEdit_currentTextChanged (QString const&);
|
||||||
int currentFreqOffset();
|
int currentFreqOffset();
|
||||||
|
Loading…
Reference in New Issue
Block a user