[poppler] qt5/demos qt5/src
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Feb 1 14:40:45 UTC 2022
qt5/demos/navigationtoolbar.cpp | 11 ++++-------
qt5/demos/viewer.cpp | 17 ++++++-----------
qt5/src/poppler-optcontent.cc | 15 ++++-----------
3 files changed, 14 insertions(+), 29 deletions(-)
New commits:
commit b2f14ccbf4e5aef7489d2da45c03cacf8db67953
Author: Albert Astals Cid <aacid at kde.org>
Date: Tue Feb 1 15:35:47 2022 +0100
qt5: cleanup todos, we already require that qt version since a while
diff --git a/qt5/demos/navigationtoolbar.cpp b/qt5/demos/navigationtoolbar.cpp
index b1bf4576..74b32400 100644
--- a/qt5/demos/navigationtoolbar.cpp
+++ b/qt5/demos/navigationtoolbar.cpp
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2008-2009, Pino Toscano <pino at kde.org>
* Copyright (C) 2013, Fabio D'Urso <fabiodurso at hotmail.it>
- * Copyright (C) 2019, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2019, 2022, Albert Astals Cid <aacid at kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,8 +30,7 @@ NavigationToolBar::NavigationToolBar(QWidget *parent) : QToolBar(parent)
m_firstAct = addAction(tr("First"), this, SLOT(slotGoFirst()));
m_prevAct = addAction(tr("Previous"), this, SLOT(slotGoPrev()));
m_pageCombo = new QComboBox(this);
- // TODO replace with qOverload once we start requiring Qt 5.7
- connect(m_pageCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &NavigationToolBar::slotComboActivated);
+ connect(m_pageCombo, qOverload<int>(&QComboBox::activated), this, &NavigationToolBar::slotComboActivated);
addWidget(m_pageCombo);
m_nextAct = addAction(tr("Next"), this, SLOT(slotGoNext()));
m_lastAct = addAction(tr("Last"), this, SLOT(slotGoLast()));
@@ -53,8 +52,7 @@ NavigationToolBar::NavigationToolBar(QWidget *parent) : QToolBar(parent)
m_zoomCombo->addItem(tr("300%"));
m_zoomCombo->addItem(tr("400%"));
m_zoomCombo->setCurrentIndex(6); // "100%"
- // TODO replace with qOverload once we start requiring Qt 5.7
- connect(m_zoomCombo, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), this, &NavigationToolBar::slotZoomComboChanged);
+ connect(m_zoomCombo, qOverload<const QString &>(&QComboBox::currentIndexChanged), this, &NavigationToolBar::slotZoomComboChanged);
addWidget(m_zoomCombo);
m_rotationCombo = new QComboBox(this);
@@ -63,8 +61,7 @@ NavigationToolBar::NavigationToolBar(QWidget *parent) : QToolBar(parent)
m_rotationCombo->addItem(tr("90\302\260"));
m_rotationCombo->addItem(tr("180\302\260"));
m_rotationCombo->addItem(tr("270\302\260"));
- // TODO replace with qOverload once we start requiring Qt 5.7
- connect(m_rotationCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &NavigationToolBar::slotRotationComboChanged);
+ connect(m_rotationCombo, qOverload<int>(&QComboBox::currentIndexChanged), this, &NavigationToolBar::slotRotationComboChanged);
addWidget(m_rotationCombo);
documentClosed();
diff --git a/qt5/demos/viewer.cpp b/qt5/demos/viewer.cpp
index fd41320e..eebd08d1 100644
--- a/qt5/demos/viewer.cpp
+++ b/qt5/demos/viewer.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008-2009, Pino Toscano <pino at kde.org>
- * Copyright (C) 2008, 2019, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2008, 2019, 2022, Albert Astals Cid <aacid at kde.org>
* Copyright (C) 2009, Shawn Rutledge <shawn.t.rutledge at gmail.com>
* Copyright (C) 2013, Fabio D'Urso <fabiodurso at hotmail.it>
* Copyright (C) 2020, Oliver Sander <oliver.sander at tu-dresden.de>
@@ -53,17 +53,14 @@ PdfViewer::PdfViewer(QWidget *parent) : QMainWindow(parent), m_currentPage(0), m
// setup the menus
QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
- // TODO Use modern syntax when depending on Qt 5.6
- m_fileOpenAct = fileMenu->addAction(tr("&Open"), this, SLOT(slotOpenFile())); // clazy:exclude=old-style-connect
+ m_fileOpenAct = fileMenu->addAction(tr("&Open"), this, &PdfViewer::slotOpenFile);
m_fileOpenAct->setShortcut(Qt::CTRL + Qt::Key_O);
fileMenu->addSeparator();
- // TODO Use modern syntax when depending on Qt 5.6
- m_fileSaveCopyAct = fileMenu->addAction(tr("&Save a Copy..."), this, SLOT(slotSaveCopy())); // clazy:exclude=old-style-connect
+ m_fileSaveCopyAct = fileMenu->addAction(tr("&Save a Copy..."), this, &PdfViewer::slotSaveCopy);
m_fileSaveCopyAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_S);
m_fileSaveCopyAct->setEnabled(false);
fileMenu->addSeparator();
- // TODO Use modern syntax when depending on Qt 5.6
- QAction *act = fileMenu->addAction(tr("&Quit"), qApp, SLOT(closeAllWindows())); // clazy:exclude=old-style-connect
+ QAction *act = fileMenu->addAction(tr("&Quit"), qApp, &QApplication::closeAllWindows);
act->setShortcut(Qt::CTRL + Qt::Key_Q);
QMenu *viewMenu = menuBar()->addMenu(tr("&View"));
@@ -90,10 +87,8 @@ PdfViewer::PdfViewer(QWidget *parent) : QMainWindow(parent), m_currentPage(0), m
connect(m_settingsRenderBackendGrp, &QActionGroup::triggered, this, &PdfViewer::slotRenderBackend);
QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
- // TODO Use modern syntax when depending on Qt 5.6
- act = helpMenu->addAction(tr("&About"), this, SLOT(slotAbout())); // clazy:exclude=old-style-connect
- // TODO Use modern syntax when depending on Qt 5.6
- act = helpMenu->addAction(tr("About &Qt"), this, SLOT(slotAboutQt())); // clazy:exclude=old-style-connect
+ act = helpMenu->addAction(tr("&About"), this, &PdfViewer::slotAbout);
+ act = helpMenu->addAction(tr("About &Qt"), this, &PdfViewer::slotAboutQt);
NavigationToolBar *navbar = new NavigationToolBar(this);
addToolBar(navbar);
diff --git a/qt5/src/poppler-optcontent.cc b/qt5/src/poppler-optcontent.cc
index cf92fd44..64654da0 100644
--- a/qt5/src/poppler-optcontent.cc
+++ b/qt5/src/poppler-optcontent.cc
@@ -3,7 +3,7 @@
* Copyright (C) 2007, Brad Hards <bradh at kde.org>
* Copyright (C) 2008, 2014, Pino Toscano <pino at kde.org>
* Copyright (C) 2008, Carlos Garcia Campos <carlosgc at gnome.org>
- * Copyright (C) 2015-2019, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2015-2019, 2022, Albert Astals Cid <aacid at kde.org>
* Copyright (C) 2017, Hubert Figuière <hub at figuiere.net>
* Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info at kdab.com>. Work sponsored by the LiMux project of the city of Munich
* Copyright (C) 2018 Adam Reichold <adam.reichold at t-online.de>
@@ -38,13 +38,6 @@
#include "poppler/Link.h"
namespace Poppler {
-// TODO use qAsConst when we can depend on Qt 5.7
-// or std::as_const when we can depend on C++17
-template<class T>
-constexpr std::add_const_t<T> &as_const(T &t) noexcept
-{
- return t;
-}
RadioButtonGroup::RadioButtonGroup(OptContentModelPrivate *ocModel, Array *rbarray)
{
@@ -57,7 +50,7 @@ RadioButtonGroup::RadioButtonGroup(OptContentModelPrivate *ocModel, Array *rbarr
OptContentItem *item = ocModel->itemFromRef(QString::number(ref.getRefNum()));
itemsInGroup.append(item);
}
- for (OptContentItem *item : as_const(itemsInGroup)) {
+ for (OptContentItem *item : std::as_const(itemsInGroup)) {
item->appendRBGroup(this);
}
}
@@ -67,7 +60,7 @@ RadioButtonGroup::~RadioButtonGroup() { }
QSet<OptContentItem *> RadioButtonGroup::setItemOn(OptContentItem *itemToSetOn)
{
QSet<OptContentItem *> changedItems;
- for (OptContentItem *thisItem : as_const(itemsInGroup)) {
+ for (OptContentItem *thisItem : std::as_const(itemsInGroup)) {
if (thisItem != itemToSetOn) {
QSet<OptContentItem *> newChangedItems;
thisItem->setState(OptContentItem::Off, false /*obeyRadioGroups*/, newChangedItems);
@@ -131,7 +124,7 @@ void OptContentItem::setState(ItemState state, bool obeyRadioGroups, QSet<OptCon
if (state == OptContentItem::On) {
m_group->setState(OptionalContentGroup::On);
if (obeyRadioGroups) {
- for (RadioButtonGroup *rbgroup : as_const(m_rbGroups)) {
+ for (RadioButtonGroup *rbgroup : std::as_const(m_rbGroups)) {
changedItems += rbgroup->setItemOn(this);
}
}
More information about the poppler
mailing list