r23671 by jghali - Fix several incorrect changes: we cannot return references to local or temporary variables

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 26 22:50:12 UTC 2020


Author: jghali
Date: Sun Apr 26 22:50:12 2020
New Revision: 23671

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23671
Log:
Fix several incorrect changes: we cannot return references to local or temporary variables

Modified:
    trunk/Scribus/scribus/ui/inspage.cpp
    trunk/Scribus/scribus/ui/inspage.h
    trunk/Scribus/scribus/ui/mergedoc.cpp
    trunk/Scribus/scribus/ui/mergedoc.h
    trunk/Scribus/scribus/ui/query.cpp
    trunk/Scribus/scribus/ui/query.h
    trunk/Scribus/scribus/ui/replaceonecolor.cpp
    trunk/Scribus/scribus/ui/replaceonecolor.h

Modified: trunk/Scribus/scribus/ui/inspage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23671&path=/trunk/Scribus/scribus/ui/inspage.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/inspage.cpp	(original)
+++ trunk/Scribus/scribus/ui/inspage.cpp	Sun Apr 26 22:50:12 2020
@@ -345,7 +345,7 @@
 	}
 }
 
-const QStringList& InsPage::getMasterPages()
+QStringList InsPage::getMasterPages() const
 {
 	QStringList ret;
 	for (int n = 0; n < masterPageCombos.count(); ++n)
@@ -357,7 +357,7 @@
 	return ret;
 }
 
-const QString& InsPage::getMasterPageN(uint n)
+QString InsPage::getMasterPageN(uint n) const
 {
 	QComboBox* comboBox = masterPageCombos.at(n);
 	int currentIndex = comboBox->currentIndex();

Modified: trunk/Scribus/scribus/ui/inspage.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23671&path=/trunk/Scribus/scribus/ui/inspage.h
==============================================================================
--- trunk/Scribus/scribus/ui/inspage.h	(original)
+++ trunk/Scribus/scribus/ui/inspage.h	Sun Apr 26 22:50:12 2020
@@ -34,8 +34,8 @@
 
 	QString prefsPageSizeName;
 
-	const QStringList &getMasterPages();
-	const QString &getMasterPageN(uint n);
+	QStringList getMasterPages() const;
+	QString getMasterPageN(uint n) const;
 	int getWhere() const;
 	int getWherePage() const;
 	int getCount() const;

Modified: trunk/Scribus/scribus/ui/mergedoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23671&path=/trunk/Scribus/scribus/ui/mergedoc.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/mergedoc.cpp	(original)
+++ trunk/Scribus/scribus/ui/mergedoc.cpp	Sun Apr 26 22:50:12 2020
@@ -217,12 +217,12 @@
 	}
 }
 
-const QString& MergeDoc::getFromDoc()
+QString MergeDoc::getFromDoc() const
 {
 	return QDir::fromNativeSeparators(fromDocData->text());
 }
 
-const QStringList& MergeDoc::getMasterPageNames() const
+QStringList MergeDoc::getMasterPageNames() const
 {
 	QStringList result;
 	for (const auto item : masterPageNameData->selectedItems())
@@ -238,27 +238,27 @@
 	return result;
 }
 
-int MergeDoc::getImportWhere()
+int MergeDoc::getImportWhere() const
 {
 	return importWhereData->currentIndex();
 }
 
-int MergeDoc::getImportWherePage()
+int MergeDoc::getImportWherePage() const
 {
 	return importWherePageData->value();
 }
 
-bool MergeDoc::getCreatePageChecked()
+bool MergeDoc::getCreatePageChecked() const
 {
 	return createPageData->isChecked();
 }
 
-const QString& MergeDoc::getPageNumbers()
+QString MergeDoc::getPageNumbers() const
 {
 	return pageNumberData->text();
 }
 
-int MergeDoc::getPageCounter()
+int MergeDoc::getPageCounter() const
 {
 	return count;
 }

