diff --git a/src/musredit_qt6/musredit/PTextEdit.cpp b/src/musredit_qt6/musredit/PTextEdit.cpp index 48a8f9b2..a778fd00 100644 --- a/src/musredit_qt6/musredit/PTextEdit.cpp +++ b/src/musredit_qt6/musredit/PTextEdit.cpp @@ -109,11 +109,11 @@ PTextEdit::PTextEdit( QWidget *parent ) // enable file system watcher. Needed to get notification if the msr-file is changed outside of musrfit at runtime fFileSystemWatcherActive = true; - fFileSystemWatcher = new QFileSystemWatcher(); + fFileSystemWatcher = std::make_unique(); if (fFileSystemWatcher == nullptr) { QMessageBox::information(this, "ERROR", "Couldn't invoke QFileSystemWatcher!"); } else { - connect( fFileSystemWatcher, SIGNAL(fileChanged(const QString&)), this, SLOT(fileChanged(const QString&))); + connect( fFileSystemWatcher.get(), SIGNAL(fileChanged(const QString&)), this, SLOT(fileChanged(const QString&))); } // initialize stuff @@ -648,32 +648,32 @@ void PTextEdit::setupTextActions() tb->setWindowTitle( "Format Actions" ); addToolBar( tb ); - fComboFont = new QComboBox(); + fComboFont = std::make_unique(); fComboFont->setEditable(true); fComboFont->addItems( QFontDatabase::families() ); - connect( fComboFont, SIGNAL( currentTextChanged( const QString & ) ), + connect( fComboFont.get(), SIGNAL( currentTextChanged( const QString & ) ), this, SLOT( textFamily( const QString & ) ) ); QLineEdit *edit = fComboFont->lineEdit(); if (edit == nullptr) { return; } edit->setText( fAdmin->getFontName() ); - tb->addWidget(fComboFont); + tb->addWidget(fComboFont.get()); - fComboSize = new QComboBox( tb ); + fComboSize = std::make_unique( tb ); fComboSize->setEditable(true); QList sizes = QFontDatabase::standardSizes(); QList::Iterator it = sizes.begin(); for ( ; it != sizes.end(); ++it ) fComboSize->addItem( QString::number( *it ) ); - connect( fComboSize, SIGNAL( currentTextChanged( const QString & ) ), + connect( fComboSize.get(), SIGNAL( currentTextChanged( const QString & ) ), this, SLOT( textSize( const QString & ) ) ); edit = fComboSize->lineEdit(); if (edit == nullptr) { return; } edit->setText( QString("%1").arg(fAdmin->getFontSize()) ); - tb->addWidget(fComboSize); + tb->addWidget(fComboSize.get()); } //---------------------------------------------------------------------------------------------------- diff --git a/src/musredit_qt6/musredit/PTextEdit.h b/src/musredit_qt6/musredit/PTextEdit.h index af70ff47..58e10a2a 100644 --- a/src/musredit_qt6/musredit/PTextEdit.h +++ b/src/musredit_qt6/musredit/PTextEdit.h @@ -40,6 +40,8 @@ #include #include #include +#include +#include #include @@ -170,7 +172,7 @@ private: bool fDarkMenuIcon; ///< flag indicating if a dark or plain icon shall be used in the menu pull-downs bool fDarkToolBarIcon; ///< flag indicating if a dark or plain icon shall be used in the toolbar std::unique_ptr fAdmin; ///< pointer to the xml-startup file informations. Needed for different purposes like default working- and executable directories etc. - QFileSystemWatcher *fFileSystemWatcher; ///< checks if msr-files are changing on the disk while being open in musredit. + std::unique_ptr fFileSystemWatcher; ///< checks if msr-files are changing on the disk while being open in musredit. bool fFileSystemWatcherActive; ///< flag to enable/disable the file system watcher QTimer fFileSystemWatcherTimeout; ///< timer used to re-enable file system watcher. Needed to delay the re-enabling QString fLastDirInUse; ///< string holding the path from where the last file was loaded. @@ -183,8 +185,8 @@ private: PMsr2DataParam *fMsr2DataParam; ///< structure holding the necessary input information for msr2data PFindReplaceData *fFindReplaceData; ///< structure holding the ncessary input for find/replace - QComboBox *fComboFont; ///< combo box for the font selector - QComboBox *fComboSize; ///< combo box for the font size + std::unique_ptr fComboFont; ///< combo box for the font selector + std::unique_ptr fComboSize; ///< combo box for the font size bool fFontChanging; ///< flag needed to prevent some textChanged feature to occure when only the font changed QTabWidget *fTabWidget; ///< tab widget in which the text editor(s) are placed