IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Qt Discussion :

Problème fenêtre centrale


Sujet :

Qt

  1. #1
    Membre confirmé

    Homme Profil pro
    Étudiant Réseaux et Télécoms
    Inscrit en
    Octobre 2009
    Messages
    121
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 33
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Étudiant Réseaux et Télécoms
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Octobre 2009
    Messages : 121
    Par défaut Problème fenêtre centrale
    Bonjour à tous,

    Je suis sur un projet et j'arriver pas afficher le centralWidget.

    Normalement quand je clique sur l'actionNouveau, alors ma fenêtre centrale devrait s'afficher mais que nenni!

    Je peux vous envoyer, le projet en entier si vous le voulez!


    main.cpp:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
     
    #include <QApplication>
    #include <QtGui>
    #include "FenPrincipale.h"
     
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
     
        FenPrincipale fenetre;
        fenetre.show();
     
        return app.exec();
    }


    FenPrincipale.cpp:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
     
    #include "FenPrincipale.h"
     
    FenPrincipale::FenPrincipale()
    {
     
        setMinimumSize(500, 350);
        setWindowIcon(QIcon("Logo.png"));
        setWindowTitle(tr("zGestionNotex"));
     
        zoneCentrale = new QWidget;
     
        setCentralWidget(zoneCentrale);
     
        creerActions();
        creerMenu();
        creerBarresOutils();
     
     
     
     
     
    }
     
    void FenPrincipale::creerActions()
    {
     
        actionNouveau = new QAction("&Créer une nouvelle Promo", this);
        actionNouveau->setIcon(QIcon("newPromo.png"));
        connect(actionNouveau, SIGNAL(triggered()), this, SLOT(nouveauPromo()));
     
        actionFichierBidon = new QAction("&FichierBidon", this);
        connect(actionFichierBidon, SIGNAL(triggered()), this, SLOT(changerPromo()));
     
        actionImprimer = new QAction("&Imprimer", this);
        actionImprimer->setIcon(QIcon("Imprimer.png"));
        connect(actionImprimer, SIGNAL(triggered()), this, SLOT(imprimer()));
     
        actionQuitter = new QAction("&Quitter", this);
        actionQuitter->setIcon(QIcon("Exit.png"));
        connect(actionQuitter, SIGNAL(triggered()), qApp, SLOT(quit()));
     
     
        actionEditerEleves= new QAction("&Ajouter/Editer Elèves",this);
        actionEditerEleves->setIcon(QIcon("Editer2.png"));
        connect(actionEditerEleves, SIGNAL(triggered()), this, SLOT(editerEleves()));
     
        actionEditerMatieres= new QAction("&Ajouter/Editer Matières",this);
        actionEditerMatieres->setIcon(QIcon("Editer.png"));
        connect(actionEditerMatieres, SIGNAL(triggered()), this, SLOT(editerMatieres()));
     
     
        actionEditerNotes= new QAction("&Ajouter/Editer Notes",this);
        actionEditerNotes->setIcon(QIcon("Editer3.png"));
        connect(actionEditerNotes, SIGNAL(triggered()), this, SLOT(editerNotes()));
     
        actionEleves= new QAction("&Elèves",this);
        actionEleves->setIcon(QIcon("Afficher.png"));
        connect(actionEleves, SIGNAL(triggered()), this, SLOT(afficherEleves()));
     
        actionMatieres= new QAction("&Matières",this);
        actionMatieres->setIcon(QIcon("Afficher.png"));
        connect(actionMatieres, SIGNAL(triggered()), this, SLOT(afficherMatieres()));
     
     
        actionModules= new QAction("&Modules",this);
        actionModules->setIcon(QIcon("Afficher.png"));
        connect(actionModules, SIGNAL(triggered()), this, SLOT(afficherModules()));
     
     
     
        actionClassement= new QAction("&Classement",this);
        actionClassement->setIcon(QIcon("Afficher.png"));
        connect(actionClassement, SIGNAL(triggered()), this, SLOT(afficherClassement()));
    }
     
    void FenPrincipale::creerMenu()
    {
     
        QMenu *menuPromo = menuBar()->addMenu("&Promo");
        menuPromo->addAction(actionNouveau);
     
        menuPromo->addAction(actionImprimer);
        menuPromo->addAction(actionQuitter);
     
     
        QMenu *menuChanger = new QMenu("&Changer de Promo", this);
        menuChanger->setIcon(QIcon("Changer.png"));
        menuChanger->addAction(actionFichierBidon);
     
        menuChanger->addMenu(menuPromo);
     
     
     
     
     
     
     
        QMenu *menuEdition = menuBar()->addMenu("&Edition");
        menuEdition->addAction(actionEditerEleves);
        menuEdition->addAction(actionEditerMatieres);
        menuEdition->addAction(actionEditerNotes);
     
     
     
     
     
        QMenu *menuAffichage = menuBar()->addMenu("&Affichage");
        menuAffichage->addAction(actionEleves);
        menuAffichage->addAction(actionMatieres);
        menuAffichage->addAction(actionModules);
        menuAffichage->addAction(actionClassement);
     
     
    }
     
    void FenPrincipale::creerBarresOutils()
    {
        QToolBar *toolBarFichier = addToolBar("Fichier");
        toolBarFichier->addAction(actionQuitter);
        toolBarFichier->addSeparator();
        toolBarFichier->addAction(actionImprimer);
        toolBarFichier->addSeparator();
        toolBarFichier->addAction(actionNouveau);
     
        toolBarFichier->addSeparator();
        toolBarFichier->addAction(actionEditerEleves);
        toolBarFichier->addAction(actionEditerMatieres);
        toolBarFichier->addAction(actionEditerNotes);
        toolBarFichier->addSeparator();
        toolBarFichier->addAction(actionEleves);
        toolBarFichier->addAction(actionMatieres);
        toolBarFichier->addAction(actionModules);
        toolBarFichier->addAction(actionClassement);
    }
     
     
    void FenPrincipale::nouveauPromo()
    {
     
        //QLabel *label = new QLabel("Bonjour les Zéros !", &zoneCentrale);
        QLineEdit *nom = new QLineEdit;
        QLineEdit *prenom = new QLineEdit;
        QLineEdit *age = new QLineEdit;
     
        QFormLayout *layout = new QFormLayout;
        layout->addRow("Votre nom", nom);
        layout->addRow("Votre prénom", prenom);
        layout->addRow("Votre âge", age);
     
        zoneCentrale->setLayout(layout);
     
    }
     
    void FenPrincipale::changerPromo()
    {
     
    }
     
    void FenPrincipale::imprimer()
    {
     
    }
     
    void FenPrincipale::editerEleves()
    {
     
    }
     
    void FenPrincipale::editerMatieres()
    {
     
    }
     
    void FenPrincipale::editerNotes()
    {
     
    }
     
    void FenPrincipale::afficherEleves()
    {
     
    }
     
    void FenPrincipale::afficherMatieres()
    {
     
    }
     
    void FenPrincipale::afficherModules()
    {
     
    }
     
    void FenPrincipale::afficherClassement()
    {
     
    }

    FenPrincipale.h:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    #ifndef HEADER_FENPRINCIPALE_INCLUDED
    #define HEADER_FENPRINCIPALE_INCLUDED
     
    #include <QtGui>
     
    class FenPrincipale : public QMainWindow
    {
         Q_OBJECT
     
    	public:
    		FenPrincipale();
     
    	private:
            void creerActions();
            void creerMenu();
            void creerBarresOutils();
     
     
        private slots:
     
            void nouveauPromo();
            void changerPromo();
            void imprimer();
            void editerEleves();
            void editerMatieres();
            void editerNotes();
            void afficherEleves();
            void afficherMatieres();
            void afficherModules();
            void afficherClassement();
     
     
    	private:
            QAction *actionNouveau;
            QAction *actionFichierBidon;
            QAction *actionImprimer;
            QAction *actionQuitter;
            QAction *actionEditerEleves;
            QAction *actionEditerMatieres;
            QAction *actionEditerNotes;
            QAction *actionEleves;
            QAction *actionMatieres;çç
            QAction *actionModules;
            QAction *actionClassement;
            QWidget *zoneCentrale;
     
     
     
    };
     
     
    #endif
    Merci de votre aide, car là je désespère un peu

  2. #2
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    70
    Détails du profil
    Informations personnelles :
    Âge : 62
    Localisation : France

    Informations forums :
    Inscription : Mars 2005
    Messages : 70
    Par défaut
    je peux dire une bétise mais ne faudrait-il pas un

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    zoneCentrale->show()
    mais bon je peux me tromper n'ayant pas testé ton code

    ou alors une fonction similaire sur le layout ?

  3. #3
    Membre confirmé

    Homme Profil pro
    Étudiant Réseaux et Télécoms
    Inscrit en
    Octobre 2009
    Messages
    121
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 33
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Étudiant Réseaux et Télécoms
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Octobre 2009
    Messages : 121
    Par défaut
    Et non, mais merci de m'avoir aider

  4. #4
    Membre expérimenté
    Profil pro
    Inscrit en
    Mars 2010
    Messages
    188
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France

    Informations forums :
    Inscription : Mars 2010
    Messages : 188
    Par défaut
    J'ai testé ton code vite fais et il marche très bien chez moi, un problème spécifique a Qt 3 ?

  5. #5
    Membre confirmé

    Homme Profil pro
    Étudiant Réseaux et Télécoms
    Inscrit en
    Octobre 2009
    Messages
    121
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 33
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Étudiant Réseaux et Télécoms
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Octobre 2009
    Messages : 121
    Par défaut
    Arg! Je me suis trompé dans les fichiers

    Voici ceux que j'utilise:

    main.cpp:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    #include <QApplication>
    #include <QtGui>
    #include "FenPrincipale.h"
     
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
     
        FenPrincipale fenetre;
        fenetre.show();
     
        return app.exec();
    }
    FenPrincipale.h:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    #ifndef HEADER_FENPRINCIPALE_INCLUDED
    #define HEADER_FENPRINCIPALE_INCLUDED
     
    #include <QtGui>
     
    class FenPrincipale : public QMainWindow
    {
        Q_OBJECT
    	public:
    		FenPrincipale();
     
    	private:
            void creerActions();
            void creerMenu();
            void creerBarresOutils();
     
     
        private slots:
     
            void nouveauPromo(QWidget *zonePromo);
            void changerPromo();
            void imprimer();
            void editerEleves();
            void editerMatieres(QWidget *zonePromo);
            void editerSujets(QWidget *zonePromo);
            void editerNotes();
            void afficherEleves();
            void afficherMatieres();
            void afficherModules();
            void afficherClassement();
     
     
    	private:
     
     
     
            QAction *actionNouveau;
            QAction *actionFichierBidon;
            QAction *actionImprimer;
            QAction *actionQuitter;
            QAction *actionEditerEleves;
            QAction *actionEditerMatieres;
            QAction *actionEditerSujets;
            QAction *actionEditerNotes;
            QAction *actionEleves;
            QAction *actionMatieres;
            QAction *actionModules;
            QAction *actionClassement;
     
     
     
     
    };
     
     
    #endif

    FenPrincipale.cpp:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    #include "FenPrincipale.h"
    #include "ongletPromo.h"
    #include "ongletMatieres.h"
    #include "ongletSujet.h"
     
    FenPrincipale::FenPrincipale()
    {
     
       // setMinimumSize(500, 350);
        setWindowIcon(QIcon("Logo.png"));
        setWindowTitle(tr("zGestionNotex"));
     
        QWidget *zonePromo = new QWidget();
     
        //OngletMatieres *ongletMatieres= new OngletMatieres(zonePromo);
     
     
     
        creerActions();
        creerMenu();
        creerBarresOutils();
     
     
     
        setCentralWidget(zonePromo);
     
    }
     
    void FenPrincipale::creerActions()
    {
     
        actionNouveau = new QAction("&Créer une nouvelle Promo", this);
        actionNouveau->setIcon(QIcon("newPromo.png"));
        connect(actionNouveau, SIGNAL(triggered()), this, SLOT(nouveauPromo(zonePromo)));
     
        actionFichierBidon = new QAction("&FichierBidon", this);
        connect(actionFichierBidon, SIGNAL(triggered()), this, SLOT(changerPromo()));
     
        actionImprimer = new QAction("&Imprimer", this);
        actionImprimer->setIcon(QIcon("Imprimer.png"));
        connect(actionImprimer, SIGNAL(triggered()), this, SLOT(imprimer()));
     
        actionQuitter = new QAction("&Quitter", this);
        actionQuitter->setIcon(QIcon("Exit.png"));
        connect(actionQuitter, SIGNAL(triggered()), qApp, SLOT(quit()));
     
     
        actionEditerEleves= new QAction("&Ajouter/Editer Elèves",this);
        actionEditerEleves->setIcon(QIcon("Editer2.png"));
        connect(actionEditerEleves, SIGNAL(triggered()), this, SLOT(editerEleves()));
     
        actionEditerMatieres= new QAction("&Ajouter/Editer Matières",this);
        actionEditerMatieres->setIcon(QIcon("Editer.png"));
        connect(actionEditerMatieres, SIGNAL(triggered()), this, SLOT(editerMatieres()));
     
        actionEditerSujets= new QAction("&Ajouter/Editer Sujets",this);
        actionEditerSujets->setIcon(QIcon("Editer.png"));
        connect(actionEditerSujets, SIGNAL(triggered()), this, SLOT(editerSujets()));
     
     
        actionEditerNotes= new QAction("&Ajouter/Editer Notes",this);
        actionEditerNotes->setIcon(QIcon("Editer3.png"));
        connect(actionEditerNotes, SIGNAL(triggered()), this, SLOT(editerNotes()));
     
        actionEleves= new QAction("&Elèves",this);
        actionEleves->setIcon(QIcon("Afficher.png"));
        connect(actionEleves, SIGNAL(triggered()), this, SLOT(afficherEleves()));
     
        actionMatieres= new QAction("&Matières",this);
        actionMatieres->setIcon(QIcon("Afficher.png"));
        connect(actionMatieres, SIGNAL(triggered()), this, SLOT(afficherMatieres()));
     
     
        actionModules= new QAction("&Modules",this);
        actionModules->setIcon(QIcon("Afficher.png"));
        connect(actionModules, SIGNAL(triggered()), this, SLOT(afficherModules()));
     
     
     
        actionClassement= new QAction("&Classement",this);
        actionClassement->setIcon(QIcon("Afficher.png"));
        connect(actionClassement, SIGNAL(triggered()), this, SLOT(afficherClassement()));
    }
     
    void FenPrincipale::creerMenu()
    {
     
        QMenu *menuPromo = menuBar()->addMenu("&Promo");
        menuPromo->addAction(actionNouveau);
     
        menuPromo->addAction(actionImprimer);
        menuPromo->addAction(actionQuitter);
     
     
        QMenu *menuChanger = new QMenu("&Changer de Promo", this);
        menuChanger->setIcon(QIcon("Changer.png"));
        menuChanger->addAction(actionFichierBidon);
     
        menuChanger->addMenu(menuPromo);
     
     
     
     
     
     
     
        QMenu *menuEdition = menuBar()->addMenu("&Edition");
        menuEdition->addAction(actionEditerEleves);
        menuEdition->addAction(actionEditerMatieres);
        menuEdition->addAction(actionEditerSujets);
        menuEdition->addAction(actionEditerNotes);
     
     
     
     
     
        QMenu *menuAffichage = menuBar()->addMenu("&Affichage");
        menuAffichage->addAction(actionEleves);
        menuAffichage->addAction(actionMatieres);
        menuAffichage->addAction(actionModules);
        menuAffichage->addAction(actionClassement);
     
     
    }
     
    void FenPrincipale::creerBarresOutils()
    {
        QToolBar *toolBarFichier = addToolBar("Fichier");
        toolBarFichier->addAction(actionQuitter);
        toolBarFichier->addSeparator();
        toolBarFichier->addAction(actionImprimer);
        toolBarFichier->addSeparator();
        toolBarFichier->addAction(actionNouveau);
     
        toolBarFichier->addSeparator();
        toolBarFichier->addAction(actionEditerEleves);
        toolBarFichier->addAction(actionEditerMatieres);
        toolBarFichier->addAction(actionEditerSujets);
        toolBarFichier->addAction(actionEditerNotes);
        toolBarFichier->addSeparator();
        toolBarFichier->addAction(actionEleves);
        toolBarFichier->addAction(actionMatieres);
        toolBarFichier->addAction(actionModules);
        toolBarFichier->addAction(actionClassement);
    }
     
     
    void FenPrincipale::nouveauPromo(QWidget *zonePromo)
    {
     
        OngletPromo *ongletPromo = new OngletPromo(zonePromo);
     
     
       // setCentralWidget(zoneCentrale);
     
    }
     
    void FenPrincipale::changerPromo()
    {
     
    }
     
    void FenPrincipale::imprimer()
    {
     
    }
     
    void FenPrincipale::editerEleves()
    {
     
    }
     
    void FenPrincipale::editerMatieres(QWidget *zonePromo)
    {
        OngletMatieres *ongletMatieres= new OngletMatieres(zonePromo);
     
     
    }
     
    void FenPrincipale::editerSujets(QWidget *zonePromo)
    {
        OngletSujets *ongletSujets=new OngletSujets(zonePromo);
    }
     
     
    void FenPrincipale::editerNotes()
    {
     
    }
     
    void FenPrincipale::afficherEleves()
    {
     
    }
     
    void FenPrincipale::afficherMatieres()
    {
     
    }
     
    void FenPrincipale::afficherModules()
    {
     
    }
     
    void FenPrincipale::afficherClassement()
    {
     
    }
    ongletPromo.h:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    #ifndef ONGLETPROMO_H_INCLUDED
    #define ONGLETPROMO_H_INCLUDED
     
    #include <QtGui>
     
    class OngletPromo : public QMainWindow
    {
        Q_OBJECT
    	public:
    		OngletPromo(QWidget *zonePromo);
     
    	private:
     
     
     
        private slots:
     
            void demandeConfirmation();
     
     
     
    	private:
     
     
            QSpinBox *promo;
            QSpinBox *promoNombre;
     
     
     
     
     
     
    };
     
    #endif // ONGLETPROMO_H_INCLUDED
    ongletPromo.cpp:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    #include "ongletPromo.h"
     
    OngletPromo::OngletPromo(QWidget *zonePromo)
    {
     
     
        promo= new QSpinBox;
        promoNombre= new QSpinBox;
        QVBoxLayout *grr= new QVBoxLayout;
     
        QFormLayout *layoutInformations= new QFormLayout;
        layoutInformations->addRow("Promo: ",promo);
        layoutInformations->addRow("Nombre d'élèves : ",promoNombre);
     
     
        promo->setMinimum(2000);
        promo->setMaximum(2050);
        promoNombre->setMinimum(1);
        promoNombre->setMaximum(250);
     
        QHBoxLayout *layoutBouton=new QHBoxLayout;
     
        QPushButton *boutonValider= new QPushButton("Valider");
        boutonValider->setIcon(QIcon("Valider.png"));
     
        layoutBouton->setAlignment(Qt::AlignRight);
     
        layoutBouton->addWidget(boutonValider);
     
     
     
     
     
     
        QGroupBox *promoInformations= new QGroupBox("Informations sur la Promo");
     
        promoInformations->setLayout(layoutInformations);
     
     
        grr->addWidget(promoInformations);
        grr->addLayout(layoutBouton);
     
        zonePromo->setLayout(grr);
     
     
        connect(boutonValider,SIGNAL(clicked()),this,SLOT(demandeConfirmation()));
     
     
    }
     
    void OngletPromo::demandeConfirmation()
    {
     
     
        QMessageBox::question(this, "Demande de confirmation", "Etes-vous sûr de bien vouloir enregistrer cette Promo?", QMessageBox::Yes | QMessageBox::No);
     
     
     
     
    }
    ongletMatieres.h:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    #ifndef ONGLETMATIERES_H_INCLUDED
    #define ONGLETMATIERES_H_INCLUDED
     
     
     
    #include <QtGui>
     
    class OngletMatieres : public QMainWindow
    {
        Q_OBJECT
    	public:
    		OngletMatieres(QWidget *zonePromo);
     
    	private:
     
     
     
        private slots:
     
            void demandeConfirmation();
     
     
     
    	private:
     
     
            QSpinBox *matiereCoefficient;
            QSpinBox *matiereUe;
            QSpinBox *matiereSemestre;
            QLineEdit *matiereNom;
            QSpinBox *matiereAnnee;
            QLineEdit *sujetNom;
            QSpinBox *sujetCoefficient;
     
     
     
     
     
     
     
    };
     
     
     
     
    #endif // ONGLETMATIERES_H_INCLUDED
    ongletMatieres.cpp:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    #include "ongletMatieres.h"
     
    OngletMatieres::OngletMatieres(QWidget *zonePromo)
    {
     
     
        matiereCoefficient= new QSpinBox;
        matiereUe= new QSpinBox;
        matiereAnnee= new QSpinBox;
        matiereSemestre= new QSpinBox;
        matiereNom= new QLineEdit;
     
        QVBoxLayout *grr= new QVBoxLayout;
     
        QFormLayout *layoutInformations= new QFormLayout;
        layoutInformations->addRow("Nom de la Matière: ",matiereNom);
        layoutInformations->addRow("Coefficient de la matière: ",matiereCoefficient);
        layoutInformations->addRow("L'UE dont elle est attachée: ",matiereUe);
        layoutInformations->addRow("Le semestre dont elle est attachée: ",matiereSemestre);
        layoutInformations->addRow("1ère Année ou 2nde Année: ",matiereAnnee);
     
     
        matiereCoefficient->setMinimum(1);
        matiereCoefficient->setMaximum(15);
        matiereUe->setMinimum(1);
        matiereUe->setMaximum(5);
        matiereSemestre->setMinimum(1);
        matiereSemestre->setMaximum(2);
        matiereAnnee->setMinimum(1);
        matiereAnnee->setMaximum(5);
     
     
     
     
        QHBoxLayout *layoutBouton=new QHBoxLayout;
     
        QPushButton *boutonValider= new QPushButton("Valider");
        boutonValider->setIcon(QIcon("Valider.png"));
     
        layoutBouton->setAlignment(Qt::AlignRight);
     
        layoutBouton->addWidget(boutonValider);
     
     
     
     
     
     
        QGroupBox *matiereInformations= new QGroupBox("Création de la Matière");
     
     
       matiereInformations->setLayout(layoutInformations);
     
     
        grr->addWidget(matiereInformations);
        grr->addLayout(layoutBouton);
     
        zonePromo->setLayout(grr);
     
     
        connect(boutonValider,SIGNAL(clicked()),this,SLOT(demandeConfirmation()));
     
     
    }
     
    void OngletMatieres::demandeConfirmation()
    {
     
     
        QMessageBox::question(this, "Demande de confirmation", "Etes-vous sûr de bien vouloir enregistrer cette Matiere?", QMessageBox::Yes | QMessageBox::No);
     
     
     
     
    }

Discussions similaires

  1. Problème fenêtre arrière-plan avec fvwm
    Par okuri dans le forum Linux
    Réponses: 0
    Dernier message: 26/03/2009, 15h13
  2. Problème fenêtres Appli MDI
    Par House MD dans le forum Windows Forms
    Réponses: 14
    Dernier message: 21/10/2008, 11h18
  3. Problème: fenêtres grisées avec JOptionPane
    Par zafo dans le forum Débuter
    Réponses: 2
    Dernier message: 28/09/2008, 21h28
  4. Problème fenêtre cible "_blank"
    Par oops! dans le forum Flash
    Réponses: 6
    Dernier message: 16/09/2006, 14h48
  5. problème fenêtre plein écran
    Par chti_juanito dans le forum AWT/Swing
    Réponses: 13
    Dernier message: 01/02/2006, 19h13

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo