Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.93 KB | None | 0 0
  1. #include <QMessageBox>
  2. #include <QSqlDatabase>
  3. #include <QSqlError>
  4. #include <QSqlQuery>
  5. #include <qsound.h>
  6. #include <QtGui/QCloseEvent>
  7.  
  8. #include <QMdiArea>
  9.  
  10. #include "mainwindow.h"
  11. #include "ui_mainwindow.h"
  12.  
  13. #include "cadtipos.h"
  14. #include "cadgrupo.h"
  15. #include "cadsubgrupo.h"
  16. #include "pagamentos.h"
  17. #include "pendentes.h"
  18.  
  19. MainWindow::MainWindow(QWidget *parent) :
  20.     QMainWindow(parent),
  21.     ui(new Ui::MainWindow)
  22. {
  23.     ui->setupUi(this);
  24.  
  25.     mdiArea = new QMdiArea;
  26.     mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
  27.     mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
  28.  
  29.  
  30.     setCentralWidget(mdiArea);
  31.  
  32.     connect(ui->actionCadastro_de_Tipos, SIGNAL(triggered()), this, SLOT(chama_cadtipos()));
  33.     connect(ui->actionCadastro_de_Grupos, SIGNAL(triggered()), this, SLOT(chama_grupos()));
  34.     connect(ui->actionCadastro_de_subgrupos, SIGNAL(triggered()), this, SLOT(chama_subgrupos()));
  35.     connect(ui->actionPagamentos, SIGNAL(triggered()), this, SLOT(chama_pagamentos()));
  36.     connect(ui->actionBaixar, SIGNAL(triggered()), this, SLOT(chama_pendentes()));
  37.  
  38.     conecta();
  39.  
  40. //    setUnifiedTitleAndToolBarOnMac(true);
  41.  
  42. }
  43.  
  44. MainWindow::~MainWindow()
  45. {
  46.     delete ui;
  47. }
  48.  
  49. void MainWindow::changeEvent(QEvent *e)
  50. {
  51.     QMainWindow::changeEvent(e);
  52.     switch (e->type()) {
  53.     case QEvent::LanguageChange:
  54.         ui->retranslateUi(this);
  55.         break;
  56.     default:
  57.         break;
  58.     }
  59. }
  60.  
  61. void MainWindow::closeEvent(QCloseEvent *event)
  62. {
  63.     mdiArea->closeAllSubWindows();
  64.      if (mdiArea->currentSubWindow()) {
  65.          event->ignore();
  66.      } else {
  67.          event->accept();
  68.      }
  69. }
  70.  
  71. void MainWindow::chama_cadtipos()
  72. {
  73.  
  74.  
  75.     CadTipos *child = new CadTipos;
  76.  
  77.     mdiArea->addSubWindow(child);
  78.  
  79. //    child->setFixedSize(size()); //para impedir de redimensionar
  80.  
  81.     child->show();
  82.  
  83.  
  84. /*
  85.     CadTipos *fcadtipos = new CadTipos;
  86.  
  87.     mdiArea->addSubWindow(CadTipos);
  88.  
  89.     CadTipos->show();
  90. */
  91.  
  92. //    fcadtipos->exec();
  93. }
  94.  
  95. void MainWindow::chama_consulta()
  96. {
  97.  
  98. /*
  99. //    consultagenerica *child = new consultagenerica;
  100. //    mdiArea->addSubWindow(child);
  101.  
  102. //    child->show();
  103.  
  104.  
  105.     CadTipos *fcadtipos = new CadTipos;
  106.  
  107.     mdiArea->addSubWindow(CadTipos);
  108.  
  109.     CadTipos->show();
  110. */
  111.  
  112. //    fcadtipos->exec();
  113. }
  114.  
  115. void MainWindow::chama_grupos()
  116. {
  117.  
  118.     cadgrupo *chamagrupos = new cadgrupo;
  119.     mdiArea->addSubWindow(chamagrupos);
  120.  
  121. //    chamagrupos->setFixedSize(size());
  122.  
  123.     chamagrupos->show();
  124.  
  125.  
  126. /*
  127.     CadTipos *fcadtipos = new CadTipos;
  128.  
  129.     mdiArea->addSubWindow(CadTipos);
  130.  
  131.     CadTipos->show();
  132. */
  133.  
  134. //    fcadtipos->exec();
  135. }
  136.  
  137. void MainWindow::chama_subgrupos()
  138. {
  139.  
  140.  
  141.     cadsubgrupo *chamasubgrupos = new cadsubgrupo;
  142.     mdiArea->addSubWindow(chamasubgrupos);
  143.  
  144. //    chamasubgrupos->setFixedSize(size());
  145.  
  146.     chamasubgrupos->show();
  147.  
  148.  
  149. /*
  150.     CadTipos *fcadtipos = new CadTipos;
  151.  
  152.     mdiArea->addSubWindow(CadTipos);
  153.  
  154.     CadTipos->show();
  155. */
  156.  
  157. //    fcadtipos->exec();
  158. }
  159.  
  160. void MainWindow::chama_pagamentos()
  161. {
  162.  
  163.     pagamentos *chamapagamentos = new pagamentos;
  164.     mdiArea->addSubWindow(chamapagamentos);
  165.  
  166. //    chamapagamentos->setFixedSize(size());
  167.  
  168.     chamapagamentos->show();
  169.  
  170.  
  171. /*
  172.     CadTipos *fcadtipos = new CadTipos;
  173.  
  174.     mdiArea->addSubWindow(CadTipos);
  175.  
  176.     CadTipos->show();
  177. */
  178.  
  179. //    fcadtipos->exec();
  180. }
  181.  
  182. void MainWindow::chama_pendentes()
  183. {
  184.  
  185.     Pendentes *chamapendentes = new Pendentes;
  186.     QMdiSubWindow child = new QMdiSubWindow(this);
  187.     child->setWidget(chamapendentes);
  188.     child->setMaximumWidth(chamapendentes->maximumWidth());
  189.     child->setMaximumHeight(chamapendentes->maximumHeight());
  190.     mdiArea->addSubWindow(child);
  191.    
  192.     child->move(0,0);
  193.     child->show();
  194.     child->setAttribute(Qt::WA_DeleteOnClose);
  195.  
  196.  
  197. /*
  198.     CadTipos *fcadtipos = new CadTipos;
  199.  
  200.     mdiArea->addSubWindow(CadTipos);
  201.  
  202.     CadTipos->show();
  203. */
  204.  
  205. //    fcadtipos->exec();
  206. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement