more work on smart pointer transition of PTextEdit.
This commit is contained in:
parent
1117ad9732
commit
b88c18e7d9
@ -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());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
@ -40,6 +40,8 @@
|
||||
#include <QProcess>
|
||||
#include <QFileInfo>
|
||||
#include <QByteArray>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QComboBox>
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
@ -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<PAdmin> 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<QFileSystemWatcher> 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<QComboBox> fComboFont; ///< combo box for the font selector
|
||||
std::unique_ptr<QComboBox> 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user