Skip to content

Commit

Permalink
Make Qt6 buildable
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Mar 16, 2024
1 parent c40fe52 commit a11c935
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/qite
2 changes: 1 addition & 1 deletion iris
4 changes: 4 additions & 0 deletions src/psirosterwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,11 @@ void PsiRosterWidget::setShowStatusMsg(bool enabled)
void PsiRosterWidget::filterEditTextChanged(const QString &text)
{
if (filterModel_)
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
filterModel_->setFilterRegExp(QRegularExpression::escape(text));
#else
filterModel_->setFilterRegularExpression(QRegularExpression::escape(text));
#endif
}

void PsiRosterWidget::quitFilteringMode() { setFilterModeEnabled(false); }
Expand Down
3 changes: 2 additions & 1 deletion src/shortcutmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <QAction>
#include <QCoreApplication>
#include <QWidget>

/**
* \brief The Construtor of the Shortcutmanager
Expand Down Expand Up @@ -127,7 +128,7 @@ void ShortcutManager::connect(const QString &path, QObject *parent, const char *
act->setShortcuts(shortcuts);
act->setShortcutContext(appWide ? Qt::ApplicationShortcut : Qt::WindowShortcut);
if (parent->isWidgetType())
static_cast<QWidget *>(parent)->addAction(act);
qobject_cast<QWidget *>(parent)->addAction(act);
parent->connect(act, SIGNAL(triggered()), slot);
}
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/svgiconengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ void SvgIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode
void SvgIconEngine::virtual_hook(int id, void *data)
{
switch (id) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
case QIconEngine::AvailableSizesHook:
reinterpret_cast<AvailableSizesArgument *>(data)->sizes.clear();
break;
case QIconEngine::IconNameHook:
*reinterpret_cast<QString *>(data) = name;
break;
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
case QIconEngine::IsNullHook:
*reinterpret_cast<bool *>(data) = !(renderer && renderer->isValid());
Expand Down
8 changes: 8 additions & 0 deletions src/tools/optionstree/optionstreemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,19 @@ bool OptionsTreeModel::setData(const QModelIndex &index, const QVariant &value,
}
QVariant current = tree_->getOption(option);
QVariant newval = value;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (!newval.canConvert(int(current.type()))) {
#else
if (!newval.canConvert(current.metaType())) {
#endif
qWarning("Sorry don't know how to do that!");
return false;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
newval.convert(int(current.type()));
#else
newval.convert(current.metaType());
#endif
tree_->setOption(option, newval);
return true;
}
Expand Down
4 changes: 4 additions & 0 deletions src/vcardfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ void VCardFactory::saveVCard(const Jid &j, const VCard &vcard, bool notifyPhoto)
QFile file(ApplicationInfo::vCardDir() + '/' + JIDUtil::encode(j.bare()).toLower() + ".xml");
file.open(QIODevice::WriteOnly);
QTextStream out(&file);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
out.setEncoding(QStringConverter::Utf8);
#else
out.setCodec("UTF-8");
#endif
QDomDocument doc;
doc.appendChild(vcard.toXml(&doc));
out << doc.toString(4);
Expand Down
4 changes: 1 addition & 3 deletions src/whiteboarding/wbitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,6 @@ QPointF WbItem::center()
**
****************************************************************************/

double qstrtod(const char *s00, char const **se, bool *ok);

static qreal toDouble(const QChar *&str)
{
const int maxLen = 255; // technically doubles can go til 308+ but whatever
Expand Down Expand Up @@ -499,7 +497,7 @@ static qreal toDouble(const QChar *&str)
#endif
{
bool ok = false;
val = qstrtod(temp, nullptr, &ok);
val = QByteArray::fromRawData(temp, pos).toDouble(&ok);
}
}
return val;
Expand Down

0 comments on commit a11c935

Please sign in to comment.