- enhancement: set current index to the folder after new folder created in the file view
This commit is contained in:
parent
777c295cc0
commit
262b4916fd
1
NEWS.md
1
NEWS.md
|
@ -12,6 +12,7 @@ Red Panda C++ Version 1.1.4
|
|||
- enhancement: prevent group undo when caret position changed
|
||||
- fix: undo link break may lose leading spaces
|
||||
- fix: correctly restore editor's modified status when undo/redo
|
||||
- enhancement: set current index to the folder after new folder created in the file view
|
||||
|
||||
Red Panda C++ Version 1.1.3
|
||||
|
||||
|
|
|
@ -4088,14 +4088,6 @@
|
|||
<source>New Folder %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Untitled</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Untitled %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Do you really want to delete %1?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -4500,6 +4492,10 @@
|
|||
<source>Raylib Manual</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>untitled%1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>NewClassDialog</name>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4108,14 +4108,6 @@
|
|||
<source>New Folder %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Untitled</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Untitled %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Do you really want to delete %1?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -4500,6 +4492,10 @@
|
|||
<source>Raylib Manual</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>untitled%1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>NewClassDialog</name>
|
||||
|
|
|
@ -3535,13 +3535,17 @@ void MainWindow::onShowInsertCodeSnippetMenu()
|
|||
void MainWindow::onFilesViewCreateFolder()
|
||||
{
|
||||
QModelIndex index = ui->treeFiles->currentIndex();
|
||||
QModelIndex parentIndex;
|
||||
QDir dir;
|
||||
if (index.isValid()
|
||||
&& ui->treeFiles->selectionModel()->isSelected(index)) {
|
||||
if (mFileSystemModel.isDir(index))
|
||||
if (mFileSystemModel.isDir(index)) {
|
||||
dir = QDir(mFileSystemModel.fileInfo(index).absoluteFilePath());
|
||||
else
|
||||
parentIndex = index;
|
||||
} else {
|
||||
dir = mFileSystemModel.fileInfo(index).absoluteDir();
|
||||
parentIndex = mFileSystemModel.index(dir.absolutePath());
|
||||
}
|
||||
ui->treeFiles->expand(index);
|
||||
} else {
|
||||
dir = mFileSystemModel.rootDirectory();
|
||||
|
@ -3552,7 +3556,8 @@ void MainWindow::onFilesViewCreateFolder()
|
|||
count++;
|
||||
folderName = tr("New Folder %1").arg(count);
|
||||
}
|
||||
dir.mkdir(dir.filePath(folderName));
|
||||
QModelIndex newIndex = mFileSystemModel.mkdir(parentIndex,folderName);
|
||||
ui->treeFiles->setCurrentIndex(newIndex);
|
||||
}
|
||||
|
||||
void MainWindow::onFilesViewCreateFile()
|
||||
|
@ -3574,11 +3579,11 @@ void MainWindow::onFilesViewCreateFile()
|
|||
suffix=".cpp";
|
||||
else
|
||||
suffix=".c";
|
||||
QString fileName = tr("Untitled")+suffix;
|
||||
QString fileName = tr("untitled")+suffix;
|
||||
int count = 0;
|
||||
while (dir.exists(fileName)) {
|
||||
count++;
|
||||
fileName = tr("Untitled %1").arg(count)+suffix;
|
||||
fileName = tr("untitled%1").arg(count)+suffix;
|
||||
}
|
||||
QFile file(dir.filePath(fileName));
|
||||
file.open(QFile::NewOnly);
|
||||
|
|
|
@ -464,7 +464,7 @@
|
|||
<enum>QTabWidget::West</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="usesScrollButtons">
|
||||
<bool>true</bool>
|
||||
|
@ -541,6 +541,9 @@
|
|||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
|
|
|
@ -22,3 +22,4 @@ CustomFileSystemModel::CustomFileSystemModel(QObject *parent) : QFileSystemModel
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue