Skip to content

Commit

Permalink
Finally fixed that fucking annoying little shit bug
Browse files Browse the repository at this point in the history
  • Loading branch information
BenGercuj committed Oct 27, 2022
1 parent e9c5775 commit 1b16114
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ MainWindow::MainWindow(QWidget *parent)
, ui(new Ui::MainWindow), labels(new std::vector<Label>), toppings(new std::vector<Topping>), pizzas(new std::vector<Pizza>)
{
ui->setupUi(this);
QObject::connect(ui->label_listWidget, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(setLabel(QListWidgetItem*)));
QObject::connect(ui->topping_listWidget, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(setTopping(QListWidgetItem*)));
}

MainWindow::~MainWindow()
Expand All @@ -32,7 +34,6 @@ void MainWindow::on_addButton_clicked()
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(Qt::Unchecked);
ui->label_listWidget->addItem(item);
QObject::connect(ui->label_listWidget, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(setLabel(QListWidgetItem*)));
}

void MainWindow::setLabel(QListWidgetItem* item)
Expand Down Expand Up @@ -63,7 +64,6 @@ void MainWindow::on_addButton_2_clicked()
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(Qt::Unchecked);
ui->topping_listWidget->addItem(item);
QObject::connect(ui->topping_listWidget, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(setTopping(QListWidgetItem*)));
}

void MainWindow::setTopping(QListWidgetItem* item)
Expand All @@ -87,7 +87,7 @@ void MainWindow::on_addButton_3_clicked()
if (t.selected) { selected_toppings.push_back(t); all_toppings += t.name + " "; }
}

Pizza pizza(name, base_price, selected_toppings); // crashes with string length error when too many toppings are selected, CHECK IT
Pizza pizza(name, base_price, selected_toppings);
pizzas->push_back(pizza);

std::string all_labels = "";
Expand Down

0 comments on commit 1b16114

Please sign in to comment.