Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. include "storewindow.h"
  2.  
  3. #include <QPushButton>
  4. #include <QtGui>
  5. #include <QWSServer>
  6.  
  7. /* déclaration de output ici */
  8.  
  9. StoreWindow::StoreWindow(QWidget *parent)
  10. :QWidget(parent)
  11. {
  12. //setAttribute(Qt::WA_DeleteOnClose);
  13.  
  14. /* initialisation de output ici */
  15. storeAction = new QPushButton("Action Store");
  16. storeAction->setCheckable(true);
  17. //output =new AsHmsOutput();
  18. quit = new QPushButton;
  19. quit->setIcon(QIcon(QString(":/qss/qss/close.png")));
  20.  
  21. connect(storeAction, SIGNAL(toggled(bool)), this, SLOT(storeActioned(bool)));
  22.  
  23.  
  24. cout<<"Afficher pass 1"<<endl;
  25. //connect(storeAction, SIGNAL(clicked()), this, SLOT(storeActioned()));
  26. connect(quit, SIGNAL(clicked()), this, SLOT(close()));
  27.  
  28.  
  29.  
  30. QHBoxLayout* closeLayout = new QHBoxLayout;
  31. closeLayout->addStretch();
  32. closeLayout->addWidget(quit);
  33.  
  34. QHBoxLayout* buttonLayout = new QHBoxLayout;
  35. buttonLayout->addStretch();
  36. buttonLayout->addWidget(storeAction);
  37. buttonLayout->addStretch();
  38.  
  39. QVBoxLayout* mainLayout = new QVBoxLayout;
  40. mainLayout->addLayout(closeLayout);
  41. mainLayout->addStretch();
  42. mainLayout->addLayout(buttonLayout);
  43. mainLayout->addStretch();
  44.  
  45. setLayout(mainLayout);
  46.  
  47. outputHandler = new AsHmsOutput;
  48. outputHandler->init();
  49. }
  50.  
  51.  
  52. void StoreWindow::storeActioned(bool checked)
  53.  
  54.  
  55. {
  56.  
  57.  
  58. AsHmsOutput *output;
  59. output =new AsHmsOutput();
  60.  
  61. /* initialize output */
  62.  
  63. if(output->init() < 0)
  64.  
  65. {
  66.  
  67. cout<<"Can't initialize output"<<endl;
  68.  
  69. }
  70. else
  71. {
  72. cout<<"can initialize output"<<endl;
  73. }
  74.  
  75.  
  76.  
  77. /* Here you can set the store gpio to opened (0=close, 1=open) */
  78. if (checked)
  79. {
  80.  
  81. // monter
  82. cout<<"monter"<<endl;
  83. output->writeChan(1, 1);
  84. output->writeChan(2, 0);
  85. }
  86. else
  87. {
  88. //descendre
  89. cout<<"descendre"<<endl;
  90. output->writeChan(1, 0);
  91. output->writeChan(2, 1);
  92.  
  93. }
  94.  
  95. delete output; /* vire moi ça */
  96.  
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement