From ab358fb3a5e15a521abd0b4333bf8df40c8d1d6b Mon Sep 17 00:00:00 2001 From: "yifang.xiao" Date: Thu, 18 Nov 2021 14:28:12 +0800 Subject: [PATCH] remove old qt(<5) code. --- articleview.cc | 9 --------- loaddictionaries.cc | 4 ---- mainwindow.cc | 2 +- scanpopup.cc | 2 +- treeview.cc | 7 ------- 5 files changed, 2 insertions(+), 22 deletions(-) diff --git a/articleview.cc b/articleview.cc index 18c96683..44276c91 100644 --- a/articleview.cc +++ b/articleview.cc @@ -2418,9 +2418,6 @@ void ArticleView::performFindOperation( bool restart, bool backwards, bool check if ( ui.searchCaseSensitive->isChecked() ) f |= QWebEnginePage::FindCaseSensitively; -#if QT_VERSION >= 0x040600 && QT_VERSION <= 0x050600 - f |= QWebEnginePage::HighlightAllOccurrences; -#endif ui.definition->findText( "", f ); @@ -2678,15 +2675,9 @@ void ArticleView::highlightFTSResults() if( ftsSearchMatchCase ) flags |= QWebEnginePage::FindCaseSensitively; -#if QT_VERSION >= 0x040600 - // flags |= QWebEnginePage::HighlightAllOccurrences; - for( int x = 0; x < allMatches.size(); x++ ) ui.definition->findText( allMatches.at( x ), flags ); - // flags &= ~QWebEnginePage::HighlightAllOccurrences; -#endif - if( !allMatches.isEmpty() ) { ui.definition->findText( allMatches.at( 0 ), flags ); diff --git a/loaddictionaries.cc b/loaddictionaries.cc index 3bd7e15c..24bdd1aa 100644 --- a/loaddictionaries.cc +++ b/loaddictionaries.cc @@ -381,10 +381,6 @@ void loadDictionaries( QWidget * parent, bool showInitially, set< string > ids; std::pair< std::set< string >::iterator, bool > ret; -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - QTextCodec::setCodecForCStrings( QTextCodec::codecForName( "UTF8" ) ); -#endif - for( unsigned x = dictionaries.size(); x--; ) { ret = ids.insert( dictionaries[ x ]->getId() ); diff --git a/mainwindow.cc b/mainwindow.cc index 887f3b25..b875b7ec 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -599,7 +599,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ): connect( ui.menuHistory, SIGNAL( aboutToShow() ), this, SLOT( updateHistoryMenu() ) ); -#if !defined( HAVE_X11 ) || QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 ) +#if !defined( HAVE_X11 ) // Show tray icon early so the user would be happy. It won't be functional // though until the program inits fully. // Do not create dummy tray icon in X. Cause QT5 failed to upgrade systemtray context menu. diff --git a/scanpopup.cc b/scanpopup.cc index 4de1ca95..e59267a5 100644 --- a/scanpopup.cc +++ b/scanpopup.cc @@ -25,7 +25,7 @@ using std::wstring; /// in their behavior on those platforms. static const Qt::WindowFlags defaultUnpinnedWindowFlags = -#if defined (Q_OS_WIN) || ( defined (Q_OS_MAC) && QT_VERSION < QT_VERSION_CHECK( 5, 3, 0 ) ) +#if defined (Q_OS_WIN) Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint #else Qt::Popup diff --git a/treeview.cc b/treeview.cc index 3dea81e2..b4a22aed 100644 --- a/treeview.cc +++ b/treeview.cc @@ -7,11 +7,4 @@ void TreeView::dropEvent( QDropEvent * event ) { QTreeView::dropEvent( event ); - -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - // Qt 4 don't check success of drop operation. Add turnaround. - - if( !event->isAccepted() ) - event->setDropAction( Qt::IgnoreAction ); -#endif }