Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.08 KB | None | 0 0
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3. #include <QDebug>
  4.  
  5. MainWindow::MainWindow(QWidget *parent) :
  6.     QMainWindow(parent),
  7.     ui(new Ui::MainWindow)
  8. {
  9.     ui->setupUi(this);
  10. }
  11.  
  12. MainWindow::~MainWindow()
  13. {
  14.     delete ui;
  15. }
  16.  
  17. void MainWindow::on_newproduct_clicked()
  18. {
  19.    int a=ui->act1choose->currentIndex();
  20.    std::string s=ui->lineEdit->text().toLocal8Bit().constData();;
  21.    float n=ui->number->value();
  22.    int u=ui->unitchoose->currentIndex();
  23.    if(s != "") {
  24.         Product p(s, static_cast<Units>(u), n, static_cast<Actions>(a));
  25.         q.push(p);
  26.         q.print();
  27.         ui->delete_2->setEnabled(true);
  28.         ui->newaction->setEnabled(true);
  29.         ui->save->setEnabled(true);
  30.    }
  31. }
  32.  
  33. void MainWindow::on_newaction_clicked()
  34. {
  35.     int a=ui->act2choose->currentIndex();
  36.     q.push(Action(static_cast<Actions>(a)));
  37.     q.print();
  38. }
  39.  
  40. void MainWindow::on_delete_2_clicked()
  41. {
  42.    q.pop();
  43.    if(q.isEmpty()) {
  44.        ui->delete_2->setEnabled(false);
  45.        ui->newaction->setEnabled(false);
  46.        ui->save->setEnabled(false);
  47.    }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement