Results 1 to 3 of 3

Thread: QDialog crashing problem (Header)

  1. #1
    Join Date
    Apr 2016
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QDialog crashing problem (Header)

    I have a problem with following code...

    Qt Code:
    1. #ifndef SIGNALSETTINGS_H
    2. #define SIGNALSETTINGS_H
    3.  
    4. #include <QDialog>
    5. #include "signalfile.h"
    6. #include <QLabel>
    7. #include <QLineEdit>
    8. #include <QCheckBox>
    9.  
    10. struct SignalProperties{
    11. int signalHeight;
    12. int verticalPosition;
    13. int slotNumber;
    14. bool isVisible;
    15. QColor bgColour;
    16. QColor signalColour;
    17. QColor fillColour;
    18. int signalThicness;
    19. bool showAsAnalog;
    20. Signal *signal; //Pointer to signal
    21. };
    22.  
    23.  
    24. class SignalSettings : public QDialog
    25. {
    26. Q_OBJECT
    27.  
    28. public:
    29. explicit SignalSettings(SignalProperties *p, QWidget *parent = 0);
    30. void paintEvent(QPaintEvent *event);
    31. ~SignalSettings();
    32.  
    33.  
    34.  
    35. private:
    36. SignalProperties *properties;
    37.  
    38. QLabel *labelFGColour;
    39. QLabel *labelBGColour;
    40. QLineEdit *inputHeight;
    41.  
    42. int krneki; // <------ Problem, works great without this line but but program crashes with this line of code.
    43.  
    44.  
    45. signals:
    46. void signalPropertiesChanged();
    47.  
    48. public slots:
    49. void onBGButtonClicked();
    50. void onFGButtonClicked();
    51. void onShowHide(int state);
    52. void onSignalHeightChange();
    53. };
    54.  
    55. #endif // SIGNALSETTINGS_H
    To copy to clipboard, switch view to plain text mode 


    I have a custom QDialog widget, and it worked great. Now I want to save some integer and if I write the int in header, program sometimes (not always) crashes when QDialog (SignalSettings) should open...

    Any ideas why it works without that line and why not when I include it in my code?

    This is my first post so I say Hi to you all


    Added after 13 minutes:


    Amm ok above code actualy works ok, but if I put integer between pointers as below, than it crashes quiet often.

    this code crashes:
    Qt Code:
    1. private:
    2. SignalProperties *properties;
    3. int krneki; //<---- if integer between pointers than code irregulary crashes
    4. QLabel *labelFGColour;
    5. QLabel *labelBGColour;
    6. QLineEdit *inputHeight;
    To copy to clipboard, switch view to plain text mode 
    Last edited by boro_11; 8th April 2016 at 19:47.

  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: QDialog crashing problem (Header)

    You need to have a problem elsewhere.

    What is the stacktrace at the time of the crash?

    Cheers,
    _

  3. #3
    Join Date
    Apr 2016
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QDialog crashing problem (Header)

    Quote Originally Posted by anda_skoa View Post
    You need to have a problem elsewhere.

    What is the stacktrace at the time of the crash?

    Cheers,
    _
    Sorry for late reply,

    If I run it in DEBUGING mode, it never stops with error. No matter how many times I open that dialog, I get error the second or third time if I compile in release mode and I never get an error if I compile with debug mode...

    What would be the difference between those two modes?

    I will trie to compile on linux box to see if there is any difference there.

Similar Threads

  1. Replies: 1
    Last Post: 26th March 2013, 02:04
  2. create a QDialog from a QDialog
    By hichemnho in forum Newbie
    Replies: 5
    Last Post: 5th March 2012, 21:48
  3. Replies: 9
    Last Post: 25th March 2011, 21:22
  4. QDialog.exec() exiting without calling QDialog::accept()
    By doggrant in forum Qt Programming
    Replies: 3
    Last Post: 2nd February 2011, 11:35
  5. closing a Qdialog called from a Qdialog
    By OverTheOCean in forum Qt Programming
    Replies: 3
    Last Post: 28th September 2009, 08:02

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.