more work on smart pointer transition of PTextEdit.

This commit is contained in:
2023-10-22 09:17:42 +02:00
parent 1117ad9732
commit b88c18e7d9
2 changed files with 13 additions and 11 deletions

View File

@@ -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<QFileSystemWatcher>();
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<QComboBox>();
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<QComboBox>( tb );
fComboSize->setEditable(true);
QList<int> sizes = QFontDatabase::standardSizes();
QList<int>::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());
}
//----------------------------------------------------------------------------------------------------