Modified: trunk/Scribus/scribus/ui/mergedoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23671&path=/trunk/Scribus/scribus/ui/mergedoc.h
==============================================================================
--- trunk/Scribus/scribus/ui/mergedoc.h	(original)
+++ trunk/Scribus/scribus/ui/mergedoc.h	Sun Apr 26 22:50:12 2020
@@ -34,14 +34,14 @@
 	MergeDoc( QWidget* parent, bool importMasterPages, int targetDocPageCount = -1, int currentPage = 1 );
 	~MergeDoc();
 
-	const QString &getFromDoc();
-	const QStringList &getMasterPageNames() const;
+	QString getFromDoc() const;
+	QStringList getMasterPageNames() const;
 	QList<int> getMasterPageIndexes() const;
-	int getImportWhere();
-	int getImportWherePage();
-	bool getCreatePageChecked();
-	const QString &getPageNumbers();
-	int getPageCounter();
+	int getImportWhere() const;
+	int getImportWherePage() const;
+	bool getCreatePageChecked() const;
+	QString getPageNumbers() const;
+	int getPageCounter() const;
 
 private:
 	QLabel* fromDocLabel {nullptr};

Modified: trunk/Scribus/scribus/ui/query.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23671&path=/trunk/Scribus/scribus/ui/query.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/query.cpp	(original)
+++ trunk/Scribus/scribus/ui/query.cpp	Sun Apr 26 22:50:12 2020
@@ -100,7 +100,7 @@
 		accept();
 }
 
-const QString& Query::getEditText()
+QString Query::getEditText() const
 {
 	return answerEdit->text();
 }

Modified: trunk/Scribus/scribus/ui/query.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23671&path=/trunk/Scribus/scribus/ui/query.h
==============================================================================
--- trunk/Scribus/scribus/ui/query.h	(original)
+++ trunk/Scribus/scribus/ui/query.h	Sun Apr 26 22:50:12 2020
@@ -26,7 +26,7 @@
 	Query(QWidget* parent=0, const char* name=nullptr, bool modal = false, const QString& text=0, const QString& titel=0 );
 	~Query() {};
 
-	const QString &getEditText();
+	QString getEditText() const;
 	void setEditText(const QString& newText, bool setSelected);
 	void setTestList(const QStringList& tList);
 	void setForbiddenList(const QStringList& tList);

Modified: trunk/Scribus/scribus/ui/replaceonecolor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23671&path=/trunk/Scribus/scribus/ui/replaceonecolor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/replaceonecolor.cpp	(original)
+++ trunk/Scribus/scribus/ui/replaceonecolor.cpp	Sun Apr 26 22:50:12 2020
@@ -39,12 +39,12 @@
 	replacementColor->setColors(availableColors, true);
 }
 
-const QString& replaceColorDialog::getOriginalColor()
+QString replaceColorDialog::getOriginalColor() const
 {
 	return originalColor->currentText();
 }
 
-const QString& replaceColorDialog::getReplacementColor()
+QString replaceColorDialog::getReplacementColor() const
 {
 	return replacementColor->currentText();
 }

Modified: trunk/Scribus/scribus/ui/replaceonecolor.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23671&path=/trunk/Scribus/scribus/ui/replaceonecolor.h
==============================================================================
--- trunk/Scribus/scribus/ui/replaceonecolor.h	(original)
+++ trunk/Scribus/scribus/ui/replaceonecolor.h	Sun Apr 26 22:50:12 2020
@@ -39,8 +39,9 @@
 public:
 	replaceColorDialog(QWidget* parent, ColorList &availableColors, ColorList &usedColors);
 	~replaceColorDialog() {};
-	const QString& getOriginalColor();
-	const QString& getReplacementColor();
+
+	QString getOriginalColor() const;
+	QString getReplacementColor() const;
 	void setReplacementColor(const QString& color);
 	void setOriginalColor(const QString& color);
 };




More information about the scribus-commit mailing list