Commit b1c3af20 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

--warnings

Port away from some deprecated Qt constructions.
Mark arguments as unused, remove unused variables.
Properly sort constructors
parent 733a8402
......@@ -304,7 +304,7 @@ public:
object->installEventFilter(this);
}
bool eventFilter(QObject * object, QEvent * event)
bool eventFilter(QObject * object, QEvent * event) override
{
if (event->type() == QEvent::Close) {
QWindow* window = qobject_cast<QWindow*>(object);
......
......@@ -734,6 +734,7 @@ impanel_trigger_property_callback (GDBusConnection *connection,
else if (ibus_property_get_prop_type(property) == PROP_TYPE_RADIO) {
newstate = PROP_STATE_CHECKED;
}
Q_FALLTHROUGH();
case PROP_TYPE_NORMAL:
ibus_property_set_state(property, newstate);
ibus_panel_service_property_activate((IBusPanelService *)impanel, prop_key.constData(), newstate);
......
......@@ -492,7 +492,7 @@ void PagerModel::moveWindow(int window, double x, double y, const QVariant &targ
} else {
const QStringList &runningActivities = d->activityInfo->runningActivities();
if (targetItemId < runningActivities.length()) {
if (targetItemId.toInt() < runningActivities.length()) {
const QString &newActivity = targetItemId.toString();
QStringList activities = windowInfo.activities();
......@@ -541,7 +541,7 @@ void PagerModel::moveWindow(int window, double x, double y, const QVariant &targ
const QVariantList &winIds = idx.data(TaskManager::AbstractTasksModel::WinIdList).toList();
if (!winIds.isEmpty() && winIds.at(0).toUInt() == window) {
if (!winIds.isEmpty() && winIds.at(0).toInt() == window) {
tasksModel->requestVirtualDesktops(idx, QVariantList() << targetItemId.toString());
break;
}
......
......@@ -154,6 +154,7 @@ QVariant DirModel::data(const QModelIndex &index, int role) const
m_previewTimer->start(100);
const_cast<DirModel *>(this)->m_filesToPreview[item.url()] = QPersistentModelIndex(index);
Q_FALLTHROUGH();
}
default:
return KDirModel::data(index, role);
......
......@@ -346,7 +346,6 @@ void FolderModelTest::tst_multiScreen()
void FolderModelTest::tst_multiScreenDifferenPath()
{
auto *screenMapper = ScreenMapper::instance();
m_folderModel->setUsedByContainment(true);
m_folderModel->setScreen(0);
QSignalSpy s(m_folderModel, &FolderModel::listingCompleted);
......
......@@ -121,9 +121,9 @@ FolderModel::FolderModel(QObject *parent) : QSortFilterProxyModel(parent),
m_previews(false),
m_filterMode(NoFilter),
m_filterPatternMatchAll(true),
m_screenUsed(false),
m_screenMapper(ScreenMapper::instance()),
m_complete(false),
m_screenUsed(false)
m_complete(false)
{
//needed to pass the job around with qml
qmlRegisterType<KIO::DropJob>();
......@@ -625,7 +625,7 @@ QStringList FolderModel::filterMimeTypes() const
void FolderModel::setFilterMimeTypes(const QStringList &mimeList)
{
const QSet<QString> &set = QSet<QString>::fromList(mimeList);
const QSet<QString> set(mimeList.constBegin(), mimeList.constEnd());
if (m_mimeSet != set) {
......
......@@ -291,12 +291,12 @@ bool SortedActivitiesModel::lessThan(const QModelIndex &sourceLeft,
const QModelIndex &sourceRight) const
{
const auto activityLeft =
sourceModel()->data(sourceLeft, KActivities::ActivitiesModel::ActivityId);
sourceModel()->data(sourceLeft, KActivities::ActivitiesModel::ActivityId).toString();
const auto activityRight =
sourceModel()->data(sourceRight, KActivities::ActivitiesModel::ActivityId);
sourceModel()->data(sourceRight, KActivities::ActivitiesModel::ActivityId).toString();
const auto timeLeft = lastUsedTime(activityLeft.toString());
const auto timeRight = lastUsedTime(activityRight.toString());
const auto timeLeft = lastUsedTime(activityLeft);
const auto timeRight = lastUsedTime(activityRight);
return (timeLeft < timeRight) ||
(timeLeft == timeRight && activityLeft < activityRight);
......
......@@ -71,7 +71,7 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char * argv[])
int xkb_opcode;
if (!XkbQueryExtension(QX11Info::display(), &opcode_rtrn, &xkb_opcode, &error_rtrn,
&major, &minor)) {
qWarning() << "X server has not matching XKB extension" << endl;
qWarning() << "X server has not matching XKB extension" << Qt::endl;
return 1;
}
qDebug() << "X server XKB extension major=" << major << " minor=" << minor;
......
......@@ -449,7 +449,7 @@ void KAccessConfig::save()
// make kaccess reread the configuration
// turning a11y features off needs to be done by kaccess
// so run it to clear any enabled features and it will exit if it should
QProcess::startDetached(QStringLiteral("kaccess"));
QProcess::startDetached(QStringLiteral("kaccess"), {});
emit changed(false);
}
......
......@@ -217,6 +217,7 @@ Dialog::~Dialog()
void Dialog::showEvent(QShowEvent *event)
{
Q_UNUSED(event);
// Setting the focus
d->setFocus(d->tabGeneral);
}
......
......@@ -311,6 +311,7 @@ void PreviewWidget::hoverMoveEvent(QHoverEvent *e)
void PreviewWidget::hoverLeaveEvent(QHoverEvent *e)
{
Q_UNUSED(e);
if (QWindow *actualWindow = QQuickRenderControl::renderWindowFor(window())) {
actualWindow->unsetCursor();
}
......
......@@ -194,7 +194,7 @@ const QStringList CursorThemeModel::searchPaths()
#endif
// Separate the paths
baseDirs = path.split(':', QString::SkipEmptyParts);
baseDirs = path.split(':', Qt::SkipEmptyParts);
// Remove duplicates
QMutableStringListIterator i(baseDirs);
......
......@@ -218,7 +218,7 @@ void Dtime::load()
asia.pool.ntp.org,\
europe.pool.ntp.org,\
north-america.pool.ntp.org,\
oceania.pool.ntp.org")).split(',', QString::SkipEmptyParts));
oceania.pool.ntp.org")).split(',', Qt::SkipEmptyParts));
setDateTimeAuto->setChecked(config.readEntry("enabled", false));
if (ntpUtility.isEmpty()) {
......
......@@ -162,7 +162,7 @@ void KCMDesktopTheme::installTheme(const QString &path)
}
});
connect(myProcess, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
connect(myProcess, &QProcess::errorOccurred,
this, [this](QProcess::ProcessError e) {
qCWarning(KCM_DESKTOP_THEME) << "Theme installation failed: " << e;
Q_EMIT showErrorMessage(i18n("Theme installation failed."));
......@@ -221,7 +221,7 @@ bool KCMDesktopTheme::canEditThemes() const
void KCMDesktopTheme::editTheme(const QString &theme)
{
QProcess::startDetached(QStringLiteral("plasmathemeexplorer -t ") % theme);
QProcess::startDetached(QStringLiteral("plasmathemeexplorer"), {QStringLiteral("-t"), theme});
}
bool KCMDesktopTheme::isSaveNeeded() const
......
......@@ -109,7 +109,7 @@ static QDateTime getTimeStamp(const QString &item)
static QString getEntry(QDomElement element, const char *type, unsigned int numAttributes, ...)
{
if (numAttributes == element.attributes().length()) {
if (numAttributes == uint(element.attributes().length())) {
va_list args;
unsigned int arg;
bool ok = true;
......
......@@ -70,6 +70,7 @@ PreviewImageProvider::PreviewImageProvider(const QFont& font)
QImage PreviewImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
{
Q_UNUSED(requestedSize)
if (!KWindowSystem::isPlatformX11()) {
return QImage();
}
......
......@@ -400,7 +400,7 @@ void JoyDevice::calcCorrection(int axis, int *min, int *center, int *max)
<< corr[axis].coef[0] << ", "
<< corr[axis].coef[1] << ", "
<< corr[axis].coef[2] << ", "
<< corr[axis].coef[3] << endl;
<< corr[axis].coef[3] << Qt::endl;
}
//--------------------------------------------------------------
......@@ -114,7 +114,7 @@ JoyWidget::JoyWidget(QWidget *parent)
// calculate the column width we need
QFontMetrics fm(font());
int colWidth = qMax(fm.width(PRESSED), fm.width(QStringLiteral("-32767"))) + 10; // -32767 largest string
int colWidth = qMax(fm.horizontalAdvance(PRESSED), fm.horizontalAdvance(QStringLiteral("-32767"))) + 10; // -32767 largest string
vboxMid->addWidget(new QLabel(i18n("Buttons:")));
buttonTbl = new TableWidget(0, 1);
......
......@@ -313,7 +313,7 @@ void IconModule::exportToKDE4()
cachePathProcess->deleteLater();
});
cachePathProcess->start(QStringLiteral("kde4-config --path cache"));
cachePathProcess->start(QStringLiteral("kde4-config"), { QStringLiteral("--path"), QStringLiteral("cache")});
}
QStringList IconModule::findThemeDirs(const QString &archiveName)
......
......@@ -23,7 +23,7 @@
#include <kactioncollection.h>
struct Rules;
struct LayoutUnit;
class LayoutUnit;
template <typename T> class QList;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment