remove Qt < 5.12 code as Qt 5.12 is now minimal req. version

This commit is contained in:
Martin Rotter 2022-03-25 07:38:40 +01:00
parent a4430f6ccf
commit 2d7f9bb289
6 changed files with 9 additions and 39 deletions

View file

@ -18,14 +18,9 @@ FeedsProxyModel::FeedsProxyModel(FeedsModel* source_model, QObject* parent)
setSortRole(Qt::ItemDataRole::EditRole); setSortRole(Qt::ItemDataRole::EditRole);
setSortCaseSensitivity(Qt::CaseSensitivity::CaseInsensitive); setSortCaseSensitivity(Qt::CaseSensitivity::CaseInsensitive);
#if QT_VERSION >= 0x050A00 // Qt >= 5.10.0
setRecursiveFilteringEnabled(true); setRecursiveFilteringEnabled(true);
#endif
setFilterKeyColumn(FDS_MODEL_TITLE_INDEX); setFilterKeyColumn(FDS_MODEL_TITLE_INDEX);
setFilterRole(LOWER_TITLE_ROLE); setFilterRole(LOWER_TITLE_ROLE);
setDynamicSortFilter(true); setDynamicSortFilter(true);
setSourceModel(m_sourceModel); setSourceModel(m_sourceModel);

View file

@ -532,11 +532,7 @@ void FeedsView::filterItems(const QString& pattern) {
m_dontSaveExpandState = false; m_dontSaveExpandState = false;
} }
#if QT_VERSION < 0x050C00 // Qt < 5.12.0
m_proxyModel->setFilterRegExp(pattern.toLower());
#else
m_proxyModel->setFilterRegularExpression(pattern.toLower()); m_proxyModel->setFilterRegularExpression(pattern.toLower());
#endif
if (pattern.isEmpty()) { if (pattern.isEmpty()) {
loadAllExpandStates(); loadAllExpandStates();

View file

@ -380,7 +380,6 @@ void MessagesView::initializeContextMenu() {
<< qApp->mainForm()->m_ui->m_actionSwitchImportanceOfSelectedMessages << qApp->mainForm()->m_ui->m_actionSwitchImportanceOfSelectedMessages
<< qApp->mainForm()->m_ui->m_actionDeleteSelectedMessages); << qApp->mainForm()->m_ui->m_actionDeleteSelectedMessages);
if (m_sourceModel->loadedItem() != nullptr) { if (m_sourceModel->loadedItem() != nullptr) {
if (m_sourceModel->loadedItem()->kind() == RootItem::Kind::Bin) { if (m_sourceModel->loadedItem()->kind() == RootItem::Kind::Bin) {
m_contextMenu->addAction(qApp->mainForm()->m_ui->m_actionRestoreSelectedMessages); m_contextMenu->addAction(qApp->mainForm()->m_ui->m_actionRestoreSelectedMessages);
@ -771,11 +770,7 @@ void MessagesView::searchMessages(const QString& pattern) {
<< "Running search of messages with pattern" << "Running search of messages with pattern"
<< QUOTE_W_SPACE_DOT(pattern); << QUOTE_W_SPACE_DOT(pattern);
#if QT_VERSION < 0x050C00 // Qt < 5.12.0
m_proxyModel->setFilterRegExp(pattern.toLower());
#else
m_proxyModel->setFilterRegularExpression(pattern.toLower()); m_proxyModel->setFilterRegularExpression(pattern.toLower());
#endif
if (selectionModel()->selectedRows().isEmpty()) { if (selectionModel()->selectedRows().isEmpty()) {
emit currentMessageRemoved(); emit currentMessageRemoved();

View file

@ -9,11 +9,7 @@ void SqueezeLabel::paintEvent(QPaintEvent* event) {
m_squeezedTextCache = text(); m_squeezedTextCache = text();
QFontMetrics fm = fontMetrics(); QFontMetrics fm = fontMetrics();
#if QT_VERSION >= 0x050B00 // Qt >= 5.11.0
if (fm.horizontalAdvance(m_squeezedTextCache) > contentsRect().width()) { if (fm.horizontalAdvance(m_squeezedTextCache) > contentsRect().width()) {
#else
if (fm.width(m_squeezedTextCache) > contentsRect().width()) {
#endif
setText(fm.elidedText(text(), Qt::ElideMiddle, width())); setText(fm.elidedText(text(), Qt::ElideMiddle, width()));
} }
} }

View file

@ -53,11 +53,7 @@ int TextFactory::stringWidth(const QString& string, const QFontMetrics& metrics)
int width = 0; int width = 0;
for (const QString& line : lines) { for (const QString& line : lines) {
#if QT_VERSION >= 0x050B00 // Qt >= 5.11.0
int line_width = metrics.horizontalAdvance(line); int line_width = metrics.horizontalAdvance(line);
#else
int line_width = metrics.width(line);
#endif
if (line_width > width) { if (line_width > width) {
width = line_width; width = line_width;

View file

@ -317,20 +317,12 @@ void WebFactory::createMenu(QMenu* menu) {
actions << createEngineSettingsAction(tr("Allow geolocation on insecure origins"), QWebEngineSettings::WebAttribute::AllowGeolocationOnInsecureOrigins); actions << createEngineSettingsAction(tr("Allow geolocation on insecure origins"), QWebEngineSettings::WebAttribute::AllowGeolocationOnInsecureOrigins);
#endif #endif
#if QT_VERSION >= 0x050A00 // Qt >= 5.10.0
actions << createEngineSettingsAction(tr("JS can activate windows"), QWebEngineSettings::WebAttribute::AllowWindowActivationFromJavaScript); actions << createEngineSettingsAction(tr("JS can activate windows"), QWebEngineSettings::WebAttribute::AllowWindowActivationFromJavaScript);
actions << createEngineSettingsAction(tr("Show scrollbars"), QWebEngineSettings::WebAttribute::ShowScrollBars); actions << createEngineSettingsAction(tr("Show scrollbars"), QWebEngineSettings::WebAttribute::ShowScrollBars);
#endif
#if QT_VERSION >= 0x050B00 // Qt >= 5.11.0
actions << createEngineSettingsAction(tr("Media playback with gestures"), QWebEngineSettings::WebAttribute::PlaybackRequiresUserGesture); actions << createEngineSettingsAction(tr("Media playback with gestures"), QWebEngineSettings::WebAttribute::PlaybackRequiresUserGesture);
actions << createEngineSettingsAction(tr("WebRTC uses only public interfaces"), QWebEngineSettings::WebAttribute::WebRTCPublicInterfacesOnly); actions << createEngineSettingsAction(tr("WebRTC uses only public interfaces"), QWebEngineSettings::WebAttribute::WebRTCPublicInterfacesOnly);
actions << createEngineSettingsAction(tr("JS can paste from clipboard"), QWebEngineSettings::WebAttribute::JavascriptCanPaste); actions << createEngineSettingsAction(tr("JS can paste from clipboard"), QWebEngineSettings::WebAttribute::JavascriptCanPaste);
#endif
#if QT_VERSION >= 0x050C00 // Qt >= 5.12.0
actions << createEngineSettingsAction(tr("DNS prefetch enabled"), QWebEngineSettings::WebAttribute::DnsPrefetchEnabled); actions << createEngineSettingsAction(tr("DNS prefetch enabled"), QWebEngineSettings::WebAttribute::DnsPrefetchEnabled);
#endif
#if QT_VERSION >= 0x050D00 // Qt >= 5.13.0 #if QT_VERSION >= 0x050D00 // Qt >= 5.13.0
actions << createEngineSettingsAction(tr("PDF viewer enabled"), QWebEngineSettings::WebAttribute::PdfViewerEnabled); actions << createEngineSettingsAction(tr("PDF viewer enabled"), QWebEngineSettings::WebAttribute::PdfViewerEnabled);