Page 2 of 2 FirstFirst 12
Results 21 to 27 of 27

Thread: How to call a dialog from a mainwindow

  1. #21
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to call a dialog from a mainwindow

    Either provide the proper path in the SOURCES variable or use the DEPENDPATH variable.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. The following user says thank you to wysota for this useful post:

    luiz4um (27th May 2010)

  3. #22
    Join Date
    May 2010
    Posts
    14
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: How to call a dialog from a mainwindow

    Thanks!! Now it works!!! I'm so gratefull!

    Now... using this post... Do you know how I custumize a pushbutton? Cause I'm programing in Windows and The default button is very common. I want to rounded it... make a shadow... something like this, you know...

  4. #23
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to call a dialog from a mainwindow

    Search the forum for similar questions. If you don't find an answer, start a new thread.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    luiz4um (27th May 2010)

  6. #24
    Join Date
    May 2010
    Posts
    14
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: How to call a dialog from a mainwindow

    wysota,

    Again, the similar problem appeared. Everything was working after I indexed corectly the .cpp file and .h file. But, suddently, when I edited a file in the mainwindow and I compiled it again, an error message showed up.

    telainicial.cpp:3:21: error: simples.h: No such file or directory
    telainicial.cpp:4:18: error: prog.h: No such file or directory
    telainicial.cpp:5:19: error: trans.h: No such file or directory
    telainicial.cpp:6:20: error: config.h: No such file or directory
    telainicial.cpp: In member function 'void telainicial::telasimples()':
    telainicial.cpp:21: error: 'simples' was not declared in this scope
    telainicial.cpp:21: error: expected ';' before 'dlg'
    telainicial.cpp:22: error: 'dlg' was not declared in this scope
    telainicial.cpp: In member function 'void telainicial::telaprog()':
    telainicial.cpp:26: error: 'prog' was not declared in this scope
    telainicial.cpp:26: error: expected ';' before 'dlg'
    telainicial.cpp:27: error: 'dlg' was not declared in this scope
    telainicial.cpp: In member function 'void telainicial::telatrans()':
    telainicial.cpp:31: error: 'trans' was not declared in this scope
    telainicial.cpp:31: error: expected ';' before 'dlg'
    telainicial.cpp:32: error: 'dlg' was not declared in this scope
    telainicial.cpp: In member function 'void telainicial::telaconfig()':
    telainicial.cpp:36: error: 'config' was not declared in this scope
    telainicial.cpp:36: error: expected ';' before 'dlg'
    telainicial.cpp:37: error: 'dlg' was not declared in this scope
    mingw32-make[1]: Leaving directory `E:/Luiz Paulo/TelaPrincipal'
    mingw32-make: Leaving directory `E:/Luiz Paulo/TelaPrincipal'
    mingw32-make[1]: *** [debug/telainicial.o] Error 1
    mingw32-make: *** [debug] Error 2
    Exited with code 2.
    Error while building project TelaPrincipal
    When executing build step 'Make'


    It looks the mainwindow doesn't find now the dialogs indexed on it. I already checked all located in .pro file and everything is correctly. I'm now confused...
    I have a version that I saved on my flash that is working... but the codes are the same. I don't know what is going on...

  7. #25
    Join Date
    Apr 2010
    Posts
    34
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to call a dialog from a mainwindow

    Post the file telainicial.cpp & h how they look currently. Did you change the location of your included files relatively to the "telainicial.cpp" file? Are they in a subfolder?
    From the compiler output it appears that your header files were not found. Are you sure they are where they were last time you compiled it?
    Check all of this. Something has changed certainly.

  8. #26
    Join Date
    May 2010
    Posts
    14
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: How to call a dialog from a mainwindow

    telainicial.cpp:

    Qt Code:
    1. #include <QtGui>
    2. #include "telainicial.h"
    3. #include "simples.h"
    4. #include "prog.h"
    5. #include "trans.h"
    6. #include "config.h"
    7.  
    8. telainicial::telainicial(QWidget *parent) :
    9. QMainWindow(parent)
    10.  
    11. {
    12. setupUi(this);
    13.  
    14. connect(lentesimples, SIGNAL(clicked()), this, SLOT(telasimples()));
    15. connect(lenteprog, SIGNAL(clicked()), this, SLOT(telaprog()));
    16. connect(transmissao, SIGNAL(clicked()), this, SLOT(telatrans()));
    17. connect(configuracoes, SIGNAL(clicked()), this, SLOT(telaconfig()));
    18. }
    19.  
    20. void telainicial::telasimples(){
    21. simples dlg(this);
    22. dlg.exec();
    23. }
    24.  
    25. void telainicial::telaprog(){
    26. prog dlg(this);
    27. dlg.exec();
    28. }
    29.  
    30. void telainicial::telatrans(){
    31. trans dlg(this);
    32. dlg.exec();
    33. }
    34.  
    35. void telainicial::telaconfig(){
    36. config dlg(this);
    37. dlg.exec();
    38.  
    39. };
    To copy to clipboard, switch view to plain text mode 

    telainicial.h
    Qt Code:
    1. #ifndef TELAINICIAL_H
    2. #define TELAINICIAL_H
    3.  
    4. #include <QMainWindow>
    5. #include "ui_telainicial.h"
    6.  
    7. class telainicial : public QMainWindow, public Ui::telainicial {
    8. Q_OBJECT
    9.  
    10. public:
    11. telainicial(QWidget *parent = 0);
    12.  
    13. private slots:
    14. void telasimples();
    15. void telaconfig();
    16. void telaprog();
    17. void telatrans();
    18.  
    19. };
    20.  
    21. #endif // TELAINICIAL_H
    To copy to clipboard, switch view to plain text mode 

    telainicial.pro
    qmake Code:
    1. # -------------------------------------------------
    2. # Project created by QtCreator 2010-05-14T10:13:43
    3. # -------------------------------------------------
    4. QT += opengl
    5. TARGET = TelaPrincipal
    6. TEMPLATE = app
    7. SOURCES += main.cpp \
    8. telainicial.cpp \
    9. ../Config/config.cpp \
    10. ../LenteSimples/simples.cpp \
    11. ../Progressiva/prog.cpp \
    12. ../Transmissao/trans.cpp
    13. HEADERS += telainicial.h \
    14. ../Config/config.h \
    15. ../LenteSimples/simples.h \
    16. ../Progressiva/prog.h \
    17. ../Transmissao/trans.h
    18. FORMS += telainicial.ui
    19. OTHER_FILES +=
    To copy to clipboard, switch view to plain text mode 

    All dialog's folders are in the same folder, including the mainwindow's folder. I already have indexed the .h and .cpp files thounsand times but it just doesn't work. Can you try in your pc? I can send it by email...
    Last edited by wysota; 9th July 2010 at 08:51. Reason: changed [qtclass] to [code]

  9. #27
    Join Date
    Apr 2010
    Posts
    34
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to call a dialog from a mainwindow

    I see some files are in subfolders. Do you have an additional include directories set to these subfolders? Or try adding a subfolder name to the include command.
    The compiler output is clear. It can't find all the files that are in subfolders. Focus on that.

Similar Threads

  1. Open Dialog from MainWindow.
    By halvors in forum Qt Programming
    Replies: 8
    Last Post: 1st April 2010, 01:09
  2. Passing Pixmaps between MainWindow and Dialog
    By ramstormrage in forum Qt Programming
    Replies: 28
    Last Post: 20th April 2008, 13:32
  3. Communication between MainWindow and a dialog
    By Backslash in forum Newbie
    Replies: 9
    Last Post: 3rd August 2007, 04:27
  4. Opening a Dialog from a MainWindow FileMenu
    By nbkhwjm in forum Newbie
    Replies: 4
    Last Post: 17th April 2007, 12:24
  5. how to call another dialog using menubar
    By merry in forum Qt Programming
    Replies: 1
    Last Post: 16th April 2007, 14:28

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.