- fix: index of the longest line not correctly updated ( which will cause selection errors)

This commit is contained in:
Roy Qu 2022-04-18 11:35:42 +08:00
parent 1eb809b011
commit 0d2c842317
4 changed files with 70 additions and 4 deletions

View File

@ -13,6 +13,7 @@ Red Panda C++ Version 1.0.4
- enhancement: add Portugese translation - enhancement: add Portugese translation
- fix: crash when eval statements like "fsm::stack fsm;" - fix: crash when eval statements like "fsm::stack fsm;"
- enhancement: add Traditional Chinese translation - enhancement: add Traditional Chinese translation
- fix: index of the longest line not correctly updated ( which will cause selection errors)
Red Panda C++ Version 1.0.3 Red Panda C++ Version 1.0.3
- fix: when oj problem grabbed by competitive companion received, - fix: when oj problem grabbed by competitive companion received,

View File

@ -398,6 +398,8 @@ void SynEditStringList::deleteAt(int Index)
beginUpdate(); beginUpdate();
if (mIndexOfLongestLine == Index) if (mIndexOfLongestLine == Index)
mIndexOfLongestLine = -1; mIndexOfLongestLine = -1;
else if (mIndexOfLongestLine>Index)
mIndexOfLongestLine -= 1;
mList.removeAt(Index); mList.removeAt(Index);
emit deleted(Index,1); emit deleted(Index,1);
endUpdate(); endUpdate();
@ -426,9 +428,11 @@ void SynEditStringList::putString(int Index, const QString &s, bool notify) {
ListIndexOutOfBounds(Index); ListIndexOutOfBounds(Index);
} }
beginUpdate(); beginUpdate();
mIndexOfLongestLine = -1; int oldColumns = mList[Index]->fColumns;
mList[Index]->fString = s; mList[Index]->fString = s;
mList[Index]->fColumns = -1; calculateLineColumns(Index);
if (oldColumns>mList[Index]->fColumns)
mIndexOfLongestLine = -1;
if (notify) if (notify)
emit putted(Index,1); emit putted(Index,1);
endUpdate(); endUpdate();

View File

@ -18,6 +18,9 @@
#include "ui_projectcompileparamaterswidget.h" #include "ui_projectcompileparamaterswidget.h"
#include "../mainwindow.h" #include "../mainwindow.h"
#include "../project.h" #include "../project.h"
#include "../iconsmanager.h"
#include <QFileDialog>
ProjectCompileParamatersWidget::ProjectCompileParamatersWidget(const QString &name, const QString &group, QWidget *parent) : ProjectCompileParamatersWidget::ProjectCompileParamatersWidget(const QString &name, const QString &group, QWidget *parent) :
SettingsWidget(name,group,parent), SettingsWidget(name,group,parent),
@ -45,3 +48,29 @@ void ProjectCompileParamatersWidget::doSave()
pMainWindow->project()->options().linkerCmd = ui->txtLinker->toPlainText(); pMainWindow->project()->options().linkerCmd = ui->txtLinker->toPlainText();
pMainWindow->project()->saveOptions(); pMainWindow->project()->saveOptions();
} }
void ProjectCompileParamatersWidget::on_btnChooseLib_clicked()
{
#ifdef Q_OS_WIN
QString filter = tr("Library Files (*.a *.lib)");
#else
QString filter = tr("Library Files (*.a)");
#endif
QStringList files = QFileDialog::getOpenFileNames(
this,
tr("Add Library Files"),
filter
);
if (!files.isEmpty()) {
foreach (const QString& file,files) {
ui->txtLinker->appendPlainText(" "+genMakePath1(file));
}
}
}
void ProjectCompileParamatersWidget::updateIcons(const QSize &size)
{
pIconsManager->setIcon(ui->btnChooseLib, IconsManager::ACTION_MISC_FOLDER);
}

View File

@ -24,7 +24,7 @@
<item> <item>
<widget class="QTabWidget" name="tabCommands"> <widget class="QTabWidget" name="tabCommands">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
@ -74,7 +74,7 @@
<attribute name="title"> <attribute name="title">
<string>Linker</string> <string>Linker</string>
</attribute> </attribute>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin"> <property name="leftMargin">
<number>5</number> <number>5</number>
</property> </property>
@ -90,6 +90,38 @@
<item> <item>
<widget class="QPlainTextEdit" name="txtLinker"/> <widget class="QPlainTextEdit" name="txtLinker"/>
</item> </item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="btnChooseLib">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>