Commit 785fedbe authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark Committed by Kurt Hindenburg
Browse files

fix deprecated qset warnings

parent 3fae1fc4
......@@ -549,8 +549,13 @@ bool MainWindow::queryClose()
// Check what processes are running, excluding the shell
QStringList processesRunning;
// Once Qt5.14+ is the mininum, change to use range constructors
const auto uniqueSessions = QSet<Session*>::fromList(_viewManager->sessions());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
// Need to make a local copy so the begin() and end() point to the same QList
const QList<Session*> sessionList = _viewManager->sessions();
const QSet<Session*> uniqueSessions(sessionList.begin(), sessionList.end());
#else
const QSet<Session*> uniqueSessions = QSet<Session*>::fromList(_viewManager->sessions());
#endif
for (Session *session : uniqueSessions) {
if ((session == nullptr) || !session->isForegroundProcessActive()) {
......
......@@ -131,8 +131,13 @@ QSet<QString> ProcessInfo::commonDirNames()
if (forTheFirstTime) {
const KSharedConfigPtr &config = KSharedConfig::openConfig();
const KConfigGroup &configGroup = config->group("ProcessInfo");
// Once Qt5.14+ is the mininum, change to use range constructors
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
// Need to make a local copy so the begin() and end() point to the same QList
const QStringList commonDirsList = configGroup.readEntry("CommonDirNames", QStringList());
_commonDirNames = QSet<QString>(commonDirsList.begin(), commonDirsList.end());
#else
_commonDirNames = QSet<QString>::fromList(configGroup.readEntry("CommonDirNames", QStringList()));
#endif
forTheFirstTime = false;
}
......
......@@ -309,8 +309,7 @@ void ProfileManager::saveSettings()
QList<Profile::Ptr> ProfileManager::sortedFavorites()
{
// Once Qt5.14+ is the mininum, change to use range constructors
QList<Profile::Ptr> favorites = findFavorites().toList();
QList<Profile::Ptr> favorites = findFavorites().values();
sortProfiles(favorites);
return favorites;
......@@ -320,14 +319,12 @@ QList<Profile::Ptr> ProfileManager::allProfiles()
{
loadAllProfiles();
// Once Qt5.14+ is the mininum, change to use range constructors
return _profiles.toList();
return _profiles.values();
}
QList<Profile::Ptr> ProfileManager::loadedProfiles() const
{
// Once Qt5.14+ is the mininum, change to use range constructors
return _profiles.toList();
return _profiles.values();
}
Profile::Ptr ProfileManager::defaultProfile() const
......@@ -643,9 +640,12 @@ void ProfileManager::loadFavorites()
QSet<QString> favoriteSet;
if (favoriteGroup.hasKey("Favorites")) {
QStringList list = favoriteGroup.readEntry("Favorites", QStringList());
// Once Qt5.14+ is the mininum, change to use range constructors
const QStringList list = favoriteGroup.readEntry("Favorites", QStringList());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
favoriteSet = QSet<QString>(list.begin(), list.end());
#else
favoriteSet = QSet<QString>::fromList(list);
#endif
}
// look for favorites among those already loaded
......
......@@ -1058,9 +1058,12 @@ void SessionController::copyInputToAllTabs()
// Find our window ...
const KXmlGuiWindow* myWindow = findWindow(_view);
// Once Qt5.14+ is the mininum, change to use range constructors
QSet<Session*> group =
QSet<Session*>::fromList(SessionManager::instance()->sessions());
const QList<Session *> sessionsList = SessionManager::instance()->sessions();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QSet<Session*> group(sessionsList.begin(), sessionsList.end());
#else
QSet<Session*> group = QSet<Session*>::fromList(sessionsList);
#endif
for (auto session : group) {
// First, ensure that the session is removed
// (necessary to avoid duplicates on addSession()!)
......@@ -1090,8 +1093,13 @@ void SessionController::copyInputToSelectedTabs()
QPointer<CopyInputDialog> dialog = new CopyInputDialog(_view);
dialog->setMasterSession(_session);
// Once Qt5.14+ is the mininum, change to use range constructors
QSet<Session*> currentGroup = QSet<Session*>::fromList(_copyToGroup->sessions());
const QList<Session*> sessionsList = _copyToGroup->sessions();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QSet<Session*> currentGroup(sessionsList.begin(), sessionsList.end());
#else
QSet<Session*> currentGroup = QSet<Session*>::fromList(sessionsList);
#endif
currentGroup.remove(_session);
dialog->setChosenSessions(currentGroup);
......@@ -1129,8 +1137,13 @@ void SessionController::copyInputToNone()
}
// Once Qt5.14+ is the mininum, change to use range constructors
QSet<Session*> group =
QSet<Session*>::fromList(SessionManager::instance()->sessions());
const QList<Session*> groupList = SessionManager::instance()->sessions();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QSet<Session*> group(groupList.begin(), groupList.end());
#else
QSet<Session*> group = QSet<Session*>::fromList(groupList);
#endif
for (auto iterator : group) {
Session* session = iterator;
......
......@@ -88,7 +88,6 @@ ViewSplitter *ViewSplitter::activeSplitter()
void ViewSplitter::updateSizes()
{
const int space = (orientation() == Qt::Horizontal ? width() : height()) / count();
// Once Qt5.14+ is the mininum, change to use range constructors
setSizes(QVector<int>(count(), space).toList());
}
......
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