Results 1 to 4 of 4

Thread: QT ---> C++ How to make?

  1. #1

    Default QT ---> C++ How to make?

    I made in QT creator a Gui and i want to make it a C++ working gui.
    I build it and Qt has created a new folder with .exe (Gui, dont working, because it saying that i dont get DLL) and moc_mainwindow.cpp
    I tried to put the code from moc_mainwindow.cpp into Code::Blocks but i didnt work. http://screenshu.com/static/uploads/.../hp/eswokt.jpg

    Gui.pro
    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2014-11-01T20:13:02
    4. #
    5. #-------------------------------------------------
    6. QT += webkit
    7. QT += core gui
    8.  
    9. greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    10.  
    11. TARGET = GUI
    12. TEMPLATE = app
    13.  
    14.  
    15. SOURCES += main.cpp\
    16. mainwindow.cpp
    17.  
    18. HEADERS += mainwindow.h
    19.  
    20. FORMS += mainwindow.ui
    To copy to clipboard, switch view to plain text mode 

    Mainwindow.h
    Qt Code:
    1. #ifndef MAINWINDOW_H
    2. #define MAINWINDOW_H
    3.  
    4. #include <QMainWindow>
    5.  
    6. namespace Ui {
    7. class MainWindow;
    8. }
    9.  
    10. class MainWindow : public QMainWindow
    11. {
    12. Q_OBJECT
    13.  
    14. public:
    15. explicit MainWindow(QWidget *parent = 0);
    16. ~MainWindow();
    17.  
    18. private slots:
    19. void on_Gospodarze_clicked();
    20.  
    21. void on_Zatrzymaj_clicked();
    22.  
    23. void on_Goscie_clicked();
    24.  
    25.  
    26. private:
    27. Ui::MainWindow *ui;
    28. };
    29.  
    30. #endif // MAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 

    Main.cpp
    Qt Code:
    1. #include "mainwindow.h"
    2. #include <QApplication>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. MainWindow w;
    8. w.show();
    9.  
    10. return a.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 

    Mainwindow.cpp
    Qt Code:
    1. #include "mainwindow.h"
    2. #include "ui_mainwindow.h"
    3. int GospodarzeL = 2;
    4. int ZatrzymajL = 2;
    5. int GoscieL = 2;
    6.  
    7. MainWindow::MainWindow(QWidget *parent) :
    8. QMainWindow(parent),
    9. ui(new Ui::MainWindow)
    10. {
    11. ui->setupUi(this);
    12. }
    13.  
    14. MainWindow::~MainWindow()
    15. {
    16. delete ui;
    17. }
    18.  
    19. void MainWindow::on_Gospodarze_clicked()
    20. {
    21. if (GospodarzeL < 1) {
    22. ui->GospodarzeL->setText("<font color='Red'>OFF</font>");
    23. GospodarzeL = 2;
    24. } else {
    25. ui->GospodarzeL->setText("<font color='Green'>ON</font>");
    26. GospodarzeL = 0;}
    27. }
    28.  
    29.  
    30. void MainWindow::on_Zatrzymaj_clicked()
    31. {
    32. if (ZatrzymajL < 1) {
    33. ui->ZatrzymajL->setText("<font color='Red'>OFF</font>");
    34. ZatrzymajL = 2;
    35. } else {
    36. ui->ZatrzymajL->setText("<font color='Green'>ON</font>");
    37. ZatrzymajL = 0;}
    38. }
    39.  
    40. void MainWindow::on_Goscie_clicked()
    41. {
    42. if (GoscieL < 1) {
    43. ui->GoscieL->setText("<font color='Red'>OFF</font>");
    44. GoscieL = 2;
    45. } else {
    46. ui->GoscieL->setText("<font color='Green'>ON</font>");
    47. GoscieL = 0;}
    48. }
    To copy to clipboard, switch view to plain text mode 

    When i was starting the gui from Qt creator it was working.
    Last edited by VerexPL; 2nd November 2014 at 15:41.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QT ---> C++ How to make?

    Quote Originally Posted by VerexPL View Post
    I made in QT creator a Gui and i want to make it a C++ working gui.
    I build it and Qt has created a new folder with .exe (Gui, dont working, because it saying that i dont get DLL)
    Did your installation routine maybe forget to copy the Qt DLLs to the program installation folder?

    Cheers,
    _

  3. #3

    Default Re: QT ---> C++ How to make?

    Quote Originally Posted by anda_skoa View Post
    Did your installation routine maybe forget to copy the Qt DLLs to the program installation folder?

    Cheers,
    _
    I don't see, any DLL's in my instalator.
    I downloaded: "qt-opensource-windows-x86-1.6.0-5-online"
    But for my is important that i can made this gui in code::blocks working.
    Because i would to make more functions
    Last edited by VerexPL; 2nd November 2014 at 19:09.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QT ---> C++ How to make?

    So your problem is that when you run your compiled program in Code::Blocks... Your IDE needs to ensure the enironment use to run the program allows the program to find all the libraries it is dependent on. In the case of a program needing Qt libraries this means the Qt libraries can be found in the PATH (asuming you are a Windows user).

Similar Threads

  1. Replies: 6
    Last Post: 10th March 2011, 16:42
  2. Replies: 1
    Last Post: 5th March 2011, 18:23
  3. Replies: 1
    Last Post: 15th December 2010, 13:20
  4. Cant find make command: mingw32-make.exe
    By Nadia in forum Installation and Deployment
    Replies: 1
    Last Post: 26th August 2009, 09:09
  5. Window OS make distclean && qmake && make one line
    By patrik08 in forum General Programming
    Replies: 4
    Last Post: 22nd March 2007, 10:43

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.