Added Qt dependent macro for QString::SkipEmptyParts/Qt::SkipEmptyParts

This commit is contained in:
thunder2 2025-07-19 23:17:29 +02:00
parent f38b72e7a3
commit e2e1a431ff
11 changed files with 23 additions and 17 deletions

View file

@ -898,7 +898,7 @@ void SearchDialog::searchKeywords(const QString& keywords)
if (keywords.length() < 3)
return ;
QStringList qWords = keywords.split(" ", QString::SkipEmptyParts);
QStringList qWords = keywords.split(" ", QtSkipEmptyParts);
std::list<std::string> words;
QStringListIterator qWordsIter(qWords);
while (qWordsIter.hasNext())
@ -1236,7 +1236,7 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
int friendSource = 0;
int anonymousSource = 0;
QString resultCount = it->text(SR_SOURCES_COL);
QStringList modifiedResultCount = resultCount.split("/", QString::SkipEmptyParts);
QStringList modifiedResultCount = resultCount.split("/", QtSkipEmptyParts);
if(searchType == FRIEND_SEARCH)
{
friendSource = modifiedResultCount.at(0).toInt() + 1;

View file

@ -1619,7 +1619,7 @@ void SharedFilesDialog::FilterItems()
return ;
//FileSearchFlags flags = isRemote()?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
QStringList lst = text.split(" ",QString::SkipEmptyParts) ;
QStringList lst = text.split(" ",QtSkipEmptyParts) ;
std::list<std::string> keywords ;
for(auto it(lst.begin());it!=lst.end();++it)

View file

@ -45,6 +45,7 @@
#include "util/DateTime.h"
#include "util/qtthreadsutils.h"
#include "gui/common/FilesDefs.h"
#include "util/QtVersion.h"
#include "gui/MainWindow.h"
@ -417,7 +418,7 @@ void PostedListWidgetWithModel::updateShowLabel()
void PostedListWidgetWithModel::filterItems(QString text)
{
QStringList lst = text.split(" ",QString::SkipEmptyParts) ;
QStringList lst = text.split(" ",QtSkipEmptyParts) ;
uint32_t count;
mPostedPostsModel->setFilter(lst,count) ;

View file

@ -20,6 +20,7 @@
* *
*******************************************************************************/
#include "expressionwidget.h"
#include "util/QtVersion.h"
ExpressionWidget::ExpressionWidget(QWidget * parent, bool initial)
: QWidget(parent)
@ -109,11 +110,7 @@ RsRegularExpression::Expression* ExpressionWidget::getRsExpression()
if (isStringSearchExpression())
{
QString txt = exprParamElem->getStrSearchValue();
#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
QStringList words = txt.split(" ", QString::SkipEmptyParts);
#else
QStringList words = txt.split(" ", Qt::SkipEmptyParts);
#endif
QStringList words = txt.split(" ", QtSkipEmptyParts);
for (int i = 0; i < words.size(); ++i)
wordList.push_back(words.at(i).toUtf8().constData());
} else if (inRangedConfig){

View file

@ -1673,7 +1673,7 @@ void NewFriendList::setShowGroups(bool show)
*/
void NewFriendList::filterItems(const QString &text)
{
QStringList lst = text.split(' ',QString::SkipEmptyParts);
QStringList lst = text.split(' ',QtSkipEmptyParts);
int filterColumn = ui->filterLineEdit->currentFilter();
if(filterColumn == 0)

View file

@ -41,6 +41,7 @@
#include "util/DateTime.h"
#include "util/qtthreadsutils.h"
#include "gui/common/FilesDefs.h"
#include "util/QtVersion.h"
#include "GxsChannelPostsWidgetWithModel.h"
#include "GxsChannelPostsModel.h"
@ -1454,7 +1455,7 @@ void GxsChannelPostsWidgetWithModel::switchOnlyUnread(bool)
}
void GxsChannelPostsWidgetWithModel::filterChanged(QString s)
{
QStringList ql = s.split(' ',QString::SkipEmptyParts);
QStringList ql = s.split(' ',QtSkipEmptyParts);
uint32_t count;
mChannelPostsModel->setFilter(ql,ui->showUnread_TB->isChecked(),count);
mChannelFilesModel->setFilter(ql,count);

View file

@ -1846,7 +1846,7 @@ void GxsForumThreadWidget::filterColumnChanged(int column)
void GxsForumThreadWidget::filterItems(const QString& text)
{
QStringList lst = text.split(" ",QString::SkipEmptyParts) ;
QStringList lst = text.split(" ",QtSkipEmptyParts) ;
int filterColumn = ui->filterLineEdit->currentFilter();

View file

@ -640,7 +640,7 @@ void MessageWidget::fill(const std::string &msgId)
ui.trans_ToText->setText(to_text);
int recipientsCount = ui.trans_ToText->toPlainText().split(QRegExp("(\\s|\\n|\\r)+"), QString::SkipEmptyParts).count();
int recipientsCount = ui.trans_ToText->toPlainText().split(QRegExp("(\\s|\\n|\\r)+"), QtSkipEmptyParts).count();
ui.expandButton->setText( QString::number(recipientsCount)+ " " + tr("more"));
if (recipientsCount >=20) {

View file

@ -1246,7 +1246,7 @@ void MessagesDialog::undeletemessage()
void MessagesDialog::filterChanged(const QString& text)
{
QStringList items = text.split(' ',QString::SkipEmptyParts);
QStringList items = text.split(' ',QtSkipEmptyParts);
RsMessageModel::FilterType f = RsMessageModel::FILTER_TYPE_NONE;
@ -1287,7 +1287,7 @@ void MessagesDialog::filterColumnChanged(int column)
default:break;
}
QStringList items = ui.filterLineEdit->text().split(' ',QString::SkipEmptyParts);
QStringList items = ui.filterLineEdit->text().split(' ',QtSkipEmptyParts);
mMessageModel->setFilter(f,items);
mMessageProxyModel->setFilterRegExp(QRegExp(RsMessageModel::FilterString)); // this triggers the update of the proxy model

View file

@ -31,6 +31,7 @@
#include "gui/RetroShareLink.h"
#include "util/ObjectPainter.h"
#include "util/imageutil.h"
#include "util/QtVersion.h"
#include "util/rsdebug.h"
#include "util/rstime.h"
@ -1252,7 +1253,7 @@ QString RsHtml::makeQuotedText(RSTextBrowser *browser)
{
text = browser->toPlainText();
}
QStringList sl = text.split(QRegExp("[\r\n]"),QString::SkipEmptyParts);
QStringList sl = text.split(QRegExp("[\r\n]"),QtSkipEmptyParts);
text = sl.join("\n> ");
text.replace("\n> >","\n>>"); // Don't add space for already quotted lines.
text.replace(QChar(-4)," ");//Char used when image on text.

View file

@ -21,7 +21,7 @@
#ifndef QTVERSION_H
#define QTVERSION_H
// Macros to compile with Qt 4 and Qt 5
// Macros to compile with Qt 4, Qt 5 and Qt 6
// Renamed QHeaderView::setResizeMode to QHeaderView::setSectionResizeMode
#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
@ -43,4 +43,10 @@
#define QHeaderView_setSectionsMovable(header, movable) header->setMovable(movable);
#endif
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
#define QtSkipEmptyParts Qt::SkipEmptyParts
#else
#define QtSkipEmptyParts QString::SkipEmptyParts
#endif
#endif