From 6a7e54c16511fc6915df8d89564dd7b0abbb0d4b Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Sun, 14 Aug 2022 23:13:35 +0800 Subject: [PATCH] fix:add log to clipboard datachange signal fix:add log to clipboard datachange signal --- mainwindow.cc | 6 ++++-- mainwindow.hh | 2 +- scanpopup.cc | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index 711adc97..35b10f1e 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -919,11 +919,12 @@ MainWindow::MainWindow( Config::Class & cfg_ ): inspector.reset( new ArticleInspector( this )); - connect( QApplication::clipboard(), &QClipboard::changed, this, &MainWindow::clipboardChange ); + connect( QApplication::clipboard(), &QClipboard::dataChanged, this, &MainWindow::clipboardChange ); } -void MainWindow::clipboardChange( QClipboard::Mode mode ) +void MainWindow::clipboardChange( ) { + qDebug() << "clipboard change ," << cfg.preferences.trackClipboardChanges << scanPopup.get(); if( scanPopup && cfg.preferences.trackClipboardChanges ) { scanPopup->translateWordFromClipboard(); @@ -3234,6 +3235,7 @@ void MainWindow::showMainWindow() void MainWindow::trackingClipboard( bool on ) { cfg.preferences.trackClipboardChanges = on; + makeScanPopup(); } void MainWindow::visitHomepage() diff --git a/mainwindow.hh b/mainwindow.hh index ca173e8d..d835d8d5 100644 --- a/mainwindow.hh +++ b/mainwindow.hh @@ -487,7 +487,7 @@ private slots: void showGDHelp(); void hideGDHelp(); - void clipboardChange( QClipboard::Mode mode ); + void clipboardChange( ); signals: /// Set optional parts expand mode for all tabs diff --git a/scanpopup.cc b/scanpopup.cc index 3289b928..c3073b5a 100644 --- a/scanpopup.cc +++ b/scanpopup.cc @@ -469,12 +469,12 @@ void ScanPopup::editGroupRequested() void ScanPopup::translateWordFromClipboard(QClipboard::Mode m) { - GD_DPRINTF( "translating from clipboard or selection\n" ); + qDebug()<< "translating from clipboard or selection" ; QString subtype = "plain"; QString str = QApplication::clipboard()->text( subtype, m); - + qDebug() << "clipboard data:" << str; translateWord( str ); }