1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
#include "GlobalesProcedures.h" //<-- ini
#include "mainwindow.h" //<-- ini
#include "head.h" //<-- ini
#include "navigants.h" //<-- ini
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
QProcess::execute("CLS");
this->setWindowTitle("Aide à la création de plannings");
this->setStyleSheet("QMainWindow {border: 2px solid; border-radius: 5px; Text-align:center;background-color:#000000;}");
this->setStyleSheet("QMainWindow {color: rgb(00,00,88); background-color:#FFFFFF;}");
this->setWindowState(Qt::WindowMaximized);
double myScreenW = screen()->geometry().width();
double myScreenH = screen()->geometry().height()/2;
this->setMinimumSize(myScreenW, myScreenH);
widgetPrincipal = new QWidget(this);
//QPushButton* b0 = new QPushButton("b0", widgetPrincipal); b0->setFixedSize(40, 900);
QPushButton* b1 = new QPushButton("b1", widgetPrincipal); b1->setVisible(false);
//QPushButton* b2 = new QPushButton("b2", widgetPrincipal);
QPushButton* b3 = new QPushButton("b3", widgetPrincipal);
//QPushButton* b4 = new QPushButton("b4", widgetPrincipal); b4->setFixedSize(2000, 2000);
QPushButton* b4 = new QPushButton("b4", widgetPrincipal);
//QPushButton* b5 = new QPushButton("b5", widgetPrincipal);
//QPushButton* b6 = new QPushButton("b6", widgetPrincipal);
//
// |---------------------|-----------------|---------|
// | 0,0 | 0,1 | 0,2,2,1 | grilleLayout-->addWidget(widget,ligne,colonne, span, span);
// |---------------------|-----------------| |
// | 1,0 | 1,1 | |
// | | | |
// | | | |
// | | | |
// |---------------------|-----------------|---------|
// | 2,0,2,3 |
// |-------------------------------------------------|
//
// 1.1 Instantiation des layouts
grilleLayout = new QGridLayout;
widgetPrincipal->setLayout(grilleLayout); // attribue le layout grille au widgetPrincipal
scrollArea_01 = new QScrollArea; contentWidget_01 = new QWidget; scrollArea_01->setWidget(contentWidget_01);
scrollArea_10 = new QScrollArea; contentWidget_10 = new QWidget; scrollArea_10->setWidget(contentWidget_10);
scrollArea_11 = new QScrollArea; contentWidget_11 = new QWidget; scrollArea_11->setWidget(contentWidget_11);
verticalLayout_01 = new QVBoxLayout; contentWidget_01->setLayout(verticalLayout_01);
verticalLayout_10 = new QVBoxLayout; contentWidget_10->setLayout(verticalLayout_10);
verticalLayout_11 = new QVBoxLayout; contentWidget_11->setLayout(verticalLayout_11);
grilleLayout->addWidget(b1,0,0); b1->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum); b1->setFixedWidth(100);
grilleLayout->addWidget(scrollArea_01,0,1); scrollArea_01->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Maximum); scrollArea_01->setFixedHeight(85);
grilleLayout->addWidget(b3,0,2,2,1); b3->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Minimum);
grilleLayout->addWidget(scrollArea_10,1,0); scrollArea_10->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Minimum); scrollArea_10->setFixedWidth(100);
grilleLayout->addWidget(scrollArea_11,1,1);
grilleLayout->addWidget(b4,2,0,2,3);
b1->setFixedSize(scrollArea_10->width(), scrollArea_01->height());
scrollArea_01->setStyleSheet("QScrollArea {border: 2px solid; border-radius: 5px; Text-align:center;background-color:#FFFFFF;}");
scrollArea_10->setStyleSheet("QScrollArea {border: 2px solid; border-radius: 5px; Text-align:center;background-color:#FFFFFF;}");
scrollArea_11->setStyleSheet("QScrollArea {border: 2px solid; border-radius: 5px; Text-align:center;background-color:#FFFFFF;}");
scrollBar_01 = new QScrollBar(scrollArea_01);
scrollBar_10 = new QScrollBar(scrollArea_10);
scrollBar_11_V = new QScrollBar(scrollArea_11);
scrollBar_11_H = new QScrollBar(scrollArea_11);
scrollArea_01->setHorizontalScrollBar(scrollBar_01); //
scrollArea_01->setWidgetResizable(true); //
scrollArea_01->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //
scrollArea_01->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //
scrollArea_01->setAlignment(Qt::AlignLeft); //
scrollArea_01->setStyleSheet("QScrollArea {border: 2px solid; border-radius: 5px; Text-align:center;background-color:#FFFFFF;}");
scrollArea_10->setVerticalScrollBar(scrollBar_10); //
scrollArea_10->setWidgetResizable(true); //
scrollArea_10->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //
scrollArea_10->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //
scrollArea_10->setAlignment(Qt::AlignLeft); //
scrollArea_10->setStyleSheet("QScrollArea {border: 2px solid; border-radius: 5px; Text-align:center;background-color:#FFFFFF;}");
scrollArea_11->setVerticalScrollBar(scrollBar_11_V); //
scrollArea_11->setHorizontalScrollBar(scrollBar_11_H); //
scrollArea_11->setWidgetResizable(true); //
scrollArea_11->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); //
scrollArea_11->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); //
scrollArea_11->setAlignment(Qt::AlignLeft); //
scrollArea_11->setStyleSheet("QScrollArea {border: 2px solid; border-radius: 5px; Text-align:center;background-color:#FFFFFF;}");
connect(scrollBar_11_V, SIGNAL(valueChanged(int)), SLOT(controlerScrollArea_10(int)));
connect(scrollBar_11_H, SIGNAL(valueChanged(int)), SLOT(controlerScrollArea_01(int)));
QWidget* entete = new head(contentWidget_01); // Crée le widget "head",
verticalLayout_01->addWidget(entete,0 , Qt::AlignTop); // le place dans le verticalLayout_01
verticalLayout_01->setSpacing(0); // le positionne sans espace
verticalLayout_01->setContentsMargins(0,1,0,0); // au plus haut à gauche
contentWidget_01->setStyleSheet("QWidget {background-color:#CCFFFF;}");
//Personnel p;
perso.nom[0] = "azerty";
QWidget* personnel = new navigants(contentWidget_10, pstr); // Crée le widget "personnel",
verticalLayout_10->addWidget(personnel,0 , Qt::AlignTop); // le place dans le verticalLayout_10
verticalLayout_10->setSpacing(0); // le positionne sans espace
verticalLayout_10->setContentsMargins(0,0,0,0); // au plus haut à gauche
//contentWidget_10->setStyleSheet("QWidget {background-color:#CCFFFF;}");
int i = 0;
do {
QLabel* lab = new QLabel(QString::number(i), contentWidget_10);
verticalLayout_10->addWidget(lab);
QString s = " : ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ---------------";
QLabel* lab2 = new QLabel(QString::number(i)+s, contentWidget_11);
verticalLayout_11->addWidget(lab2);
i++;
} while (i<100);
setCentralWidget(widgetPrincipal);
}
void MainWindow::controlerScrollArea_01(int value) {scrollBar_01->setValue(value);}
void MainWindow::controlerScrollArea_10(int value) {scrollBar_10->setValue(value);}
MainWindow::~MainWindow(){} |
Partager