fix -Wextra in FreeCADGui
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
#ifndef _PreComp_
|
||||
# include <QApplication>
|
||||
# include <QButtonGroup>
|
||||
# include <QCompleter>
|
||||
# include <QCompleter>
|
||||
# include <QComboBox>
|
||||
# include <QDesktopServices>
|
||||
# include <QDir>
|
||||
@@ -61,7 +61,7 @@ FileDialog::~FileDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void FileDialog::onSelectedFilter(const QString& filter)
|
||||
void FileDialog::onSelectedFilter(const QString& /*filter*/)
|
||||
{
|
||||
QRegExp rx(QLatin1String("\\(\\*.(\\w+)"));
|
||||
QString suf = selectedNameFilter();
|
||||
@@ -91,21 +91,21 @@ void FileDialog::accept()
|
||||
// When saving to a file make sure that the entered filename ends with the selected
|
||||
// file filter
|
||||
if (acceptMode() == QFileDialog::AcceptSave) {
|
||||
QStringList files = selectedFiles();
|
||||
if (!files.isEmpty()) {
|
||||
QString ext = this->defaultSuffix();
|
||||
QString file = files.front();
|
||||
QString suffix = QFileInfo(file).suffix();
|
||||
// #0001928: do not add a suffix if a file with suffix is entered
|
||||
// #0002209: make sure that the entered suffix is part of one of the filters
|
||||
if (!ext.isEmpty() && (suffix.isEmpty() || !hasSuffix(suffix))) {
|
||||
file = QString::fromLatin1("%1.%2").arg(file).arg(ext);
|
||||
// That's the built-in line edit
|
||||
QLineEdit* fileNameEdit = this->findChild<QLineEdit*>(QString::fromLatin1("fileNameEdit"));
|
||||
if (fileNameEdit)
|
||||
fileNameEdit->setText(file);
|
||||
}
|
||||
}
|
||||
QStringList files = selectedFiles();
|
||||
if (!files.isEmpty()) {
|
||||
QString ext = this->defaultSuffix();
|
||||
QString file = files.front();
|
||||
QString suffix = QFileInfo(file).suffix();
|
||||
// #0001928: do not add a suffix if a file with suffix is entered
|
||||
// #0002209: make sure that the entered suffix is part of one of the filters
|
||||
if (!ext.isEmpty() && (suffix.isEmpty() || !hasSuffix(suffix))) {
|
||||
file = QString::fromLatin1("%1.%2").arg(file).arg(ext);
|
||||
// That's the built-in line edit
|
||||
QLineEdit* fileNameEdit = this->findChild<QLineEdit*>(QString::fromLatin1("fileNameEdit"));
|
||||
if (fileNameEdit)
|
||||
fileNameEdit->setText(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
QFileDialog::accept();
|
||||
}
|
||||
@@ -435,10 +435,10 @@ void FileOptionsDialog::accept()
|
||||
else if (ext.toLower() != suf.toLower()) {
|
||||
fn = QString::fromLatin1("%1.%2").arg(fn).arg(suf);
|
||||
selectFile(fn);
|
||||
// That's the built-in line edit (fixes Debian bug #811200)
|
||||
QLineEdit* fileNameEdit = this->findChild<QLineEdit*>(QString::fromLatin1("fileNameEdit"));
|
||||
if (fileNameEdit)
|
||||
fileNameEdit->setText(fn);
|
||||
// That's the built-in line edit (fixes Debian bug #811200)
|
||||
QLineEdit* fileNameEdit = this->findChild<QLineEdit*>(QString::fromLatin1("fileNameEdit"));
|
||||
if (fileNameEdit)
|
||||
fileNameEdit->setText(fn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,19 +527,19 @@ FileChooser::FileChooser ( QWidget * parent )
|
||||
layout->setMargin( 0 );
|
||||
layout->setSpacing( 6 );
|
||||
|
||||
lineEdit = new QLineEdit ( this );
|
||||
completer = new QCompleter ( this );
|
||||
completer->setMaxVisibleItems( 12 );
|
||||
fs_model = new QFileSystemModel( completer );
|
||||
fs_model->setRootPath(QString::fromUtf8(""));
|
||||
completer->setModel( fs_model );
|
||||
lineEdit->setCompleter( completer );
|
||||
|
||||
lineEdit = new QLineEdit ( this );
|
||||
completer = new QCompleter ( this );
|
||||
completer->setMaxVisibleItems( 12 );
|
||||
fs_model = new QFileSystemModel( completer );
|
||||
fs_model->setRootPath(QString::fromUtf8(""));
|
||||
completer->setModel( fs_model );
|
||||
lineEdit->setCompleter( completer );
|
||||
|
||||
layout->addWidget( lineEdit );
|
||||
|
||||
connect(lineEdit, SIGNAL(textChanged(const QString &)),
|
||||
this, SIGNAL(fileNameChanged(const QString &)));
|
||||
|
||||
|
||||
connect(lineEdit, SIGNAL(editingFinished()), this, SLOT(editingFinished()));
|
||||
|
||||
button = new QPushButton(QLatin1String("..."), this);
|
||||
@@ -569,13 +569,13 @@ QString FileChooser::fileName() const
|
||||
}
|
||||
|
||||
void FileChooser::editingFinished()
|
||||
{
|
||||
QString le_converted = QDir::fromNativeSeparators(lineEdit->text());
|
||||
lineEdit->setText(le_converted);
|
||||
{
|
||||
QString le_converted = QDir::fromNativeSeparators(lineEdit->text());
|
||||
lineEdit->setText(le_converted);
|
||||
FileDialog::setWorkingDirectory(le_converted);
|
||||
fileNameSelected(le_converted);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the file name \a s.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user