clean code:remove QT_VERSION check

This commit is contained in:
yifang 2021-12-16 19:59:00 +08:00
parent e04aa50a99
commit de3d7b8b19
11 changed files with 0 additions and 40 deletions

View file

@ -1928,7 +1928,6 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
else else
if( result == saveImageAction || result == saveSoundAction ) if( result == saveImageAction || result == saveSoundAction )
{ {
#if QT_VERSION >= 0x040600
// QUrl url = ( result == saveImageAction ) ? imageUrl : targetUrl; // QUrl url = ( result == saveImageAction ) ? imageUrl : targetUrl;
QUrl url = targetUrl; QUrl url = targetUrl;
QString savePath; QString savePath;
@ -1978,7 +1977,6 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
emit storeResourceSavePath( QDir::toNativeSeparators( fileInfo.absoluteDir().absolutePath() ) ); emit storeResourceSavePath( QDir::toNativeSeparators( fileInfo.absoluteDir().absolutePath() ) );
saveResource( url, ui.definition->url(), fileName ); saveResource( url, ui.definition->url(), fileName );
} }
#endif
} }
else else
{ {

View file

@ -1495,9 +1495,7 @@ bool BtreeDictionary::getHeadwords( QStringList &headwords )
if( setOfHeadwords.size() ) if( setOfHeadwords.size() )
{ {
#if QT_VERSION >= 0x040700
headwords.reserve( setOfHeadwords.size() ); headwords.reserve( setOfHeadwords.size() );
#endif
QSet< QString >::const_iterator it = setOfHeadwords.constBegin(); QSet< QString >::const_iterator it = setOfHeadwords.constBegin();
QSet< QString >::const_iterator end = setOfHeadwords.constEnd(); QSet< QString >::const_iterator end = setOfHeadwords.constEnd();

View file

@ -2,12 +2,8 @@
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#include "extlineedit.hh" #include "extlineedit.hh"
#include <QPainter> #include <QPainter>
#if QT_VERSION >= 0x040600
#include <QPropertyAnimation> #include <QPropertyAnimation>
#endif
ExtLineEdit::ExtLineEdit(QWidget *parent) : ExtLineEdit::ExtLineEdit(QWidget *parent) :
QLineEdit(parent) QLineEdit(parent)
@ -179,7 +175,6 @@ void IconButton::paintEvent(QPaintEvent *)
void IconButton::animate(bool visible) void IconButton::animate(bool visible)
{ {
#if QT_VERSION >= 0x040600
QPropertyAnimation *animation = new QPropertyAnimation(this, "opacity"); QPropertyAnimation *animation = new QPropertyAnimation(this, "opacity");
animation->setDuration(250); animation->setDuration(250);
if (visible) if (visible)
@ -191,7 +186,4 @@ void IconButton::animate(bool visible)
animation->setEndValue(0.0); animation->setEndValue(0.0);
} }
animation->start(QAbstractAnimation::DeleteWhenStopped); animation->start(QAbstractAnimation::DeleteWhenStopped);
#else
setOpacity(visible ? 1.0 : 0.0);
#endif
} }

View file

@ -3,8 +3,6 @@
#include "gdappstyle.hh" #include "gdappstyle.hh"
#if QT_VERSION >= 0x040600
#include "dictionarybar.hh" #include "dictionarybar.hh"
#include <QWidget> #include <QWidget>
@ -53,5 +51,3 @@ bool GdAppStyle::dictionaryBarButton(const QWidget * widget) const {
return false; return false;
} }
#endif // QT_VERSION

View file

@ -5,9 +5,6 @@
#define GDAPPSTYLE_HH #define GDAPPSTYLE_HH
#include <QtGlobal> #include <QtGlobal>
#if QT_VERSION >= 0x040600
#include <QStyle> #include <QStyle>
#include <QProxyStyle> #include <QProxyStyle>
#include <QStyleOption> #include <QStyleOption>
@ -30,6 +27,4 @@ private:
}; };
#endif // QT_VERSION
#endif // GDAPPSTYLE_HH #endif // GDAPPSTYLE_HH

View file

