Revamp Shared Memory Example: Change the used QSharedMemory constructor

Use QSharedMemory(const QNativeIpcKey &key) constructor to port away
from the deprecated QSharedMemory(const QString &) constructor.

Task-number: QTBUG-108858
Pick-to: 6.6
Change-Id: I05615100f77f571fe32a3cf627c3df46baaa7f7a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Rym Bouabid 2023-09-11 18:24:56 +02:00
parent 0a62d4e4c0
commit 976f30dc59

View File

@ -5,6 +5,9 @@
#include <QBuffer>
#include <QFileDialog>
#include <QNativeIpcKey>
using namespace Qt::StringLiterals;
/*!
\class Dialog
@ -30,8 +33,9 @@
each button.
*/
//! [0]
Dialog::Dialog(QWidget *parent)
: QDialog(parent), sharedMemory("QSharedMemoryExample")
: QDialog(parent), sharedMemory(QNativeIpcKey(u"QSharedMemoryExample"_s))
{
ui.setupUi(this);
connect(ui.loadFromFileButton, &QPushButton::clicked,