Skip to content

Commit

Permalink
Fixed bugs
Browse files Browse the repository at this point in the history
Fixed issue #1 , #2
  • Loading branch information
Linloir committed Dec 5, 2021
1 parent ba9e5b2 commit fe61551
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 14 deletions.
8 changes: 4 additions & 4 deletions customWidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ bigIconButton::bigIconButton(const QString &iconPath, const QString &description
bgWidget = new QWidget(this);
bgWidget->resize(this->size());
radiusStyle = QString::asprintf("border-radius:%dpx;", cornerRadius);
bgWidget->setStyleSheet(radiusStyle + "background-color:#00000000");
bgWidget->setStyleSheet(radiusStyle + "background-color:#04000000");
bgWidget->lower();
bgWidget->show();

Expand All @@ -479,8 +479,8 @@ void bigIconButton::resizeEvent(QResizeEvent *event){
indicator->move(this->width() * 0.45, this->height() - 21);
}
else{
indicator->resize(this->width() * 0.4, 6);
indicator->move(this->width() * 0.3, this->height() - 21);
indicator->resize(this->width() * 0.1, 6);
indicator->move(this->width() * 0.45, this->height() - 21);
}
}

Expand All @@ -497,7 +497,7 @@ void bigIconButton::enterEvent(QEnterEvent *event){
}

void bigIconButton::leaveEvent(QEvent *event){
bgWidget->setStyleSheet(radiusStyle + "background-color:#00000000");
bgWidget->setStyleSheet(radiusStyle + "background-color:#04000000");
QPropertyAnimation *shorter = new QPropertyAnimation(indicator, "geometry", this);
shorter->setStartValue(indicator->geometry());
if(!onSelected)
Expand Down
44 changes: 38 additions & 6 deletions graph_implement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ void AMLGraph::DelVex(int vexID){
AMLArc *nextArc = preArc->nextOutArc;
while(nextArc != nullptr){
if(nextArc->inVexID == vexID || nextArc->outVexID == vexID){
if(preArc->outVexID == i){
if(preArc->outVexID == i || preArc->outVexID == -i){
if(nextArc->outVexID == i){
preArc->nextOutArc = nextArc->nextOutArc;
nextArc->nextOutArc = nullptr;
Expand All @@ -506,20 +506,52 @@ void AMLGraph::DelVex(int vexID){
delete nextArc;
}
}
nextArc = preArc->outVexID == i ? preArc->nextOutArc : preArc->nextInArc;
nextArc = (preArc->outVexID == i || preArc->outVexID == -i) ? preArc->nextOutArc : preArc->nextInArc;
continue;
}
preArc = nextArc;
nextArc = preArc->outVexID == i ? preArc->nextOutArc : preArc->nextInArc;
if(preArc->inVexID > vexID)
preArc->inVexID = - preArc->inVexID;
else if(preArc->inVexID < 0)
preArc->inVexID = - preArc->inVexID;
preArc->inVexID = - preArc->inVexID - 1;
if(preArc->outVexID > vexID)
preArc->outVexID = - preArc->outVexID;
else if(preArc->outVexID < 0)
preArc->outVexID = - preArc->outVexID;
preArc->outVexID = - preArc->outVexID - 1;
preArc = nextArc;
nextArc = (preArc->outVexID == i || preArc->outVexID == -i) ? preArc->nextOutArc : preArc->nextInArc;

/********************************************************************************************/
//Issue #1
/*How this causes issue:
* Example: when vexID is 1
* preArc = nextArc => preArc: -3 -> -2
* nextArc = ... => nextArc : 3 -> 1
* Adjust pre Arc to => preArc: 2 -> 1
* In next loop: nextArc->inVexID == 1 => judge if preArc->nextOutArc == 3 (in fact it is)
* preArc->nextOutArc != 3 -> wrongly connect next out arc of 3 -> 1 to next out arc of 2 -> 1
* which leads to wrong operations
*/

//if(preArc->inVexID > vexID)
// preArc->inVexID = - preArc->inVexID;
//else if(preArc->inVexID < 0)
// preArc->inVexID = - preArc->inVexID - 1;
//if(preArc->outVexID > vexID)
// preArc->outVexID = - preArc->outVexID;
//else if(preArc->outVexID < 0)
// preArc->outVexID = - preArc->outVexID - 1;

/********************************************************************************************/

}
if(preArc->inVexID > vexID)
preArc->inVexID = - preArc->inVexID;
else if(preArc->inVexID < 0)
preArc->inVexID = - preArc->inVexID - 1;
if(preArc->outVexID > vexID)
preArc->outVexID = - preArc->outVexID;
else if(preArc->outVexID < 0)
preArc->outVexID = - preArc->outVexID - 1;
outVexList[i].firstArc = dummyHead->nextOutArc;
delete dummyHead;
}
Expand Down
10 changes: 7 additions & 3 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,21 @@ void MainWindow::Init(){
border->show();
/*****************************************************************/

/* Create settings page */
/* Create about page */
defaultSettingsPage = new SlidePage(cornerRadius, "ABOUT", ui->mainWidget);
textInputItem *version = new textInputItem("version", defaultSettingsPage);
version->setValue("1.0");
version->setValue("1.1 beta");
version->setEnabled(false);
textInputItem *updateDate = new textInputItem("last-upd", defaultSettingsPage);
updateDate->setValue("2021/12/4");
updateDate->setValue("2021/12/5");
updateDate->setEnabled(false);
textInputItem *Author = new textInputItem("author", defaultSettingsPage);
Author->setValue("Linloir | Made with love");
Author->setEnabled(false);
textInputItem *GitHub = new textInputItem("git", defaultSettingsPage);
GitHub->setValue("github.com/Linloir");
GitHub->setEnabled(false);
defaultSettingsPage->AddContent(GitHub);
defaultSettingsPage->AddContent(Author);
defaultSettingsPage->AddContent(updateDate);
defaultSettingsPage->AddContent(version);
Expand Down
2 changes: 1 addition & 1 deletion mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class MainWindow : public QMainWindow
QPoint lastPos;
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event){mousePressed = false;}
void mouseReleaseEvent(QMouseEvent *event){mousePressed = false;if(event->globalPosition().y() < 2) controlWindowScale();}
void resizeEvent(QResizeEvent *event);

bool maximized = false;
Expand Down

0 comments on commit fe61551

Please sign in to comment.