@ -546,9 +546,7 @@ void DictListWidget::rowsAboutToBeRemoved( QModelIndex const & parent, int start
DictGroupsWidget::DictGroupsWidget( QWidget * parent ): DictGroupsWidget::DictGroupsWidget( QWidget * parent ):
QTabWidget( parent ), nextId( 1 ), allDicts( 0 ), activeDicts( 0 ) QTabWidget( parent ), nextId( 1 ), allDicts( 0 ), activeDicts( 0 )
{ {
#if QT_VERSION >= 0x040500
setMovable( true ); setMovable( true );
#endif
setContextMenuPolicy( Qt::CustomContextMenu ); setContextMenuPolicy( Qt::CustomContextMenu );
connect( this, SIGNAL( customContextMenuRequested( QPoint ) ), connect( this, SIGNAL( customContextMenuRequested( QPoint ) ),
this, SLOT( contextMenu( QPoint ) ) ); this, SLOT( contextMenu( QPoint ) ) );
@ -1023,9 +1021,7 @@ QuickFilterLine::QuickFilterLine( QWidget * parent ): ExtLineEdit( parent ), m_f
{ {
m_proxyModel.setFilterCaseSensitivity( Qt::CaseInsensitive ); m_proxyModel.setFilterCaseSensitivity( Qt::CaseInsensitive );
#if QT_VERSION >= 0x040700
setPlaceholderText( tr( "Dictionary search/filter (Ctrl+F)" ) ); setPlaceholderText( tr( "Dictionary search/filter (Ctrl+F)" ) );
#endif
m_focusAction.setShortcut( QKeySequence( "Ctrl+F" ) ); m_focusAction.setShortcut( QKeySequence( "Ctrl+F" ) );
connect( &m_focusAction, SIGNAL( triggered() ), connect( &m_focusAction, SIGNAL( triggered() ),

View file

@ -353,11 +353,7 @@ bool LangCoder::isLanguageRTL( quint32 code )
GDLangCode &lc = LangCodes[ langCoder.codeMap[ code ] ]; GDLangCode &lc = LangCodes[ langCoder.codeMap[ code ] ];
if( lc.isRTL < 0 ) if( lc.isRTL < 0 )
{ {
#if QT_VERSION >= 0x040700
lc.isRTL = ( int )( QLocale( lc.code ).textDirection() == Qt::RightToLeft ); lc.isRTL = ( int )( QLocale( lc.code ).textDirection() == Qt::RightToLeft );
#else
lc.isRTL = 0;
#endif
} }
return lc.isRTL != 0; return lc.isRTL != 0;
} }

View file

@ -310,9 +310,7 @@ int main( int argc, char ** argv )
app.setApplicationName( "GoldenDict" ); app.setApplicationName( "GoldenDict" );
app.setOrganizationDomain( "http://goldendict.org/" ); app.setOrganizationDomain( "http://goldendict.org/" );
#if QT_VERSION >= 0x040600
app.setStyle(new GdAppStyle); app.setStyle(new GdAppStyle);
#endif
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
app.setWindowIcon( QIcon( ":/icons/programicon.png" ) ); app.setWindowIcon( QIcon( ":/icons/programicon.png" ) );

View file

@ -655,9 +655,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
connect( ui.tabWidget, SIGNAL( customContextMenuRequested(QPoint)) , connect( ui.tabWidget, SIGNAL( customContextMenuRequested(QPoint)) ,
this, SLOT( tabMenuRequested(QPoint)) ); this, SLOT( tabMenuRequested(QPoint)) );
#if QT_VERSION >= 0x040500
ui.tabWidget->setTabsClosable( true ); ui.tabWidget->setTabsClosable( true );
#endif
connect( ui.quit, SIGNAL( triggered() ), connect( ui.quit, SIGNAL( triggered() ),
this, SLOT( quitApp() ) ); this, SLOT( quitApp() ) );

View file

@ -98,10 +98,7 @@ TranslateBox::TranslateBox(QWidget *parent) : QWidget(parent),
setFocusProxy(translate_line); setFocusProxy(translate_line);
translate_line->setObjectName("translateLine"); translate_line->setObjectName("translateLine");
#if QT_VERSION >= 0x040700
translate_line->setPlaceholderText( tr( "Type a word or phrase to search dictionaries" ) ); translate_line->setPlaceholderText( tr( "Type a word or phrase to search dictionaries" ) );
#endif
word_list->setTranslateLine(translate_line); word_list->setTranslateLine(translate_line);
// completer = new QCompleter(m_completionList->model(), this); // completer = new QCompleter(m_completionList->model(), this);

View file

@ -831,11 +831,7 @@ namespace {
/// Deal with Qt 4.5 incompatibility /// Deal with Qt 4.5 incompatibility
QString readElementText( QXmlStreamReader & stream ) QString readElementText( QXmlStreamReader & stream )
{ {
#if QT_VERSION >= 0x040600
return stream.readElementText( QXmlStreamReader::SkipChildElements ); return stream.readElementText( QXmlStreamReader::SkipChildElements );
#else
return stream.readElementText();
#endif
} }
} }