Bonjour,

J'ai donc mon programme presque finit, j'ai ajouté une fenêtre en QT Designer soit sous forme de configuration.ui

J'ai tous compiler et je l'ai intégré. J'ai donc ma fenêtre de configuration qui marche à 10%, il y a juste la fenêtre mais toutes les options à l'intérieur ne fonctionne pas...

Il y a comme option par exemple :
- navigateur par défault pour ouvrir les liens web.
- Lancement du programme au démarrage de windows activer ou désactiver.
- Plus des bricole...

Je voudrais donc que c'est option marche... Je sais que sais possible car j'ai vu un autre programme utiliser ça mais je sais pas du tout comment faire pour...

Voici mes bouts de code :

Fichier tool.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
 
#ifndef TOOL_H
#define TOOL_H
 
#include \"about.h\"
#include \"configuration.h\"
#include <QSystemTrayIcon>
#include <QXmlStreamReader>
 
class Menu;
 
class Tool : public QSystemTrayIcon
{
        Q_OBJECT
 
        public:
                Tool();
 
        private slots:
                void open();
                void iconActivated(QSystemTrayIcon::ActivationReason);
                void about();
                void config();
 
        private:
                void createTrayIcon();
                void createList();
 
                QMenu *trayIconMenu;
                Ui::Dialog uiAbout;
                Ui::Config uiConfig;
};
 
#endif

Fichier tool.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
 
#include <QtGui>
#include \"tool.h\"
 
