Partage
  • Partager sur Facebook
  • Partager sur Twitter

[Qt4.3.1] Pb de namespace

Sujet résolu
    27 août 2007 à 23:52:57

    salut le monde,

    Il y a peu de temps je me suis lancer dans Qt sa marchait plutot bien jusqu'au moment ou j'ai essayer de travailler avec l'heritage peut etre que mon erreur vien de la je n'en sai rien.
    Si quelq'un pouvai jetter un oeuil sur mon code sa serai simpa.

    Voici mon erreur:

    C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\include\c++\3.4.2\iostream:48: error: expected unqualified-id before "namespace"
    C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\include\c++\3.4.2\iostream:48: error: expected `,' or `;' before "namespace"
    :: === Build finished: 2 errors, 0 warnings ===


    et voci mon code:

    main.cpp:
    1. #include <qapplication.h>
    2. #include "window_tray.h"
    3. int main(int argc, char **argv)
    4. {
    5.     QApplication app(argc, argv);
    6.     QApplication::setQuitOnLastWindowClosed(false);
    7.     window_tray WattCont;
    8.     return app.exec();
    9. }


    window_tray.h:
    1. #ifndef WINDOW_TRAY_H
    2. #define WINDOW_TRAY_H
    3. #include <QSystemTrayIcon.h>
    4. #include "ui_WattContQt_main_dialog.h"
    5. class window_tray : public Ui::Form
    6. {
    7. public:
    8.     window_tray();
    9. private slots:
    10.     void tray_active(QSystemTrayIcon::ActivationReason reason);
    11. }
    12. #endif


    ui_WattContQt_main_dialog.h:
    1. /********************************************************************************
    2. ** Form generated from reading ui file 'WattContQt_main_dialog.ui'
    3. **
    4. ** Created: Tue 14. Aug 20:38:59 2007
    5. **      by: Qt User Interface Compiler version 4.3.1
    6. **
    7. ** WARNING! All changes made in this file will be lost when recompiling ui file!
    8. ********************************************************************************/
    9. #ifndef UI_WATTCONTQT_MAIN_DIALOG_H
    10. #define UI_WATTCONTQT_MAIN_DIALOG_H
    11. #include <QtCore/QVariant>
    12. #include <QtGui/QAction>
    13. #include <QtGui/QApplication>
    14. #include <QtGui/QButtonGroup>
    15. #include <QtGui/QLabel>
    16. #include <QtGui/QWidget>
    17. class Ui_Form
    18. {
    19. public:
    20.     QLabel *affichage_chrono;
    21.     void setupUi(QWidget *Form)
    22.     {
    23.     if (Form->objectName().isEmpty())
    24.         Form->setObjectName(QString::fromUtf8("Form"));
    25.     Form->resize(310, 60);
    26.     Form->setMinimumSize(QSize(310, 60));
    27.     Form->setMaximumSize(QSize(310, 60));
    28.     Form->setWindowIcon(QIcon(QString::fromUtf8(":/ico/WattContQt_ico.png")));
    29.     affichage_chrono = new QLabel(Form);
    30.     affichage_chrono->setObjectName(QString::fromUtf8("affichage_chrono"));
    31.     affichage_chrono->setGeometry(QRect(10, 10, 290, 42));
    32.     QFont font;
    33.     font.setFamily(QString::fromUtf8("DS Digital"));
    34.     font.setPointSize(31);
    35.     font.setBold(true);
    36.     font.setItalic(false);
    37.     font.setUnderline(false);
    38.     font.setWeight(75);
    39.     font.setStrikeOut(false);
    40.     font.setKerning(false);
    41.     font.setStyleStrategy(QFont::PreferDefault);
    42.     affichage_chrono->setFont(font);
    43.     affichage_chrono->setAlignment(Qt::AlignCenter);
    44.     retranslateUi(Form);
    45.     QMetaObject::connectSlotsByName(Form);
    46.     } // setupUi
    47.     void retranslateUi(QWidget *Form)
    48.     {
    49.     Form->setWindowTitle(QApplication::translate("Form", "WattContQt", 0, QApplication::UnicodeUTF8));
    50.     affichage_chrono->setToolTip(QApplication::translate("Form", "Affiche l'\303\251galit\303\251 temps \303\251coul\303\251 = consomation", 0, QApplication::UnicodeUTF8));
    51.     affichage_chrono->setText(QApplication::translate("Form", "00:00 = 0000.00W", 0, QApplication::UnicodeUTF8));
    52.     Q_UNUSED(Form);
    53.     } // retranslateUi
    54. };
    55. namespace Ui {
    56.     class Form: public Ui_Form {};
    57. } // namespace Ui
    58. #endif // UI_WATTCONTQT_MAIN_DIALOG_H


    window_tray.cpp
    1. #include "window_tray.h"
    2. window_tray::window_tray()
    3. {
    4.     QWidget *window = new QWidget();
    5.     Ui_Form fenetre;
    6.     fenetre.setupUi(window);
    7.     QSystemTrayIcon * icon =new QSystemTrayIcon(QIcon (":/ico/WattContQt_ico.png"));
    8.     icon->setVisible(true);
    9.     QObject::connect(icon,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(tray_active(QSystemTrayIcon::ActivationReason)));
    10. }
    11. void window_tray::tray_active(QSystemTrayIcon::ActivationReason reason)
    12. {
    13.     switch(reason)
    14.     {
    15.         case QSystemTrayIcon::DoubleClick:
    16.             Ui_Form::retranslateUi(window);
    17.         break;
    18.         default:;
    19.     }
    20. }


    Merci d'avance pour l'aide que vou maporterai.

    Ps : je suis sous C::B
    • Partager sur Facebook
    • Partager sur Twitter
      27 août 2007 à 23:57:25

      tu n'as rien d'autre comme erreur ?
      • Partager sur Facebook
      • Partager sur Twitter
        27 août 2007 à 23:58:31

        Euhhh jai fait une grosse erreur :D

        Merci quandkan meme pour l'interret que tu ma porter
        • Partager sur Facebook
        • Partager sur Twitter

        [Qt4.3.1] Pb de namespace

        × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
        × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
        • Editeur
        • Markdown