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