Tool::Tool()
{
        setIcon(QIcon(\":/images/icone.png\"));
 
        // creation du menu
        trayIconMenu = new QMenu;
 
        // creation de la liste
        createList();   
        createTrayIcon();
}
 
void Tool::open()
{
        QAction *action = qobject_cast<QAction *>(sender());
        if(action)
        {
                // ouverture de la page internet
                QDesktopServices::openUrl(action->data().toString());
        }
}
 
void Tool::iconActivated(QSystemTrayIcon::ActivationReason reason)
{
        // si on clique gauche
        if(reason == QSystemTrayIcon::Trigger)
                QDesktopServices::openUrl(QString(\"http://www.site.fr/\"));
}
 
void Tool::about()
{
     QDialog* fenAbout = new QDialog;
     uiAbout.setupUi(fenAbout);
     fenAbout->exec();
}
 
void Tool::config()
{
    QDialog* fenConfig = new QDialog;
    uiConfig.setupUi(fenConfig);
    fenConfig->exec();
}
 
void Tool::createTrayIcon()
{
        // creation de quelques actions
        QAction *quitAction = new QAction(tr(\"&Quitter\"), this);
        connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
 
        // ajout dans le menu
        QAction *aboutAction = new QAction(tr(\"A propos\"), this);
        connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
 
        // ajout dans le menu
        QAction* configAction = new QAction(tr(\"Configuration\"), this);
        connect(configAction, SIGNAL(triggered()), this, SLOT(config()));
 
        trayIconMenu->addSeparator();
    trayIconMenu->addAction(configAction);
        trayIconMenu->addAction(aboutAction);
        trayIconMenu->addAction(quitAction);
 
        // zone de notification et ajout du menu
        setContextMenu(trayIconMenu);
        connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
 
        show();
}
...
...

Fichier configuration.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
 
/********************************************************************************
** Form generated from reading ui file \'configuration.ui\'
**
** Created: Tue 22. Jan 20:53:00 2008
**      by: Qt User Interface Compiler version 4.3.3
**
** WARNING! All changes made in this file will be lost when recompiling ui file!
********************************************************************************/
 
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
 
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QComboBox>
#include <QtGui/QDialog>
#include <QtGui/QGroupBox>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QPushButton>
#include <QtGui/QToolButton>
 
class Ui_Dialog
{
public:
    QGroupBox *groupBox;
    QPushButton *pushButton_2;
    QPushButton *pushButton;
    QToolButton *toolButton;
    QLabel *label;
    QGroupBox *groupBox_2;
    QLabel *label_2;
    QPushButton *pushButton_3;
    QComboBox *comboBox;
    QGroupBox *groupBox_3;
    QPushButton *pushButton_4;
    QLabel *label_3;
    QLabel *label_4;
    QLineEdit *lineEdit_2;
    QLineEdit *lineEdit;
    QLabel *label_5;
    QGroupBox *groupBox_4;
    QPushButton *pushButton_6;
    QPushButton *pushButton_5;
 
    void setupUi(QDialog *Dialog)
    {
    if (Dialog->objectName().isEmpty())
        Dialog->setObjectName(QString::fromUtf8(\"Dialog\"));
    Dialog->resize(551, 359);
    groupBox = new QGroupBox(Dialog);
    groupBox->setObjectName(QString::fromUtf8(\"groupBox\"));
    groupBox->setGeometry(QRect(10, 10, 531, 81));
    pushButton_2 = new QPushButton(groupBox);
    pushButton_2->setObjectName(QString::fromUtf8(\"pushButton_2\"));
    pushButton_2->setGeometry(QRect(210, 20, 121, 25));
    QFont font;
    font.setBold(true);
    font.setWeight(75);
    pushButton_2->setFont(font);
    pushButton = new QPushButton(groupBox);
    pushButton->setObjectName(QString::fromUtf8(\"pushButton\"));
    pushButton->setGeometry(QRect(20, 20, 111, 25));
    pushButton->setFont(font);
    toolButton = new QToolButton(groupBox);
    toolButton->setObjectName(QString::fromUtf8(\"toolButton\"));
    toolButton->setGeometry(QRect(400, 20, 111, 21));
    toolButton->setFont(font);
    label = new QLabel(groupBox);
    label->setObjectName(QString::fromUtf8(\"label\"));
    label->setGeometry(QRect(90, 50, 348, 28));
    groupBox_2 = new QGroupBox(Dialog);
    groupBox_2->setObjectName(QString::fromUtf8(\"groupBox_2\"));
    groupBox_2->setGeometry(QRect(10, 100, 531, 71));
    label_2 = new QLabel(groupBox_2);
    label_2->setObjectName(QString::fromUtf8(\"label_2\"));
    label_2->setGeometry(QRect(40, 50, 466, 16));
    pushButton_3 = new QPushButton(groupBox_2);
    pushButton_3->setObjectName(QString::fromUtf8(\"pushButton_3\"));
    pushButton_3->setGeometry(QRect(340, 20, 171, 25));
    pushButton_3->setFont(font);
    comboBox = new QComboBox(groupBox_2);
    comboBox->setObjectName(QString::fromUtf8(\"comboBox\"));
    comboBox->setGeometry(QRect(20, 20, 311, 22));
    comboBox->setMouseTracking(false);
    groupBox_3 = new QGroupBox(Dialog);
    groupBox_3->setObjectName(QString::fromUtf8(\"groupBox_3\"));
    groupBox_3->setGeometry(QRect(10, 180, 531, 101));
    pushButton_4 = new QPushButton(groupBox_3);
    pushButton_4->setObjectName(QString::fromUtf8(\"pushButton_4\"));
    pushButton_4->setGeometry(QRect(360, 20, 151, 25));
    pushButton_4->setFont(font);
    label_3 = new QLabel(groupBox_3);
    label_3->setObjectName(QString::fromUtf8(\"label_3\"));
    label_3->setGeometry(QRect(20, 20, 61, 16));
    label_4 = new QLabel(groupBox_3);
    label_4->setObjectName(QString::fromUtf8(\"label_4\"));
    label_4->setGeometry(QRect(180, 20, 68, 16));
    lineEdit_2 = new QLineEdit(groupBox_3);
    lineEdit_2->setObjectName(QString::fromUtf8(\"lineEdit_2\"));
    lineEdit_2->setGeometry(QRect(80, 20, 91, 20));
    lineEdit = new QLineEdit(groupBox_3);
    lineEdit->setObjectName(QString::fromUtf8(\"lineEdit\"));
    lineEdit->setGeometry(QRect(260, 20, 91, 20));
    lineEdit->setEchoMode(QLineEdit::Password);
    label_5 = new QLabel(groupBox_3);
    label_5->setObjectName(QString::fromUtf8(\"label_5\"));
    label_5->setGeometry(QRect(40, 50, 458, 42));
    groupBox_4 = new QGroupBox(Dialog);
    groupBox_4->setObjectName(QString::fromUtf8(\"groupBox_4\"));
    groupBox_4->setGeometry(QRect(9, 300, 531, 51));
    pushButton_6 = new QPushButton(groupBox_4);
    pushButton_6->setObjectName(QString::fromUtf8(\"pushButton_6\"));
    pushButton_6->setGeometry(QRect(280, 20, 141, 25));
    pushButton_6->setFont(font);
    pushButton_5 = new QPushButton(groupBox_4);
    pushButton_5->setObjectName(QString::fromUtf8(\"pushButton_5\"));
    pushButton_5->setGeometry(QRect(90, 20, 141, 25));
    pushButton_5->setFont(font);
 
    retranslateUi(Dialog);
 
    QMetaObject::connectSlotsByName(Dialog);
    } // setupUi
 
    void retranslateUi(QDialog *Dialog)
    {
    Dialog->setWindowTitle(QApplication::translate(\"Dialog\", \"Configuration de site\", 0, QApplication::UnicodeUTF8));
    groupBox->setTitle(QApplication::translate(\"Dialog\", \"Navigateur\", 0, QApplication::UnicodeUTF8));
    pushButton_2->setText(QApplication::translate(\"Dialog\", \"Mozilla Firefox\", 0, QApplication::UnicodeUTF8));
    pushButton->setText(QApplication::translate(\"Dialog\", \"Internet Explorer\", 0, QApplication::UnicodeUTF8));
    toolButton->setText(QApplication::translate(\"Dialog\", \"S\\303\\251l\\303\\251ctionner...\", 0, QApplication::UnicodeUTF8));
    label->setText(QApplication::translate(\"Dialog\", \"Choisissez le navigateur que vous souhaitez utiliser avec Site.\\n\"
\"Vous pouvez \\303\\251galement d\\303\\251finir l\'\\303\\251x\\303\\251cutable de votre navigateur pr\\303\\251f\\303\\251r\\303\\251.\", 0, QApplication::UnicodeUTF8));
    groupBox_2->setTitle(QApplication::translate(\"Dialog\", \"Action clic gauche\", 0, QApplication::UnicodeUTF8));
    label_2->setText(QApplication::translate(\"Dialog\", \"Cette option vous permet de d\\303\\251finir l\'action du double clic gauche ou droit sur l\'ic\\303\\264ne Site.\", 0, QApplication::UnicodeUTF8));
    pushButton_3->setText(QApplication::translate(\"Dialog\", \"Appliquer\", 0, QApplication::UnicodeUTF8));
    groupBox_3->setTitle(QApplication::translate(\"Dialog\", \"Site Officiel\", 0, QApplication::UnicodeUTF8));
    pushButton_4->setText(QApplication::translate(\"Dialog\", \"Appliquer\", 0, QApplication::UnicodeUTF8));
    label_3->setText(QApplication::translate(\"Dialog\", \"Utilisateur:\", 0, QApplication::UnicodeUTF8));
    label_4->setText(QApplication::translate(\"Dialog\", \"Mot de passe:\", 0, QApplication::UnicodeUTF8));
    label_5->setText(QApplication::translate(\"Dialog\", \"Avoir acc\\303\\250s au syst\\303\\250me de message priv\\303\\251, derni\\303\\250re news et pouvoir poster directement.\\n\"
\"Astuces: Lorsque que vos acc\\303\\250s sont fourni \\303\\247i dessus, lors du clic gauche\\n\"
\"sur le \'Forum\' disponible au clic droit, vous arriverez sur le forum directement connect\\303\\251 !\", 0, QApplication::UnicodeUTF8));
    groupBox_4->setTitle(QApplication::translate(\"Dialog\", \"Lancer au d\\303\\251marrage\", 0, QApplication::UnicodeUTF8));
    pushButton_6->setText(QApplication::translate(\"Dialog\", \"D\\303\\251sactiver\", 0, QApplication::UnicodeUTF8));
    pushButton_5->setText(QApplication::translate(\"Dialog\", \"Activer\", 0, QApplication::UnicodeUTF8));
    Q_UNUSED(Dialog);
    } // retranslateUi
 
};
 
namespace Ui {
    class Dialog: public Ui_Dialog {};
} // namespace Ui
 
#endif // CONFIGURATION_H