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);
setSortCaseSensitivity(Qt::CaseSensitivity::CaseInsensitive);
#if QT_VERSION >= 0x050A00 // Qt >= 5.10.0
setRecursiveFilteringEnabled(true);
#endif
setFilterKeyColumn(FDS_MODEL_TITLE_INDEX);
setFilterRole(LOWER_TITLE_ROLE);
setDynamicSortFilter(true);
setSourceModel(m_sourceModel);

View file

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

View file

@ -380,7 +380,6 @@ void MessagesView::initializeContextMenu() {
<< qApp->mainForm()->m_ui->m_actionSwitchImportanceOfSelectedMessages
<< qApp->mainForm()->m_ui->m_actionDeleteSelectedMessages);
if (m_sourceModel->loadedItem() != nullptr) {
if (m_sourceModel->loadedItem()->kind() == RootItem::Kind::Bin) {
m_contextMenu->addAction(qApp->mainForm()->m_ui->m_actionRestoreSelectedMessages);
@ -551,7 +550,7 @@ void MessagesView::openSelectedMessageUrl() {
auto msg = m_sourceModel->messageAt(m_proxyModel->mapToSource(rws.at(0)).row());
if (!msg.m_url.isEmpty()) {
emit openLinkMiniBrowser(msg.m_url);
emit openLinkMiniBrowser(msg.m_url);
}
}
}
@ -562,7 +561,7 @@ void MessagesView::sendSelectedMessageViaEmail() {
if (!qApp->web()->sendMessageViaEmail(message)) {
MsgBox::show(this, QMessageBox::Critical, tr("Problem with starting external e-mail client"),
tr("External e-mail client could not be started."));
tr("External e-mail client could not be started."));
}
}
}
@ -771,11 +770,7 @@ void MessagesView::searchMessages(const QString& pattern) {
<< "Running search of messages with 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());
#endif
if (selectionModel()->selectedRows().isEmpty()) {
emit currentMessageRemoved();

View file

@ -9,11 +9,7 @@ void SqueezeLabel::paintEvent(QPaintEvent* event) {
m_squeezedTextCache = text();
QFontMetrics fm = fontMetrics();
#if QT_VERSION >= 0x050B00 // Qt >= 5.11.0
if (fm.horizontalAdvance(m_squeezedTextCache) > contentsRect().width()) {
#else
if (fm.width(m_squeezedTextCache) > contentsRect().width()) {
#endif
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;
for (const QString& line : lines) {
#if QT_VERSION >= 0x050B00 // Qt >= 5.11.0
int line_width = metrics.horizontalAdvance(line);
#else
int line_width = metrics.width(line);
#endif
if (line_width > width) {
width = line_width;

View file

@ -102,13 +102,13 @@ bool WebFactory::openUrlInExternalBrowser(const QString& url) const {
if (!result) {
// We display GUI information that browser was not probably opened.
MsgBox::show(qApp->mainFormWidget(),
QMessageBox::Icon::Critical,
tr("Navigate to website manually"),
tr("%1 was unable to launch your web browser with the given URL, you need to open the "
"below website URL in your web browser manually.").arg(QSL(APP_NAME)),
{},
url,
QMessageBox::StandardButton::Ok);
QMessageBox::Icon::Critical,
tr("Navigate to website manually"),
tr("%1 was unable to launch your web browser with the given URL, you need to open the "
"below website URL in your web browser manually.").arg(QSL(APP_NAME)),
{},
url,
QMessageBox::StandardButton::Ok);
}
return result;
@ -317,20 +317,12 @@ void WebFactory::createMenu(QMenu* menu) {
actions << createEngineSettingsAction(tr("Allow geolocation on insecure origins"), QWebEngineSettings::WebAttribute::AllowGeolocationOnInsecureOrigins);
#endif
#if QT_VERSION >= 0x050A00 // Qt >= 5.10.0
actions << createEngineSettingsAction(tr("JS can activate windows"), QWebEngineSettings::WebAttribute::AllowWindowActivationFromJavaScript);
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("WebRTC uses only public interfaces"), QWebEngineSettings::WebAttribute::WebRTCPublicInterfacesOnly);
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);
#endif
#if QT_VERSION >= 0x050D00 // Qt >= 5.13.0
actions << createEngineSettingsAction(tr("PDF viewer enabled"), QWebEngineSettings::WebAttribute::PdfViewerEnabled);