×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 22

Thread: QDialog problem

  1. #1
    Regular Contributor
    Join Date
    Dec 2009
    Posts
    71

    QDialog problem

    Hi all,

    I have a QMainWindow and I need to use a QDialog (modal) but no problem for that.

    I run my app on the simulator, everything works fine but when I want to build and deploy on device,
    I have this error : "undefined reference to `FormZone::FormZone(QWidget*)"

    I don't really understand where come from the problem because all works on simulator
    Maybe I miss something so here is the code :
    if(!fZone);
    {
    fZone = new FormZone(this); // Error for this line
    connect(fZone,SIGNAL(accepted()),this,SLOT(ZoneAccepted()));
    }

    fZone->exec();
    Thank you for help.
    Last edited by Fillinger; 2010-07-05 at 10:45.

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: QDialog problem

    Hi, Fillinger

    Running the application in the simulator and in the device both are different thing.
    Every time it is not necessary that the application can run successfully.

    Does Qt library is correctly installed in your mobile. ?
    Which phone you are using ?
    And what version of Qt You have ?

    Best regards,
    RaHuL

  3. #3
    Regular Contributor
    Join Date
    Dec 2009
    Posts
    71

    Re: QDialog problem

    Hi RaHuL,

    first thanks for answer.

    I use a nokia 5800 and I have install Qt_installer.sis that comes with the SDK. TRK is also install. And I use Qt 4.7.0.

    Before the creation of the QDialog, my app deploy and run correctly on the device.
    if you need other information, tel me.

    Thanks for help.

  4. #4
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: QDialog problem

    Hi,

    If it works in the emulator then it should work in the device also.

    Have you gone through this article : http://wiki.forum.nokia.com/index.ph...ng_with_AppTRK
    Do according to this article.

    Cheers,
    RaHuL

  5. #5
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: QDialog problem

    Where is FormZone defined? If its in a separate library then you may need to recompile that for the phone.

  6. #6
    Regular Contributor
    Join Date
    Dec 2009
    Posts
    71

    Re: QDialog problem

    Where is FormZone defined? If its in a separate library then you may need to recompile that for the phone.
    Hi danhicksbyron,

    formzone is defined in my QMainWindow. I check my TRK version too and it is up to date. I don't find solution until now.

    I hope someone had the same problem and resolve it.

    Thanks for you reply.

  7. #7
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QDialog problem

    Quote Originally Posted by Fillinger View Post
    formzone is defined in my QMainWindow.
    This makes no sense, however, could you please provide full log of build process. In this document page 11
    http://www.forum.nokia.com/info/sw.n...ia_Qt_SDK.html

  8. #8
    Regular Contributor
    Join Date
    Dec 2009
    Posts
    71

    Re: QDialog problem

    hi divanov,

    here is the log of compiler :
    Running build steps for project OpenStreet...
    Configuration unchanged, skipping qmake step.
    Starting: "C:/NokiaQtSDK/Symbian/SDK/epoc32/tools/make.exe" debug-gcce -w
    C:\NokiaQtSDK\Symbian\SDK\epoc32\tools\make.exe: Entering directory `C:/QtProject/OpenStreet'
    ABLD.BAT build gcce udeb
    make -r -f "\NokiaQtSDK\Symbian\SDK\EPOC32\BUILD\QtProject\OpenStreet\EXPORT.make" EXPORT VERBOSE=-s
    make[1]: Entering directory `C:/QtProject/OpenStreet'
    Nothing to do
    make[1]: Leaving directory `C:/QtProject/OpenStreet'
    make -r -f "\NokiaQtSDK\Symbian\SDK\EPOC32\BUILD\QtProject\OpenStreet\GCCE.make" MAKEFILE VERBOSE=-s
    make[1]: Entering directory `C:/QtProject/OpenStreet'
    make -s -C \QtProject\OpenStreet -f "MAKEFILE_0XE1CD4997.MK" TO_ROOT=..\.. EPOCBLD=\NokiaQtSDK\Symbian\SDK\EPOC32\BUILD\MAKEFILE_0XE1CD4997\GCCE TO_BLDINF=..\..\QtProject\OpenStreet PLATFORM=GCCE MAKMAKE
    perl -S makmake.pl -D \QtProject\OpenStreet\OPENSTREET_0XE1CD4997 GCCE

    make[1]: Leaving directory `C:/QtProject/OpenStreet'
    make -r -f "\NokiaQtSDK\Symbian\SDK\EPOC32\BUILD\QtProject\OpenStreet\GCCE.make" LIBRARY VERBOSE=-s
    make[1]: Entering directory `C:/QtProject/OpenStreet'
    make -s -C \QtProject\OpenStreet -f "MAKEFILE_0XE1CD4997.MK" TO_ROOT=..\.. EPOCBLD=\NokiaQtSDK\Symbian\SDK\EPOC32\BUILD\MAKEFILE_0XE1CD4997\GCCE TO_BLDINF=..\..\QtProject\OpenStreet PLATFORM=GCCE LIB
    make -s -r -f "\NokiaQtSDK\Symbian\SDK\EPOC32\BUILD\QtProject\OpenStreet\OPENSTREET_0XE1CD4997\GCCE\OPENSTREET_0XE1CD4997.GCCE" LIBRARY
    make[1]: Leaving directory `C:/QtProject/OpenStreet'
    make -r -f "\NokiaQtSDK\Symbian\SDK\EPOC32\BUILD\QtProject\OpenStreet\GCCE.make" RESOURCE CFG=UDEB VERBOSE=-s
    make[1]: Entering directory `C:/QtProject/OpenStreet'
    make -s -C \QtProject\OpenStreet -f "MAKEFILE_0XE1CD4997.MK" TO_ROOT=..\.. EPOCBLD=\NokiaQtSDK\Symbian\SDK\EPOC32\BUILD\MAKEFILE_0XE1CD4997\GCCE TO_BLDINF=..\..\QtProject\OpenStreet PLATFORM=GCCE CFG=UDEB RESOURCE
    make -s -r -f "\NokiaQtSDK\Symbian\SDK\EPOC32\BUILD\QtProject\OpenStreet\OPENSTREET_0XE1CD4997\GCCE\OPENSTREET_0XE1CD4997.GCCE" RESOURCEUDEB
    make[1]: Leaving directory `C:/QtProject/OpenStreet'
    make -r -f "\NokiaQtSDK\Symbian\SDK\EPOC32\BUILD\QtProject\OpenStreet\GCCE.make" TARGET CFG=UDEB VERBOSE=-s
    make[1]: Entering directory `C:/QtProject/OpenStreet'
    make -s -C \QtProject\OpenStreet -f "MAKEFILE_0XE1CD4997.MK" TO_ROOT=..\.. EPOCBLD=\NokiaQtSDK\Symbian\SDK\EPOC32\BUILD\MAKEFILE_0XE1CD4997\GCCE TO_BLDINF=..\..\QtProject\OpenStreet PLATFORM=GCCE CFG=UDEB BLD
    make -s -r -f "\NokiaQtSDK\Symbian\SDK\EPOC32\BUILD\QtProject\OpenStreet\OPENSTREET_0XE1CD4997\GCCE\OPENSTREET_0XE1CD4997.GCCE" UDEB
    formmain.cpp
    from /QtProject/OpenStreet/GpsAccess.h:6,
    from /QtProject/OpenStreet/formmain.h:5,
    from /QtProject/OpenStreet/formmain.cpp:1:
    /NokiaQtSDK/Symbian/SDK/epoc32/include/biditext.h: At global scope:
    /NokiaQtSDK/Symbian/SDK/epoc32/include/biditext.h:12: warning: declaration 'enum CGraphicsContext::TTextAlign' does not declare anything
    /NokiaQtSDK/Symbian/SDK/EPOC32/BUILD/QtProject/OpenStreet/OPENSTREET_0XE1CD4997/GCCE/UDEB/formmain.o: In function `FormMain::OnBtnZoneClick()':
    /QtProject/OpenStreet/formmain.cpp:170: undefined reference to `FormZone::FormZone(QWidget*)'
    make[2]: *** [\NokiaQtSDK\Symbian\SDK\epoc32\release\gcce\udeb\OpenStreet.exe] Error 1
    make[1]: Leaving directory `C:/QtProject/OpenStreet'
    make -r -f "\NokiaQtSDK\Symbian\SDK\EPOC32\BUILD\QtProject\OpenStreet\GCCE.make" FINAL CFG=UDEB VERBOSE=-s
    make[1]: Entering directory `C:/QtProject/OpenStreet'
    make -s -C \QtProject\OpenStreet -f "MAKEFILE_0XE1CD4997.MK" TO_ROOT=..\.. EPOCBLD=\NokiaQtSDK\Symbian\SDK\EPOC32\BUILD\MAKEFILE_0XE1CD4997\GCCE TO_BLDINF=..\..\QtProject\OpenStreet PLATFORM=GCCE CFG=UDEB FINAL
    make[1]: *** [TARGETOPENSTREET_0XE1CD4997] Error 2
    make[1]: Leaving directory `C:/QtProject/OpenStreet'
    C:\NokiaQtSDK\Symbian\SDK\epoc32\tools\make.exe: Leaving directory `C:/QtProject/OpenStreet'
    The process "C:/NokiaQtSDK/Symbian/SDK/epoc32/tools/make.exe" exited normally.
    Error while building project OpenStreet (target: Symbian Device)
    When executing build step 'Make'
    I can send you all the build log because there is too much line (a lot of warning)

    Hope you will find something.

    Thank you.

  9. #9
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QDialog problem

    I would try to clear project and rebuild it again. qmake is not perfect in identifying re-build need. Also, please, show your project file.

  10. #10
    Regular Contributor
    Join Date
    Dec 2009
    Posts
    71

    Re: QDialog problem

    I try to clean and rebuilt but nothing change, always say
    "undefined reference to 'FormZone::FormZone(QWidget*)'.

    And I supose that is not because I try to pass a QMainwindow to my FormZone, QMainWindow inherit from QWidget isn't it ?

    here the .pro file
    #-------------------------------------------------
    #
    # Project created by QtCreator 2010-06-28T09:34:52
    #
    #-------------------------------------------------

    QT += core gui network

    TARGET = OpenStreet
    TEMPLATE = app


    SOURCES += main.cpp\
    formmain.cpp \
    slippymap.cpp \
    gpsaccess.cpp \
    formzone.cpp

    HEADERS += formmain.h \
    slippymap.h \
    gpsaccess.h \
    formzone.h

    FORMS += formmain.ui \
    formzone.ui \
    framezone.ui

    CONFIG += mobility
    MOBILITY = location bearer systeminfo

    symbian {
    TARGET.UID3 = 0xe1cd4997
    TARGET.CAPABILITY += NetworkServices Location ReadUserData
    TARGET.EPOCSTACKSIZE = 0x14000
    TARGET.EPOCHEAPSIZE = 0x020000 0x800000
    }

    RESOURCES += \
    Map.qrc

    OTHER_FILES += \
    ZoomLvl.txt
    thanks you for your time pass to help me.

  11. #11
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QDialog problem

    Do you have
    Code:
    #include "formzone.h"
    in formmain.cpp?

  12. #12
    Regular Contributor
    Join Date
    Dec 2009
    Posts
    71

    Re: QDialog problem

    I have the
    #include<formzone.h>
    in the .h file, not in the .cpp file.

    I try to put it now in cpp but no change.

  13. #13
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QDialog problem

    Well, probably you should share the whole source code.

  14. #14
    Regular Contributor
    Join Date
    Dec 2009
    Posts
    71

    Re: QDialog problem

    here you find the 2 classes :

    #ifndef FORMMAIN_H
    #define FORMMAIN_H

    #include <QMainWindow>
    #include<GpsAccess.h>
    #include<slippymap.h>
    #include<formzone.h> // HERE THE INCLUDE OF MY QDIALOG
    #include<threadzone.h>

    namespace Ui {
    class FormMain;
    }

    class FormMain : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit FormMain(QWidget *parent = 0);
    void setCenter(qreal lat, qreal lng);
    ~FormMain();
    protected:
    void paintEvent(QPaintEvent *event);
    void resizeEvent(QResizeEvent *);
    void mousePressEvent(QMouseEvent *event);
    void changeEvent(QEvent *e);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *) {
    qDebug() << "release";
    update();
    }
    private slots:
    void on_ButtonPlus_clicked();
    void on_ButtonMoins_clicked();
    void updateMap(const QRect &r)
    {
    update(r);
    }
    void UpdatePositionGps();
    void OnBtnZoneClick();
    void ZoneAccepted();

    private:
    Ui::FormMain *ui;
    SlippyMap *Map;
    bool pressed;
    QPoint pressPos;
    QPoint dragPos;
    GpsAccess *Gps;
    double latitude;
    double longitude;
    QStatusBar *statusBar;
    QLabel *lbStatus;
    FormZone *fZone;
    ThreadZone *th;
    };
    #include "formmain.h"
    #include "ui_formmain.h"

    FormMain::FormMain(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::FormMain)
    {
    ui->setupUi(this);
    Gps = new GpsAccess();
    ui->setupUi(this);
    Map = new SlippyMap(this);

    connect(Map, SIGNAL(updated(QRect)), SLOT(updateMap(QRect)));
    connect(Gps, SIGNAL(UpdatePosition()), SLOT(UpdatePositionGps()));
    //---------------- Event des objects graphique
    connect(ui->ButtonMoins,SIGNAL(clicked()),this,SLOT(on_ButtonMoins_clicked()));
    connect(ui->ButtonPlus,SIGNAL(clicked()),this,SLOT(on_ButtonPlus_clicked()));
    connect(ui->_btnZone,SIGNAL(clicked()),this,SLOT(OnBtnZoneClick()));

    QPalette qPalette;
    qPalette.setColor( QPalette::Text, QColor( Qt::red ) );

    lbStatus = new QLabel(this,0);
    lbStatus->setPalette(qPalette);

    statusBar = new QStatusBar(this);
    statusBar->addWidget(lbStatus,0);statusBar->setGeometry(QRect());


    QRect rect = this->geometry();
    statusBar->setGeometry(rect.left(),rect.bottom()-200,rect.width(),50);
    lbStatus->setGeometry(statusBar->geometry());




    }

    FormMain::~FormMain()
    {
    delete ui;
    }

    void FormMain:aintEvent(QPaintEvent *event)
    {
    QPainter p;
    p.begin(this);


    QPointF posGps = Map->tileForCoordinate(latitude, longitude);
    int posX = posGps.x();
    int posY = posGps.y();

    qreal lat1 = Map->latitudeFromTile(posY);
    qreal lat2 = Map->latitudeFromTile(posY+1);

    qreal lng1 = Map->longitudeFromTile(posX);
    qreal lng2 = Map->longitudeFromTile(posX+1);

    qreal diflat = (lat2-lat1)/256;
    qreal diflng = (lng2-lng1)/256;


    int y = (latitude-lat1)/ diflat;
    int x = (longitude-lng1)/diflng;

    QPoint *Deplacement = new QPoint (x,y);
    QPoint *Tuile = new QPoint (posX, posY);

    Map->render(&p, event->rect(), *Deplacement, *Tuile);
    p.end();
    }
    void FormMain::resizeEvent(QResizeEvent *)
    {
    qDebug() << "Resize Event";
    Map->width = width();
    Map->height = height();
    Map->invalidate();
    }
    void FormMain::mousePressEvent(QMouseEvent *event)
    {
    if (event->buttons() != Qt::LeftButton)
    return;

    pressed = true;
    pressPos = dragPos = event->pos();
    //qDebug() << "pressed";
    }
    void FormMain::mouseMoveEvent(QMouseEvent *event)
    {
    if (!event->buttons())
    return;
    if (pressed)
    {
    // qDebug() << "move";
    QPoint delta = event->pos() - pressPos;
    pressPos = event->pos();
    Map->pan(delta);
    return;
    }
    }
    void FormMain::setCenter(qreal lat, qreal lng)
    {
    //qDebug() << "SetCenter" << lat << " " << lng;
    Map->latitude = lat;
    Map->longitude = lng;
    Map->invalidate();
    }
    void FormMain::changeEvent(QEvent *e)
    {
    QMainWindow::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
    ui->retranslateUi(this);
    break;
    default:
    break;
    }
    }
    void FormMain:n_ButtonMoins_clicked()
    {
    qDebug() << "Zoom moins";
    if (Map->zoom == 18)
    {
    ui->ButtonPlus->setDisabled(false);
    }
    if(Map->zoom > 0)
    {
    Map->zoom = Map->zoom -1;
    Map->invalidate();
    }
    if (Map->zoom == 0)
    {
    ui->ButtonMoins->setDisabled(true);
    }
    }
    void FormMain:n_ButtonPlus_clicked()
    {
    qDebug() << "Zoom plus";
    if (Map->zoom == 0)
    {
    ui->ButtonMoins->setDisabled(false);
    }
    if(Map->zoom < 18)
    {
    Map->zoom = Map->zoom +1;
    Map->invalidate();
    }
    if (Map->zoom == 18)
    {
    ui->ButtonPlus->setDisabled(true);
    }
    }
    void FormMain::UpdatePositionGps()
    {
    //qDebug() << "Update Position";
    //setCenter(Gps->getLatitude(), Gps->getLongitude());
    latitude = Gps->getLatitude();
    longitude = Gps->getLongitude();
    setCenter(latitude, longitude);
    QString temp = "Lat : %1 -- Lon %2";
    temp = temp.arg(latitude).arg(longitude);
    lbStatus->setText(temp);

    }
    void FormMain::OnBtnZoneClick()
    {
    if(!fZone);
    {
    fZone = new FormZone();//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! HERE IS THE ERROR
    connect(fZone,SIGNAL(accepted()),this,SLOT(ZoneAccepted()));
    }
    fZone->exec();
    Map->isZoneDownload = true;
    Map->test();
    Map->isZoneDownload = false;

    }
    void FormMain::ZoneAccepted()
    {
    qDebug()<<"ACCEPTED EVENT";
    }

    #endif // FORMMAIN_H
    And the QDialog class :

    #ifndef FORMZONE_H
    #define FORMZONE_H

    #include <QDialog>
    #include<QWidget>

    namespace Ui {
    class FormZone;
    }

    class FormZone : public QDialog
    {
    Q_OBJECT

    public:
    explicit FormZone(QWidget *parent = 0);
    ~FormZone();

    private:
    Ui::FormZone *ui;
    };

    #endif // FORMZONE_H
    -----------------------------------------------------------------------------------------------------
    #include "formzone.h"
    #include "ui_formzone.h"

    FormZone::FormZone(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::FormZone)
    {
    ui->setupUi(this);
    ui->_lbZone->addItem("5 km - 2 min - 9 Mb");
    ui->_lbZone->addItem("10 km - 10 min - 36 Mb");
    ui->_lbZone->addItem("15 km - 22 min - 81 Mb");
    ui->_lbZone->addItem("20 km - 40 min - 144 Mb");
    ui->_lbZone->addItem("25 km - 62 min - 225 Mb");

    }

    FormZone::~FormZone()
    {
    delete ui;
    }

  15. #15
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QDialog problem

    Try to share the whole project.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×