- fix: save as file dialog's operation mode is not correct
This commit is contained in:
parent
cd91df6fb8
commit
d188d8897f
1
NEWS.md
1
NEWS.md
|
@ -1,5 +1,6 @@
|
||||||
Version 0.7.0
|
Version 0.7.0
|
||||||
- fix: Backspace still works in readonly mode
|
- fix: Backspace still works in readonly mode
|
||||||
|
- fix: save as file dialog's operation mode is not correct
|
||||||
|
|
||||||
Version 0.6.8
|
Version 0.6.8
|
||||||
- enhancement: add link to cppreference in the help menu
|
- enhancement: add link to cppreference in the help menu
|
||||||
|
|
|
@ -245,16 +245,21 @@ bool Editor::saveAs(const QString &name, bool fromProject){
|
||||||
QString newName = name;
|
QString newName = name;
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
QString selectedFileFilter;
|
QString selectedFileFilter;
|
||||||
if (pSettings->editor().defaultFileCpp())
|
QString defaultExt;
|
||||||
|
if (pSettings->editor().defaultFileCpp()) {
|
||||||
selectedFileFilter = pSystemConsts->defaultCPPFileFilter();
|
selectedFileFilter = pSystemConsts->defaultCPPFileFilter();
|
||||||
else
|
defaultExt = "cpp";
|
||||||
|
} else {
|
||||||
selectedFileFilter = pSystemConsts->defaultCFileFilter();
|
selectedFileFilter = pSystemConsts->defaultCFileFilter();
|
||||||
|
defaultExt = "c";
|
||||||
|
}
|
||||||
QFileDialog dialog(this,tr("Save As"),extractFilePath(mFilename),
|
QFileDialog dialog(this,tr("Save As"),extractFilePath(mFilename),
|
||||||
pSystemConsts->defaultFileFilters().join(";;"));
|
pSystemConsts->defaultFileFilters().join(";;"));
|
||||||
dialog.selectNameFilter(selectedFileFilter);
|
dialog.selectNameFilter(selectedFileFilter);
|
||||||
|
dialog.setDefaultSuffix(defaultExt);
|
||||||
dialog.selectFile(mFilename);
|
dialog.selectFile(mFilename);
|
||||||
dialog.setFileMode(QFileDialog::AnyFile);
|
dialog.setFileMode(QFileDialog::AnyFile);
|
||||||
dialog.setOption(QFileDialog::DontConfirmOverwrite,false);
|
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
connect(&dialog, &QFileDialog::filterSelected,
|
connect(&dialog, &QFileDialog::filterSelected,
|
||||||
[&dialog](const QString &filter){
|
[&dialog](const QString &filter){
|
||||||
int pos = filter.indexOf("*.");
|
int pos = filter.indexOf("*.");
|
||||||
|
|
|
@ -3910,7 +3910,7 @@ void MainWindow::on_actionAdd_to_project_triggered()
|
||||||
mProject->directory(),
|
mProject->directory(),
|
||||||
pSystemConsts->defaultFileFilters().join(";;"));
|
pSystemConsts->defaultFileFilters().join(";;"));
|
||||||
dialog.setFileMode(QFileDialog::ExistingFiles);
|
dialog.setFileMode(QFileDialog::ExistingFiles);
|
||||||
dialog.setOption(QFileDialog::DontConfirmOverwrite,true);
|
dialog.setAcceptMode(QFileDialog::AcceptOpen);
|
||||||
if (dialog.exec()) {
|
if (dialog.exec()) {
|
||||||
QModelIndex current = ui->projectView->currentIndex();
|
QModelIndex current = ui->projectView->currentIndex();
|
||||||
FolderNode * node = nullptr;
|
FolderNode * node = nullptr;
|
||||||
|
|
|
@ -2202,7 +2202,7 @@ void SynEdit::computeScroll(int X, int Y)
|
||||||
mScrollDeltaY = (Y - iScrollBounds.top()) / mTextHeight - 1;
|
mScrollDeltaY = (Y - iScrollBounds.top()) / mTextHeight - 1;
|
||||||
else if (Y >= iScrollBounds.bottom())
|
else if (Y >= iScrollBounds.bottom())
|
||||||
mScrollDeltaY = (Y - iScrollBounds.bottom()) / mTextHeight + 1;
|
mScrollDeltaY = (Y - iScrollBounds.bottom()) / mTextHeight + 1;
|
||||||
else
|
else
|
||||||
mScrollDeltaY = 0;
|
mScrollDeltaY = 0;
|
||||||
|
|
||||||
if (mScrollDeltaX!=0 || mScrollDeltaY!=0)
|
if (mScrollDeltaX!=0 || mScrollDeltaY!=0)
|
||||||
|
|
Loading…
Reference in New Issue