fix:add log to clipboard datachange signal

fix:add log to clipboard datachange signal
This commit is contained in:
Xiao YiFang 2022-08-14 23:13:35 +08:00
parent 370eb1357f
commit 6a7e54c165
3 changed files with 7 additions and 5 deletions

View file

@ -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()

View file

@ -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

View file

@ -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 );
}