- 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
- fix: crash when eval statements like "fsm::stack fsm;"
- 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
- fix: when oj problem grabbed by competitive companion received,

View File

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

View File

@ -18,6 +18,9 @@
#include "ui_projectcompileparamaterswidget.h"
#include "../mainwindow.h"
#include "../project.h"
#include "../iconsmanager.h"
#include <QFileDialog>
ProjectCompileParamatersWidget::ProjectCompileParamatersWidget(const QString &name, const QString &group, QWidget *parent) :
SettingsWidget(name,group,parent),
@ -45,3 +48,29 @@ void ProjectCompileParamatersWidget::doSave()
pMainWindow->project()->options().linkerCmd = ui->txtLinker->toPlainText();
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>
<widget class="QTabWidget" name="tabCommands">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -74,7 +74,7 @@
<attribute name="title">
<string>Linker</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>5</number>
</property>
@ -90,6 +90,38 @@
<item>
<widget class="QPlainTextEdit" name="txtLinker"/>
</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>
</widget>
</widget>