Advertisement
Guest User

Untitled

a guest
May 24th, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.50 KB | None | 0 0
  1. //row 1
  2. Cell *c0_1= new Cell(ui->centralWidget);
  3. c0_1->setText("1\n");
  4. Cell *c0_2= new Cell(ui->centralWidget);
  5. c0_2->setText("2\n");
  6. c0_2->setYellow();
  7.  
  8. Cell *c0_3= new Cell(ui->centralWidget);
  9. c0_3->setText("3\n");
  10. ui->tableWidget->setCellWidget(0,2,c0_1);
  11. ui->tableWidget->setCellWidget(0,3,c0_2);
  12. ui->tableWidget->setCellWidget(0,4,c0_3);
  13.  
  14.  
  15. //row 2
  16. Cell *c1_1= new Cell(ui->centralWidget);
  17. c1_1->setText("4\n");
  18. Cell *c1_2= new Cell(ui->centralWidget);
  19. c1_2->setText("5\n");
  20. Cell *c1_3= new Cell(ui->centralWidget);
  21. c1_3->setText("6\n");
  22. ui->tableWidget->setCellWidget(1,2,c1_1);
  23. ui->tableWidget->setCellWidget(1,3,c1_2);
  24. ui->tableWidget->setCellWidget(1,4,c1_3);
  25.  
  26. //row 3
  27. Cell *c2_1= new Cell(ui->centralWidget);
  28. c2_1->setText("7\n");
  29. c2_1->setYellow();
  30. Cell *c2_2= new Cell(ui->centralWidget);
  31. c2_2->setText("8\n");
  32. c2_2->setYellow();
  33. Cell *c2_3= new Cell(ui->centralWidget);
  34. c2_3->setText("9\n");
  35. Cell *c2_4= new Cell(ui->centralWidget);
  36. c2_4->setText("10\n");
  37. c2_4->setYellow();
  38. Cell *c2_5= new Cell(ui->centralWidget);
  39. c2_5->setText("11\n");
  40. Cell *c2_6= new Cell(ui->centralWidget);
  41. c2_6->setText("12\n");
  42. Cell *c2_7= new Cell(ui->centralWidget);
  43. c2_7->setText("13\n");
  44.  
  45. ui->tableWidget->setCellWidget(2,0,c2_1);
  46. ui->tableWidget->setCellWidget(2,1,c2_2);
  47. ui->tableWidget->setCellWidget(2,2,c2_3);
  48. ui->tableWidget->setCellWidget(2,3,c2_4);
  49. ui->tableWidget->setCellWidget(2,4,c2_5);
  50. ui->tableWidget->setCellWidget(2,5,c2_6);
  51. ui->tableWidget->setCellWidget(2,6,c2_7);
  52. //row 4
  53.  
  54. Cell *c3_1= new Cell(ui->centralWidget);
  55. c3_1->setText("14\n");
  56. Cell *c3_2= new Cell(ui->centralWidget);
  57. c3_2->setText("15\n");
  58. Cell *c3_3= new Cell(ui->centralWidget);
  59. c3_3->setText("16\n");
  60. c3_3->setYellow();
  61. Cell *c3_4= new Cell(ui->centralWidget);
  62. c3_4->setText("17\n");
  63. Cell *c3_5= new Cell(ui->centralWidget);
  64. c3_5->setText("18\n");
  65. Cell *c3_6= new Cell(ui->centralWidget);
  66. c3_6->setText("19\n");
  67. Cell *c3_7= new Cell(ui->centralWidget);
  68. c3_7->setText("20\n");
  69.  
  70. ui->tableWidget->setCellWidget(3,0,c3_1);
  71. ui->tableWidget->setCellWidget(3,1,c3_2);
  72. ui->tableWidget->setCellWidget(3,2,c3_3);
  73. ui->tableWidget->setCellWidget(3,3,c3_4);
  74. ui->tableWidget->setCellWidget(3,4,c3_5);
  75. ui->tableWidget->setCellWidget(3,5,c3_6);
  76. ui->tableWidget->setCellWidget(3,6,c3_7);
  77.  
  78. //row 5
  79. Cell *c4_1= new Cell(ui->centralWidget);
  80. c4_1->setText("21\n");
  81. Cell *c4_2= new Cell(ui->centralWidget);
  82. c4_2->setText("22\n");
  83. Cell *c4_3= new Cell(ui->centralWidget);
  84. c4_3->setText("23\n");
  85. Cell *c4_4= new Cell(ui->centralWidget);
  86. c4_4->setText("24\n");
  87. Cell *c4_5= new Cell(ui->centralWidget);
  88. c4_5->setText("25\n");
  89. c4_5->setYellow();
  90. Cell *c4_6= new Cell(ui->centralWidget);
  91. c4_6->setText("26\n");
  92. Cell *c4_7= new Cell(ui->centralWidget);
  93. c4_7->setText("27\n");
  94.  
  95. ui->tableWidget->setCellWidget(4,0,c4_1);
  96. ui->tableWidget->setCellWidget(4,1,c4_2);
  97. ui->tableWidget->setCellWidget(4,2,c4_3);
  98. ui->tableWidget->setCellWidget(4,3,c4_4);
  99. ui->tableWidget->setCellWidget(4,4,c4_5);
  100. ui->tableWidget->setCellWidget(4,5,c4_6);
  101. ui->tableWidget->setCellWidget(4,6,c4_7);
  102.  
  103. //row 6
  104. int dc=dt.date().daysInMonth();
  105. Cell *c5_1=new Cell(ui->centralWidget);
  106. c5_1->setText("28\n");
  107. c5_1->setYellow();
  108. ui->tableWidget->setCellWidget(5,2,c5_1);
  109. Cell *c5_2=new Cell(ui->centralWidget);
  110. if (dc>=29)
  111. {
  112. c5_2->setText("29\n");
  113. ui->tableWidget->setCellWidget(5,3,c5_2);
  114. } else {
  115. c5_2->setWhite();
  116. }
  117.  
  118. Cell *c5_3=new Cell(ui->centralWidget);
  119. ui->tableWidget->setCellWidget(5,4,c5_3);
  120. if (dc>=30)
  121. {
  122. c5_3->setText("30\n");
  123.  
  124. } else {
  125. c5_3->setWhite();
  126. }
  127. Cell *c6_1=new Cell(ui->centralWidget);
  128. ui->tableWidget->setCellWidget(6,2,c6_1);
  129.  
  130. if (dc>=31)
  131. {
  132. c6_1->setText("31\n");
  133.  
  134. } else {
  135. c6_1->setText("");
  136. c6_1->setWhite();
  137. }
  138.  
  139. Cell *c6_2=new Cell(ui->centralWidget);
  140. c6_2->setText("");
  141. c6_2->setWhite();
  142. ui->tableWidget->setCellWidget(6,3,c6_2);
  143.  
  144. Cell *c6_3=new Cell(ui->centralWidget);
  145. c6_3->setText("");
  146. c6_3->setWhite();
  147. ui->tableWidget->setCellWidget(6,4,c6_3);
  148. updateMonthYear();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement