From beef6dd138f8c26d4dc8002c3bd5f000d485c3b0 Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Wed, 13 Nov 2024 23:36:37 -0500 Subject: [PATCH] clean: delete most Qt5 & <=6.3 conditional compiled code (QT_VERSION) --- src/audio/audiooutput.cc | 26 +----------- src/audio/ffmpegaudio.cc | 28 +++---------- src/audio/ffmpegaudio.hh | 21 ++++------ src/audio/multimediaaudioplayer.cc | 25 ++--------- src/audio/multimediaaudioplayer.hh | 16 ++------ src/common/gddebug.cc | 8 +--- src/common/wildcard.cc | 7 +--- src/dict/dsl_details.hh | 6 +-- src/dict/epwing_book.cc | 4 -- src/dict/epwing_book.hh | 7 +--- src/dict/gls.cc | 7 +--- src/dict/mdictparser.cc | 7 +--- src/dict/sdict.cc | 31 ++++++-------- src/dict/utils/indexedzip.cc | 7 +--- src/iframeschemehandler.cc | 9 +--- src/main.cc | 12 ------ src/ui/article_inspect.cc | 6 +-- src/ui/articleview.cc | 66 ++++-------------------------- src/ui/dictheadwords.cc | 4 -- src/ui/mainwindow.cc | 4 -- src/ui/scanpopup.cc | 9 ---- src/ui/scanpopup.hh | 4 -- 22 files changed, 59 insertions(+), 255 deletions(-) diff --git a/src/audio/audiooutput.cc b/src/audio/audiooutput.cc index d6d18f9d..b4d4be13 100644 --- a/src/audio/audiooutput.cc +++ b/src/audio/audiooutput.cc @@ -6,11 +6,7 @@ #include #include #include -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - #include -#else - #include -#endif +#include #include #include @@ -23,18 +19,7 @@ static QAudioFormat format( int sampleRate, int channelCount ) out.setSampleRate( sampleRate ); out.setChannelCount( channelCount ); -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - out.setByteOrder( QAudioFormat::LittleEndian ); - out.setCodec( QLatin1String( "audio/pcm" ) ); -#endif - -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - out.setSampleSize( 16 ); - out.setSampleType( QAudioFormat::SignedInt ); -#else out.setSampleFormat( QAudioFormat::Int16 ); -#endif - return out; } @@ -50,11 +35,8 @@ public: QFuture< void > audioPlayFuture; -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - using AudioOutput = QAudioOutput; -#else using AudioOutput = QAudioSink; -#endif + AudioOutput * audioOutput = nullptr; QByteArray buffer; qint64 offset = 0; @@ -185,11 +167,7 @@ AudioOutput::AudioOutput( QObject * parent ): QObject( parent ), d_ptr( new AudioOutputPrivate ) { -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - d_ptr->audioPlayFuture = QtConcurrent::run( &d_ptr->threadPool, d_ptr.data(), &AudioOutputPrivate::doPlayAudio ); -#else d_ptr->audioPlayFuture = QtConcurrent::run( &d_ptr->threadPool, &AudioOutputPrivate::doPlayAudio, d_ptr.data() ); -#endif } void AudioOutput::setAudioFormat( int sampleRate, int channels ) diff --git a/src/audio/ffmpegaudio.cc b/src/audio/ffmpegaudio.cc index d1b2f214..41d3a0cc 100644 --- a/src/audio/ffmpegaudio.cc +++ b/src/audio/ffmpegaudio.cc @@ -2,27 +2,14 @@ #include "audiooutput.hh" #include "ffmpegaudio.hh" - - #include - -extern "C" { - #include - #include - #include - #include "libswresample/swresample.h" -} - - #include - #include - - #include - #if ( QT_VERSION >= QT_VERSION_CHECK( 6, 2, 0 ) ) - #include - - #include - #endif #include "gddebug.hh" #include "utils.hh" + #include + #include + #include + #include + #include + #include using std::vector; @@ -284,14 +271,11 @@ void DecoderContext::closeCodec() bool DecoderContext::openOutputDevice( QString & errorString ) { - // only check device when qt version is greater than 6.2 - #if ( QT_VERSION >= QT_VERSION_CHECK( 6, 2, 0 ) ) QAudioDevice m_outputDevice = QMediaDevices::defaultAudioOutput(); if ( m_outputDevice.isNull() ) { errorString += QString( "Can not found default audio output device" ); return false; } - #endif if ( audioOutput == nullptr ) { errorString += QStringLiteral( "Failed to create audioOutput." ); diff --git a/src/audio/ffmpegaudio.hh b/src/audio/ffmpegaudio.hh index 18e45275..56b55b27 100644 --- a/src/audio/ffmpegaudio.hh +++ b/src/audio/ffmpegaudio.hh @@ -1,27 +1,24 @@ #pragma once #ifdef MAKE_FFMPEG_PLAYER - #include "audiooutput.hh" - #include - #include - #include - #include + extern "C" { #include #include #include #include "libswresample/swresample.h" } - - #include + #include "audiooutput.hh" + #include + #include + #include + #include + #include #include - + #include + #include #include - #if ( QT_VERSION >= QT_VERSION_CHECK( 6, 2, 0 ) ) - #include - #include - #endif using std::vector; namespace Ffmpeg { class DecoderThread; diff --git a/src/audio/multimediaaudioplayer.cc b/src/audio/multimediaaudioplayer.cc index cf441488..aecc330b 100644 --- a/src/audio/multimediaaudioplayer.cc +++ b/src/audio/multimediaaudioplayer.cc @@ -4,29 +4,18 @@ #ifdef MAKE_QTMULTIMEDIA_PLAYER #include - #if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) - #include - #endif - #if ( QT_VERSION > QT_VERSION_CHECK( 6, 2, 0 ) ) - #include - #endif + #include #include "multimediaaudioplayer.hh" #include MultimediaAudioPlayer::MultimediaAudioPlayer() - #if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) - : - player( 0, QMediaPlayer::StreamPlayback ) - #endif { player.setAudioOutput( &audioOutput ); connect( &player, &QMediaPlayer::errorChanged, this, &MultimediaAudioPlayer::onMediaPlayerError ); - #if ( QT_VERSION > QT_VERSION_CHECK( 6, 2, 0 ) ) connect( &mediaDevices, &QMediaDevices::audioOutputsChanged, this, &MultimediaAudioPlayer::audioOutputChange ); - #endif } void MultimediaAudioPlayer::audioOutputChange() @@ -42,15 +31,11 @@ QString MultimediaAudioPlayer::play( const char * data, int size ) if ( !audioBuffer->open( QIODevice::ReadOnly ) ) { return tr( "Couldn't open audio buffer for reading." ); } - #if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) player.setSourceDevice( audioBuffer ); - #if ( QT_VERSION > QT_VERSION_CHECK( 6, 2, 0 ) ) + audioOutput.setDevice( QMediaDevices::defaultAudioOutput() ); player.setAudioOutput( &audioOutput ); - #endif - #else - player.setMedia( QMediaContent(), audioBuffer ); - #endif + player.play(); return {}; } @@ -58,9 +43,7 @@ QString MultimediaAudioPlayer::play( const char * data, int size ) void MultimediaAudioPlayer::stop() { player.stop(); - #if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) - player.setMedia( QMediaContent() ); // Forget about audioBuffer. - #endif + if ( audioBuffer ) { audioBuffer->close(); audioBuffer->setData( QByteArray() ); // Free memory. diff --git a/src/audio/multimediaaudioplayer.hh b/src/audio/multimediaaudioplayer.hh index 44b354a8..829f5aa7 100644 --- a/src/audio/multimediaaudioplayer.hh +++ b/src/audio/multimediaaudioplayer.hh @@ -5,15 +5,11 @@ #ifdef MAKE_QTMULTIMEDIA_PLAYER - #include - #include #include "audioplayerinterface.hh" - #if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) - #include - #endif - #if ( QT_VERSION >= QT_VERSION_CHECK( 6, 2, 0 ) ) - #include - #endif + #include + #include + #include + #include #include class MultimediaAudioPlayer: public AudioPlayerInterface @@ -34,12 +30,8 @@ private slots: private: QPointer< QBuffer > audioBuffer; QMediaPlayer player; ///< Depends on audioBuffer. - #if ( QT_VERSION >= QT_VERSION_CHECK( 6, 2, 0 ) ) QAudioOutput audioOutput; - #endif - #if ( QT_VERSION >= QT_VERSION_CHECK( 6, 2, 0 ) ) QMediaDevices mediaDevices; - #endif }; #endif // MAKE_QTMULTIMEDIA_PLAYER diff --git a/src/common/gddebug.cc b/src/common/gddebug.cc index be9d365d..e9982c71 100644 --- a/src/common/gddebug.cc +++ b/src/common/gddebug.cc @@ -1,14 +1,10 @@ /* This file is (c) 2013 Abs62 * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ -#include #include "gddebug.hh" #include -#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) - #include -#else - #include -#endif +#include +#include QFile * logFilePtr; diff --git a/src/common/wildcard.cc b/src/common/wildcard.cc index 624e5f9b..65eac7d0 100644 --- a/src/common/wildcard.cc +++ b/src/common/wildcard.cc @@ -9,11 +9,6 @@ QString wildcardsToRegexp( const QString & wc_str ) { -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - //qt 5.X does not offer an unanchored version. the default output is enclosed between \A \z. - auto anchorPattern = QRegularExpression::wildcardToRegularExpression( wc_str ); - return anchorPattern.mid( 2, anchorPattern.length() - 4 ); -#else + // The "anchored" version will enclose the output with \A...\z. return QRegularExpression::wildcardToRegularExpression( wc_str, QRegularExpression::UnanchoredWildcardConversion ); -#endif } diff --git a/src/dict/dsl_details.hh b/src/dict/dsl_details.hh index c0cb1fb5..8eaa7481 100644 --- a/src/dict/dsl_details.hh +++ b/src/dict/dsl_details.hh @@ -9,11 +9,7 @@ #include #include "dictionary.hh" #include "iconv.hh" -#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) - #include -#else - #include -#endif +#include #include #include "utf8.hh" diff --git a/src/dict/epwing_book.cc b/src/dict/epwing_book.cc index aeac0d08..22dd5069 100644 --- a/src/dict/epwing_book.cc +++ b/src/dict/epwing_book.cc @@ -541,11 +541,7 @@ bool EpwingBook::setSubBook( int book_nom ) QFile f( fileName ); if ( f.open( QFile::ReadOnly | QFile::Text ) ) { QTextStream ts( &f ); - #if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) - ts.setCodec( "UTF-8" ); - #else ts.setEncoding( QStringConverter::Utf8 ); - #endif QString line = ts.readLine(); while ( !line.isEmpty() ) { diff --git a/src/dict/epwing_book.hh b/src/dict/epwing_book.hh index 8fd78a3b..25655455 100644 --- a/src/dict/epwing_book.hh +++ b/src/dict/epwing_book.hh @@ -16,12 +16,7 @@ #endif #include -#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) - #include -#else - #include -#endif - +#include #ifdef _MSC_VER #include diff --git a/src/dict/gls.cc b/src/dict/gls.cc index a15ba10a..d2893698 100644 --- a/src/dict/gls.cc +++ b/src/dict/gls.cc @@ -32,11 +32,8 @@ #include #include -#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) - #include -#else - #include -#endif +#include + #include #include #include diff --git a/src/dict/mdictparser.cc b/src/dict/mdictparser.cc index 6ddbd676..5ff991c9 100644 --- a/src/dict/mdictparser.cc +++ b/src/dict/mdictparser.cc @@ -32,11 +32,8 @@ #include #include #include -#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) - #include -#else - #include -#endif +#include + #include "decompress.hh" #include "gddebug.hh" #include "ripemd.hh" diff --git a/src/dict/sdict.cc b/src/dict/sdict.cc index e84eb019..3a34a8c0 100644 --- a/src/dict/sdict.cc +++ b/src/dict/sdict.cc @@ -1,36 +1,31 @@ /* This file is (c) 2008-2012 Konstantin Isakov * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ -#include "sdict.hh" #include "btreeidx.hh" -#include "folding.hh" -#include "utf8.hh" #include "chunkedstorage.hh" -#include "langcoder.hh" -#include "gddebug.hh" - #include "decompress.hh" -#include "htmlescape.hh" +#include "folding.hh" #include "ftshelpers.hh" - +#include "gddebug.hh" +#include "htmlescape.hh" +#include "langcoder.hh" +#include "sdict.hh" +#include "utf8.hh" #include +#include +#include +#include +#include #include #include +#include "utils.hh" + + #ifdef _MSC_VER #include #endif -#include -#include -#include -#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) - #include -#endif -#include - -#include "utils.hh" - namespace Sdict { using std::map; diff --git a/src/dict/utils/indexedzip.cc b/src/dict/utils/indexedzip.cc index 360799ba..834a4725 100644 --- a/src/dict/utils/indexedzip.cc +++ b/src/dict/utils/indexedzip.cc @@ -8,11 +8,8 @@ #include "utf8.hh" #include "iconv.hh" #include "wstring_qt.hh" -#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) - #include -#else - #include -#endif +#include + #include using namespace BtreeIndexing; diff --git a/src/iframeschemehandler.cc b/src/iframeschemehandler.cc index 74744f27..9bf6d677 100644 --- a/src/iframeschemehandler.cc +++ b/src/iframeschemehandler.cc @@ -105,15 +105,8 @@ void IframeSchemeHandler::requestStarted( QWebEngineUrlRequestJob * requestJob ) buffer->setData( articleString.toUtf8() ); -#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) requestJob->reply( "text/html; charset=utf-8", buffer ); -#else - #if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC ) - requestJob->reply( contentType, buffer ); - #else - requestJob->reply( "text/html", buffer ); - #endif -#endif + }; connect( reply, &QNetworkReply::finished, requestJob, finishAction ); diff --git a/src/main.cc b/src/main.cc index e359da57..f1109f3e 100644 --- a/src/main.cc +++ b/src/main.cc @@ -307,15 +307,7 @@ void processCommandLine( QCoreApplication * app, GDOptions * result ) // Handle cases where we get encoded URL if ( result->word.startsWith( QStringLiteral( "xn--" ) ) ) { // For `kde-open` or `gio` or others, URL are encoded into ACE or Punycode - #if QT_VERSION >= QT_VERSION_CHECK( 6, 3, 0 ) result->word = QUrl::fromAce( result->word.toLatin1(), QUrl::IgnoreIDNWhitelist ); - #else - // Old Qt's fromAce only applies to whitelisted domains, so we add .com to bypass this restriction :) - // https://bugreports.qt.io/browse/QTBUG-29080 - result->word.append( QStringLiteral( ".com" ) ); - result->word = QUrl::fromAce( result->word.toLatin1() ); - result->word.chop( 4 ); - #endif } else if ( result->word.startsWith( QStringLiteral( "%" ) ) ) { // For Firefox or other browsers where URL are percent encoded @@ -359,10 +351,6 @@ int main( int argc, char ** argv ) //high dpi screen support -#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) - QApplication::setAttribute( Qt::AA_EnableHighDpiScaling ); - QApplication::setAttribute( Qt::AA_UseHighDpiPixmaps ); -#endif qputenv( "QT_ENABLE_HIGHDPI_SCALING", "1" ); QApplication::setHighDpiScaleFactorRoundingPolicy( Qt::HighDpiScaleFactorRoundingPolicy::PassThrough ); diff --git a/src/ui/article_inspect.cc b/src/ui/article_inspect.cc index e2943516..6eac73f4 100644 --- a/src/ui/article_inspect.cc +++ b/src/ui/article_inspect.cc @@ -1,8 +1,6 @@ #include "article_inspect.hh" #include -#if ( QT_VERSION > QT_VERSION_CHECK( 6, 0, 0 ) ) - #include -#endif +#include ArticleInspector::ArticleInspector( QWidget * parent ): QWidget( parent, Qt::WindowType::Window ) { @@ -39,9 +37,7 @@ void ArticleInspector::triggerAction( QWebEnginePage * page ) return; } -#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) || QT_VERSION > QT_VERSION_CHECK( 6, 3, 0 ) ) page->triggerAction( QWebEnginePage::InspectElement ); -#endif } void ArticleInspector::closeEvent( QCloseEvent * ) diff --git a/src/ui/articleview.cc b/src/ui/articleview.cc index ad32137d..b551fc9c 100644 --- a/src/ui/articleview.cc +++ b/src/ui/articleview.cc @@ -31,15 +31,9 @@ #include #include #include - -#if ( QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 ) && QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) - #include -#endif -#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) - #include - #include - #include -#endif +#include +#include +#include #ifdef Q_OS_WIN32 #include #include @@ -214,15 +208,7 @@ ArticleView::ArticleView( QWidget * parent, QWebEngineSettings * settings = webview->settings(); settings->setUnknownUrlSchemePolicy( QWebEngineSettings::UnknownUrlSchemePolicy::DisallowUnknownUrlSchemes ); -#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) - settings->defaultSettings()->setAttribute( QWebEngineSettings::LocalContentCanAccessRemoteUrls, true ); - settings->defaultSettings()->setAttribute( QWebEngineSettings::LocalContentCanAccessFileUrls, true ); - settings->defaultSettings()->setAttribute( QWebEngineSettings::ErrorPageEnabled, false ); - settings->defaultSettings()->setAttribute( QWebEngineSettings::LinksIncludedInFocusChain, false ); - settings->defaultSettings()->setAttribute( QWebEngineSettings::PlaybackRequiresUserGesture, false ); - settings->defaultSettings()->setAttribute( QWebEngineSettings::JavascriptCanAccessClipboard, true ); - settings->defaultSettings()->setAttribute( QWebEngineSettings::PrintElementBackgrounds, false ); -#else + settings->setAttribute( QWebEngineSettings::LocalContentCanAccessRemoteUrls, true ); settings->setAttribute( QWebEngineSettings::LocalContentCanAccessFileUrls, true ); settings->setAttribute( QWebEngineSettings::ErrorPageEnabled, false ); @@ -230,7 +216,6 @@ ArticleView::ArticleView( QWidget * parent, settings->setAttribute( QWebEngineSettings::PlaybackRequiresUserGesture, false ); settings->setAttribute( QWebEngineSettings::JavascriptCanAccessClipboard, true ); settings->setAttribute( QWebEngineSettings::PrintElementBackgrounds, false ); -#endif auto html = articleNetMgr.getHtml( ResourceType::UNTITLE ); @@ -1329,12 +1314,10 @@ void ArticleView::print( QPrinter * printer ) const result = success; loop.quit(); }; -#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) - webview->page()->print( printer, std::move( printPreview ) ); -#else + connect( webview, &QWebEngineView::printFinished, &loop, std::move( printPreview ) ); webview->print( printer ); -#endif + loop.exec(); if ( !result ) { qDebug() << "print failed"; @@ -1363,11 +1346,7 @@ void ArticleView::contextMenuRequested( QPoint const & pos ) QAction * saveSoundAction = nullptr; QAction * saveBookmark = nullptr; -#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) - const QWebEngineContextMenuData * menuData = &( r->contextMenuData() ); -#else QWebEngineContextMenuRequest * menuData = webview->lastContextMenuRequest(); -#endif QUrl targetUrl( menuData->linkUrl() ); Contexts contexts; @@ -1392,12 +1371,8 @@ void ArticleView::contextMenuRequested( QPoint const & pos ) } QUrl imageUrl; -#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) - if ( !popupView && menuData->mediaType() == QWebEngineContextMenuData::MediaTypeImage ) -#else - if ( !popupView && menuData->mediaType() == QWebEngineContextMenuRequest::MediaType::MediaTypeImage ) -#endif - { + + if ( !popupView && menuData->mediaType() == QWebEngineContextMenuRequest::MediaType::MediaTypeImage ) { imageUrl = menuData->mediaUrl(); if ( !imageUrl.isEmpty() ) { menu.addAction( webview->pageAction( QWebEnginePage::CopyImageToClipboard ) ); @@ -1955,19 +1930,12 @@ void ArticleView::findText( QString & text, const QWebEnginePage::FindFlags & f, const std::function< void( bool match ) > & callback ) { -#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) webview->findText( text, f, [ callback ]( const QWebEngineFindTextResult & result ) { auto r = result.numberOfMatches() > 0; if ( callback ) { callback( r ); } } ); -#else - webview->findText( text, f, [ callback ]( bool result ) { - if ( callback ) - callback( result ); - } ); -#endif } bool ArticleView::closeSearch() @@ -2099,7 +2067,6 @@ void ArticleView::performFtsFindOperation( bool backwards ) QWebEnginePage::FindFlags flags( 0 ); if ( backwards ) { -#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) webview->findText( firstAvailableText, flags | QWebEnginePage::FindBackward, [ this ]( const QWebEngineFindTextResult & result ) { @@ -2114,16 +2081,8 @@ void ArticleView::performFtsFindOperation( bool backwards ) ftsSearchPanel->statusLabel->setText( searchStatusMessage( result.activeMatch(), result.numberOfMatches() ) ); } ); -#else - webview->findText( firstAvailableText, flags | QWebEnginePage::FindBackward, [ this ]( bool res ) { - ftsSearchPanel->previous->setEnabled( res ); - if ( !ftsSearchPanel->next->isEnabled() ) - ftsSearchPanel->next->setEnabled( res ); - } ); -#endif } else { -#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) webview->findText( firstAvailableText, flags, [ this ]( const QWebEngineFindTextResult & result ) { if ( result.numberOfMatches() == 0 ) { return; @@ -2135,15 +2094,6 @@ void ArticleView::performFtsFindOperation( bool backwards ) ftsSearchPanel->statusLabel->setText( searchStatusMessage( result.activeMatch(), result.numberOfMatches() ) ); } ); -#else - - webview->findText( firstAvailableText, flags, [ this ]( bool res ) { - ftsSearchPanel->next->setEnabled( res ); - if ( !ftsSearchPanel->previous->isEnabled() ) - ftsSearchPanel->previous->setEnabled( res ); - } ); - -#endif } } diff --git a/src/ui/dictheadwords.cc b/src/ui/dictheadwords.cc index a6d658ef..5ca138fa 100644 --- a/src/ui/dictheadwords.cc +++ b/src/ui/dictheadwords.cc @@ -420,10 +420,6 @@ void DictHeadwords::saveHeadersToFile() // Write UTF-8 BOM QTextStream out( &file ); out.setGenerateByteOrderMark( true ); -//qt 6 will use utf-8 default. -#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - out.setCodec( "UTF-8" ); -#endif exportAllWords( progress, out ); diff --git a/src/ui/mainwindow.cc b/src/ui/mainwindow.cc index b7a2ab04..085acd45 100644 --- a/src/ui/mainwindow.cc +++ b/src/ui/mainwindow.cc @@ -760,11 +760,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ): #if defined( Q_OS_LINUX ) - #if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) defaultInterfaceStyle = QApplication::style()->name(); - #else - defaultInterfaceStyle = QApplication::style()->objectName(); - #endif #elif defined( Q_OS_MAC ) defaultInterfaceStyle = "Fusion"; #endif diff --git a/src/ui/scanpopup.cc b/src/ui/scanpopup.cc index 1c0cbc46..3b3a5845 100644 --- a/src/ui/scanpopup.cc +++ b/src/ui/scanpopup.cc @@ -8,11 +8,6 @@ #include #include #include -#if ( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ) - #include - #include - #include -#endif #include "gddebug.hh" #include "gestures.hh" @@ -846,11 +841,7 @@ void ScanPopup::leaveEvent( QEvent * event ) } } -#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) void ScanPopup::enterEvent( QEnterEvent * event ) -#else -void ScanPopup::enterEvent( QEvent * event ) -#endif { QMainWindow::enterEvent( event ); diff --git a/src/ui/scanpopup.hh b/src/ui/scanpopup.hh index 50927bb6..8d2f9c37 100644 --- a/src/ui/scanpopup.hh +++ b/src/ui/scanpopup.hh @@ -174,11 +174,7 @@ private: virtual void mouseMoveEvent( QMouseEvent * ); virtual void mouseReleaseEvent( QMouseEvent * ); virtual void leaveEvent( QEvent * event ); -#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) ) virtual void enterEvent( QEnterEvent * event ); -#else - virtual void enterEvent( QEvent * event ); -#endif virtual void showEvent( QShowEvent * ); virtual void closeEvent( QCloseEvent * ); virtual void moveEvent( QMoveEvent * );