r24837 by jghali - More fixes for Qt6
scribus-commit
scribus-commit at lists.scribus.net
Sat Jan 29 22:11:36 UTC 2022
Author: jghali
Date: Sat Jan 29 22:11:36 2022
New Revision: 24837
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24837
Log:
More fixes for Qt6
Modified:
trunk/Scribus/scribus/pslib.cpp
trunk/Scribus/scribus/scimagecachemanager.cpp
trunk/Scribus/scribus/scribusview.cpp
trunk/Scribus/scribus/ui/charselectenhanced.cpp
trunk/Scribus/scribus/ui/hyask.cpp
trunk/Scribus/scribus/ui/javadocs.cpp
trunk/Scribus/scribus/ui/prefs_plugins.cpp
trunk/Scribus/scribus/ui/query.cpp
trunk/Scribus/scribus/ui/query.h
trunk/Scribus/scribus/ui/scrapbookpalette.cpp
trunk/Scribus/scribus/ui/splash.cpp
trunk/Scribus/scribus/undostate.cpp
trunk/Scribus/scribus/undostate.h
Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24837&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp (original)
+++ trunk/Scribus/scribus/pslib.cpp Sat Jan 29 22:11:36 2022
@@ -31,7 +31,7 @@
#include <QFontInfo>
#include <QList>
#include <QByteArray>
-#include <QRegExp>
+#include <QRegularExpression>
#include <QBuffer>
#include <QStack>
@@ -314,7 +314,7 @@
// Subset always now with new boxes code.
ScFace &face (allFonts[it.key()]);
QMap<uint, QString>& usedGlyphs(it.value());
- QString encodedName = face.psName().simplified().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" );
+ QString encodedName = face.psName().simplified().replace( QRegularExpression("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" );
// Handle possible PostScript name conflict in oft/ttf fonts
int psNameIndex = 1;
@@ -754,7 +754,7 @@
QString PSLib::PSEncode(const QString& in) const
{
- static QRegExp badchars("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]");
+ static QRegularExpression badchars("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]");
QString tmp(in.simplified().replace( badchars, "_" ));
return tmp;
}
Modified: trunk/Scribus/scribus/scimagecachemanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24837&path=/trunk/Scribus/scribus/scimagecachemanager.cpp
==============================================================================
--- trunk/Scribus/scribus/scimagecachemanager.cpp (original)
+++ trunk/Scribus/scribus/scimagecachemanager.cpp Sat Jan 29 22:11:36 2022
@@ -24,6 +24,7 @@
#include <QDir>
#include <QDirIterator>
#include <QFileInfo>
+#include <QRegularExpression>
#include <QTemporaryFile>
#include "sclockedfile.h"
@@ -543,8 +544,8 @@
}
}
- QRegExp reImg(ScImageCacheProxy::imageSuffix + "$");
- QRegExp reRef(ScImageCacheProxy::referenceSuffix + "$");
+ QRegularExpression reImg(ScImageCacheProxy::imageSuffix + "$");
+ QRegularExpression reRef(ScImageCacheProxy::referenceSuffix + "$");
QHash<QString, int>::iterator isi;
Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24837&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Sat Jan 29 22:11:36 2022
@@ -43,6 +43,7 @@
#include <QMimeData>
#include <QPixmap>
#include <QPolygon>
+#include <QRegularExpression>
#include <QStack>
#include <QStringList>
#include <QStyleOptionRubberBand>
@@ -976,9 +977,9 @@
if (loadRawText(url.toLocalFile(), file))
{
QString txt = codec->toUnicode( file.data() );
- txt.replace(QRegExp("\r"), QChar(13));
- txt.replace(QRegExp("\n"), QChar(13));
- txt.replace(QRegExp("\t"), QChar(9));
+ txt.replace(QRegularExpression("\r"), QChar(13));
+ txt.replace(QRegularExpression("\n"), QChar(13));
+ txt.replace(QRegularExpression("\t"), QChar(9));
item->itemText.insertChars(txt, true);
}
}
Modified: trunk/Scribus/scribus/ui/charselectenhanced.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24837&path=/trunk/Scribus/scribus/ui/charselectenhanced.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/charselectenhanced.cpp (original)
+++ trunk/Scribus/scribus/ui/charselectenhanced.cpp Sat Jan 29 22:11:36 2022
@@ -7,6 +7,7 @@
#include <QFileDialog>
#include <QMessageBox>
+#include <QRegularExpressionValidator>
#include "charselectenhanced.h"
#include "fonts/scface.h"
@@ -28,7 +29,7 @@
m_charTable->setDragEnabled(true);
// insert hex codes directly
- QValidator* insValidator = new QRegExpValidator(QRegExp("[A-F,a-f,0-9]{4}"), this);
+ QValidator* insValidator = new QRegularExpressionValidator(QRegularExpression("[A-F,a-f,0-9]{4}"), this);
hexLineEdit->setValidator(insValidator);
// signals and slots connections
Modified: trunk/Scribus/scribus/ui/hyask.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24837&path=/trunk/Scribus/scribus/ui/hyask.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/hyask.cpp (original)
+++ trunk/Scribus/scribus/ui/hyask.cpp Sat Jan 29 22:11:36 2022
@@ -5,14 +5,15 @@
for which a new license (GPL+exception) is in place.
*/
#include "hyask.h"
+
+#include <QCheckBox>
+#include <QKeyEvent>
+#include <QLabel>
#include <QPixmap>
-#include <QRegExp>
+#include <QRegularExpression>
#include <QHBoxLayout>
#include <QVBoxLayout>
-#include <QKeyEvent>
#include <QPushButton>
-#include <QCheckBox>
-#include <QLabel>
#include "iconmanager.h"
@@ -142,7 +143,7 @@
{
disconnect ( Wort, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( Check() ) );
QString in = Wort->text();
- QString out = in.replace ( QRegExp ( "(-)+" ), "-" );
+ QString out = in.replace ( QRegularExpression ( "(-)+" ), "-" );
Wort->setText ( out );
addToExceptionList->setEnabled(true);
addToExceptionListText->setEnabled(true);
@@ -153,7 +154,7 @@
{
disconnect ( Wort, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( Check() ) );
QString in = Wort->text();
- QString out = in.replace ( QRegExp ( "(-)+" ), "" );
+ QString out = in.replace ( QRegularExpression ( "(-)+" ), "" );
Wort->setText ( out );
accept();
}
Modified: trunk/Scribus/scribus/ui/javadocs.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24837&path=/trunk/Scribus/scribus/ui/javadocs.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/javadocs.cpp (original)
+++ trunk/Scribus/scribus/ui/javadocs.cpp Sat Jan 29 22:11:36 2022
@@ -89,7 +89,7 @@
return;
QString nam = dia.getEditText();
- nam.replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%\\.]"), "_" );
+ nam.replace( QRegularExpression("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%\\.]"), "_" );
std::unique_ptr<Editor> dia2(new Editor(this, "", m_View));
dia2->EditTex->setText("function "+nam+"()\n{\n}");
Modified: trunk/Scribus/scribus/ui/prefs_plugins.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24837&path=/trunk/Scribus/scribus/ui/prefs_plugins.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_plugins.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_plugins.cpp Sat Jan 29 22:11:36 2022
@@ -9,6 +9,8 @@
#include <QCheckBox>
#include <QLabel>
+#include <QRegularExpression>
+
#include "ui/scmwmenumanager.h"
#include "pluginmanager.h"
#include "scraction.h"
@@ -58,18 +60,19 @@
ScActionPlugin::ActionInfo ai(ixplug->actionInfo());
// menu path
QString men;
+ QRegularExpression regExp("&(?!&)");
if (!ai.parentMenu.isEmpty())
{
if (scMW->scrMenuMgr->menuExists(ai.parentMenu))
- men = scMW->scrMenuMgr->getLocalPopupMenu(ai.parentMenu)->title().remove(QRegExp("&(?!&)")) + " -> ";
+ men = scMW->scrMenuMgr->getLocalPopupMenu(ai.parentMenu)->title().remove(regExp) + " -> ";
}
if (scMW->scrMenuMgr->menuExists(ai.menu))
{
QMenu *m = scMW->scrMenuMgr->getLocalPopupMenu(ai.menu);
if (m)
- men += m->title().remove(QRegExp("&(?!&)")) + " -> ";
+ men += m->title().remove(regExp) + " -> ";
}
- i1->setText(men + QString("%1").arg(scMW->scrActions[ai.name]->text().remove(QRegExp("&(?!&)"))));
+ i1->setText(men + QString("%1").arg(scMW->scrActions[ai.name]->text().remove(regExp)));
}
pluginTable->setItem(i, 1, i1);
Modified: trunk/Scribus/scribus/ui/query.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24837&path=/trunk/Scribus/scribus/ui/query.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/query.cpp (original)
+++ trunk/Scribus/scribus/ui/query.cpp Sat Jan 29 22:11:36 2022
@@ -5,6 +5,7 @@
for which a new license (GPL+exception) is in place.
*/
#include "query.h"
+
#include <QPixmap>
#include <QLabel>
#include <QLineEdit>
@@ -12,7 +13,8 @@
#include <QMessageBox>
#include <QRegExp>
#include <QValidator>
-#include <QRegExpValidator>
+#include <QRegularExpressionValidator>
+
#include "commonstrings.h"
#include "ui/scmessagebox.h"
#include "iconmanager.h"
@@ -127,8 +129,8 @@
checkMode = mode;
}
-void Query::setValidator(const QRegExp& rx)
+void Query::setValidator(const QRegularExpression& rx)
{
- QValidator* vaild = new QRegExpValidator( rx, this );
+ QValidator* vaild = new QRegularExpressionValidator( rx, this );
answerEdit->setValidator(vaild);
}
Modified: trunk/Scribus/scribus/ui/query.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24837&path=/trunk/Scribus/scribus/ui/query.h
==============================================================================
--- trunk/Scribus/scribus/ui/query.h (original)
+++ trunk/Scribus/scribus/ui/query.h Sat Jan 29 22:11:36 2022
@@ -11,9 +11,11 @@
#include <QVBoxLayout>
#include <QGridLayout>
#include <QHBoxLayout>
+
class QLabel;
class QLineEdit;
class QPushButton;
+class QRegularExpression;
class QString;
#include "scribusapi.h"
@@ -31,7 +33,7 @@
void setTestList(const QStringList& tList);
void setForbiddenList(const QStringList& tList);
void setCheckMode(bool mode);
- void setValidator(const QRegExp& rx);
+ void setValidator(const QRegularExpression& rx);
public slots:
void Leave();
Modified: trunk/Scribus/scribus/ui/scrapbookpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24837&path=/trunk/Scribus/scribus/ui/scrapbookpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrapbookpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/scrapbookpalette.cpp Sat Jan 29 22:11:36 2022
@@ -27,6 +27,7 @@
#include <QPainter>
#include <QPixmap>
#include <QProgressDialog>
+#include <QRegularExpression>
#include <QSet>
#include <QSignalMapper>
#include <QSpacerItem>
@@ -1237,7 +1238,7 @@
if (bv->objectMap.contains(nam))
{
Query dia(this, "tt", 1, tr("&Name:"), tr("New Entry"));
- dia.setValidator(QRegExp("[\\w()]+"));
+ dia.setValidator(QRegularExpression("[\\w()]+"));
dia.setEditText(nam, true);
dia.setTestList(activeBView->objectMap.keys());
if (dia.exec())
@@ -1430,7 +1431,7 @@
QListWidgetItem *ite = actItem;
QString oldName = ite->text();
Query dia(this, "tt", 1, tr("&Name:"), tr("New Name"));
- dia.setValidator(QRegExp("[\\w()]+"));
+ dia.setValidator(QRegularExpression("[\\w()]+"));
dia.setEditText(ite->text(), true);
dia.setTestList(activeBView->objectMap.keys());
if (dia.exec())
@@ -1622,7 +1623,7 @@
nam += "("+ tmp.setNum(m_tempCount) + ")";
}
Query dia(this, "tt", true, tr("&Name:"), tr("New Entry"));
- dia.setValidator(QRegExp("[\\w()]+"));
+ dia.setValidator(QRegularExpression("[\\w()]+"));
dia.setEditText(nam, true);
dia.setTestList(activeBView->objectMap.keys());
if (dia.exec())
@@ -1750,7 +1751,7 @@
nam += "("+ tmp.setNum(m_tempCount) + ")";
}
Query dia(this, "tt", 1, tr("&Name:"), tr("New Entry"));
- dia.setValidator(QRegExp("[\\w()]+"));
+ dia.setValidator(QRegularExpression("[\\w()]+"));
dia.setEditText(nam, true);
dia.setTestList(activeBView->objectMap.keys());
if (dia.exec())
@@ -1922,7 +1923,7 @@
if (actBView->objectMap.contains(nam))
nam += "("+ tmp.setNum(m_tempCount) + ")";
Query dia(this, "tt", 1, tr("&Name:"), tr("New Entry"));
- dia.setValidator(QRegExp("[\\w()]+"));
+ dia.setValidator(QRegularExpression("[\\w()]+"));
dia.setEditText(nam, true);
dia.setTestList(activeBView->objectMap.keys());
if (dia.exec())
Modified: trunk/Scribus/scribus/ui/splash.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24837&path=/trunk/Scribus/scribus/ui/splash.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/splash.cpp (original)
+++ trunk/Scribus/scribus/ui/splash.cpp Sat Jan 29 22:11:36 2022
@@ -10,7 +10,7 @@
#include <QPainter>
#include <QPalette>
#include <QPixmap>
-#include <QRegExp>
+#include <QRegularExpression>
#include "scconfig.h"
@@ -36,9 +36,9 @@
void ScSplashScreen::setStatus( const QString &message )
{
- static QRegExp rx("&\\S*");
+ static QRegularExpression rx("&\\S*");
QString tmp(message);
- int f = 0;
+ qsizetype f = 0;
while (f != -1)
{
f = tmp.indexOf(rx);
Modified: trunk/Scribus/scribus/undostate.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24837&path=/trunk/Scribus/scribus/undostate.cpp
==============================================================================
--- trunk/Scribus/scribus/undostate.cpp (original)
+++ trunk/Scribus/scribus/undostate.cpp Sat Jan 29 22:11:36 2022
@@ -139,11 +139,31 @@
return ret;
}
+int64_t SimpleState::getInt64(const QString& key, int64_t def) const
+{
+ bool ok = false;
+ QVariant retVar = variant(key, QVariant(def));
+ int ret = retVar.toLongLong(&ok);
+ if (!ok)
+ ret = def;
+ return ret;
+}
+
uint SimpleState::getUInt(const QString& key, uint def) const
{
bool ok = false;
QVariant retVar = variant(key, QVariant(def));
uint ret = retVar.toUInt(&ok);
+ if (!ok)
+ ret = def;
+ return ret;
+}
+
+uint64_t SimpleState::getUInt64(const QString& key, uint64_t def) const
+{
+ bool ok = false;
+ QVariant retVar = variant(key, QVariant(def));
+ uint64_t ret = retVar.toULongLong(&ok);
if (!ok)
ret = def;
return ret;
@@ -189,7 +209,17 @@
m_values[key] = QVariant(value);
}
+void SimpleState::set(const QString& key, int64_t value)
+{
+ m_values[key] = QVariant(value);
+}
+
void SimpleState::set(const QString& key, uint value)
+{
+ m_values[key] = QVariant(value);
+}
+
+void SimpleState::set(const QString& key, uint64_t value)
{
m_values[key] = QVariant(value);
}
Modified: trunk/Scribus/scribus/undostate.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24837&path=/trunk/Scribus/scribus/undostate.h
==============================================================================
--- trunk/Scribus/scribus/undostate.h (original)
+++ trunk/Scribus/scribus/undostate.h Sat Jan 29 22:11:36 2022
@@ -27,6 +27,7 @@
#ifndef UNDOSTATE_H
#define UNDOSTATE_H
+#include <cstdint>
#include <vector>
#include <QMap>
@@ -196,21 +197,55 @@
int getInt(const QString& key, int def = 0) const;
/**
- * @brief Returns the uint value attached to the key.
- *
- * Values are stored as <code>QString</code>s in the map and when queried
- * with this method value attached to the key is converted to an int. If
+ * @brief Returns the int value attached to the key.
+ *
+ * Values are stored as <code>QString</code>s in the map and when queried
+ * with this method value attached to the key is converted to an int64_t. If
* the conversion fails value of the parameter <code>def</code> will be returned.
* If key is not found from the map it will be added there with the
* value given as a parameter <code>def</code>. In such case <code>def</code>
* will also be returned.
* @param key Key that is searched from the map
* @param def Default value to be used if key is not found from the map
+ * @return <code>int64_t</code> value attached to the key in the map. If the key is not found
+ * from the map it will be added with the value described in the param
+ * <code>def</code> which is then returned.
+ */
+ int64_t getInt64(const QString& key, int64_t def = 0) const;
+
+ /**
+ * @brief Returns the uint value attached to the key.
+ *
+ * Values are stored as <code>QString</code>s in the map and when queried
+ * with this method value attached to the key is converted to an int. If
+ * the conversion fails value of the parameter <code>def</code> will be returned.
+ * If key is not found from the map it will be added there with the
+ * value given as a parameter <code>def</code>. In such case <code>def</code>
+ * will also be returned.
+ * @param key Key that is searched from the map
+ * @param def Default value to be used if key is not found from the map
* @return <code>uint</code> value attached to the key in the map. If the key is not found
* from the map it will be added with the value described in the param
* <code>def</code> which is then returned.
*/
uint getUInt(const QString& key, uint def = 0) const;
+
+ /**
+ * @brief Returns the uint64_t value attached to the key.
+ *
+ * Values are stored as <code>QString</code>s in the map and when queried
+ * with this method value attached to the key is converted to an uint64_t. If
+ * the conversion fails value of the parameter <code>def</code> will be returned.
+ * If key is not found from the map it will be added there with the
+ * value given as a parameter <code>def</code>. In such case <code>def</code>
+ * will also be returned.
+ * @param key Key that is searched from the map
+ * @param def Default value to be used if key is not found from the map
+ * @return <code>uint64_t</code> value attached to the key in the map. If the key is not found
+ * from the map it will be added with the value described in the param
+ * <code>def</code> which is then returned.
+ */
+ uint64_t getUInt64(const QString& key, uint64_t def = 0) const;
/**
* @brief Returns the double value attached to the key.
@@ -286,7 +321,21 @@
* @param key Key that can be later used to query the value.
* @param value Value attached to the key.
*/
+ void set(const QString& key, int64_t value);
+
+ /**
+ * @brief Set a value for the key.
+ * @param key Key that can be later used to query the value.
+ * @param value Value attached to the key.
+ */
void set(const QString& key, uint value);
+
+ /**
+ * @brief Set a value for the key.
+ * @param key Key that can be later used to query the value.
+ * @param value Value attached to the key.
+ */
+ void set(const QString& key, uint64_t value);
/**
* @brief Set a value for the key.
More information about the scribus-commit
mailing list