Results 1 to 4 of 4

Thread: Qt release conf problem

  1. #1
    Join Date
    Mar 2011
    Posts
    15
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qt release conf problem

    hi! I am not new to Qt, and usually i have not any problems with it or just solve them with documentation. But now i have a bit strange problem.
    First i should say, that use Qt with MSVC2010 compiller. I have an app with 2 QWidgets (so with 2 ui forms). So in first widget i have a button, and when i push it, the second widget must appear. To initialize second form i use:

    Qt Code:
    1. resWidget = new QWidget();
    2. resUi->setupUi(resWidget);
    3. resWidget->show();
    To copy to clipboard, switch view to plain text mode 

    So the problem is when i compile this app with debug configuration - all works good. But built with release configuration program stops working after pressing a button in the first widget. I debuged the app and the problem was in the line with "setupUi(...)" function.

    P.S. One more interesting thing - if the second form is empty - it also runs good in both configurations.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt release conf problem

    How did you make the two forms and their classes ? If you made with Qt creator you should get the classes yourself.
    From the code it seems there must be some parenting issue with the forms. Its hard to tell exactly without knowing the complete code.
    If you can post atleast the creation of widgets code, may be we can help more.

  3. #3
    Join Date
    Mar 2011
    Posts
    15
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt release conf problem

    This is the part of code connected with creating GUI


    stdafx.h
    Qt Code:
    1. #ifndef STDAFX_H
    2. #define STDAFX_H
    3.  
    4. #include <QWidget>
    5. #include <QMessageBox>
    6. #include <QFileDialog>
    7. #include <QString>
    8. #include <QPixmap>
    9. #include <QTableWidgetItem>
    10. #include <QList>
    11. #include <QDir>
    12. #include <QComboBox>
    13.  
    14. #include "ui_mainwidget.h"
    15. #include "ui_result.h"
    16.  
    17. #include "imageprocessor.h"
    18.  
    19. #endif // STDAFX_H
    To copy to clipboard, switch view to plain text mode 

    MainWidget.h
    Qt Code:
    1. #ifndef MAINWIDGET_H
    2. #define MAINWIDGET_H
    3.  
    4. #include "stdafx.h"
    5.  
    6. namespace Ui
    7. {
    8. class MainWidget;
    9. }
    10.  
    11. class MainWidget : public QWidget
    12. {
    13. Q_OBJECT
    14.  
    15. public:
    16. explicit MainWidget(QWidget *parent = 0);
    17. ~MainWidget();
    18.  
    19. public slots:
    20. void onLoadBtnClicked();
    21. void onProcBtnClicked();
    22. void onExportBtnClicked();
    23. void onExportAllBtnClicked();
    24. void onDeleteBtnClicked();
    25. void onTabChanged();
    26. void onMoveToGoodWndsBtnClicked();
    27. void onMoveToBadWndsBtnClicked();
    28.  
    29. private:
    30. Ui::MainWidget *ui;
    31. Ui::ResWidget *resUi;
    32. QWidget *resWidget;
    33. ImageProcessor *imageProc;
    34.  
    35. void setResUi();
    36. void showGoodWnds();
    37. void showBadWnds();
    38. };
    39.  
    40. #endif // MAINWIDGET_H
    To copy to clipboard, switch view to plain text mode 

    MainWidget.cpp
    Qt Code:
    1. #include "mainwidget.h"
    2.  
    3. // CONSTRUCTORS
    4.  
    5. //
    6. MainWidget::MainWidget(QWidget *parent) :
    7. QWidget(parent),
    8. ui(new Ui::MainWidget)
    9. {
    10. ui->setupUi(this);
    11.  
    12. // Connect buttons
    13. QObject::connect(ui->loadBtn, SIGNAL(clicked()),
    14. this, SLOT(onLoadBtnClicked()));
    15. QObject::connect(ui->procBtn, SIGNAL(clicked()),
    16. this, SLOT(onProcBtnClicked()));
    17.  
    18. imageProc = 0;
    19. }
    20.  
    21. //
    22. MainWidget::~MainWidget()
    23. {
    24. delete ui;
    25. }
    26.  
    27. // SLOTS
    28.  
    29. //
    30. void MainWidget::onProcBtnClicked()
    31. {
    32. if(0 == imageProc)
    33. {
    34. return;
    35. }
    36.  
    37. setResUi();
    38. showGoodWnds();
    39. showBadWnds();
    40. }
    41.  
    42. // PRIVATE FUNCTIONS
    43.  
    44. //
    45. void MainWidget::setResUi()
    46. {
    47. // Load result window
    48. resWidget = new QWidget();
    49. resUi->setupUi(resWidget);
    50. resWidget->show();
    51.  
    52. // Connect buttons of the result window
    53. QObject::connect(resUi->closeBtn, SIGNAL(clicked()),
    54. resWidget, SLOT(close()));
    55. QObject::connect(resUi->exportBtn, SIGNAL(clicked()),
    56. this, SLOT(onExportBtnClicked()));
    57. QObject::connect(resUi->exportAllBtn, SIGNAL(clicked()),
    58. this, SLOT(onExportAllBtnClicked()));
    59. QObject::connect(resUi->deleteBtn, SIGNAL(clicked()),
    60. this, SLOT(onDeleteBtnClicked()));
    61. QObject::connect(resUi->tabWidget, SIGNAL(currentChanged(int)),
    62. this, SLOT(onTabChanged()));
    63. QObject::connect(resUi->moveToGoodBtn, SIGNAL(clicked()),
    64. this, SLOT(onMoveToGoodWndsBtnClicked()));
    65. QObject::connect(resUi->moveToBadBtn, SIGNAL(clicked()),
    66. this, SLOT(onMoveToBadWndsBtnClicked()));
    67.  
    68. //
    69. resUi->tabWidget->setCurrentIndex(GOOD_TAB);
    70. resUi->moveToGoodBtn->setEnabled(false);
    71. }
    To copy to clipboard, switch view to plain text mode 

    As i said, all works perfectly in DEBUG mode; in RELEASE mode prgram stoppes executing at line 49 in MainWidget.cpp module.
    Please help me((((
    Last edited by make; 30th March 2012 at 18:38.

  4. #4
    Join Date
    Mar 2011
    Posts
    15
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt release conf problem

    OK)) I've solved the problem - just added one more class for the second form - and all is right!!! thanks...

Similar Threads

  1. qmake.conf in MAC OS
    By anupamgee in forum Newbie
    Replies: 4
    Last Post: 27th October 2011, 23:36
  2. Qt Creator Problem selecting the correct mkspec/qmake.conf file
    By weaver4 in forum Qt Tools
    Replies: 1
    Last Post: 2nd December 2010, 13:37
  3. Replies: 1
    Last Post: 27th August 2010, 05:37
  4. qt.conf
    By wirasto in forum Qt Programming
    Replies: 5
    Last Post: 25th December 2009, 14:45
  5. Qt.conf??? Maybe not...
    By Nefastious in forum Installation and Deployment
    Replies: 1
    Last Post: 7th November 2009, 22:32

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.