I have a problem with following code...
#ifndef SIGNALSETTINGS_H
#define SIGNALSETTINGS_H
#include <QDialog>
#include "signalfile.h"
#include <QLabel>
#include <QLineEdit>
#include <QCheckBox>
struct SignalProperties{
int signalHeight;
int verticalPosition;
int slotNumber;
bool isVisible;
int signalThicness;
bool showAsAnalog;
Signal *signal; //Pointer to signal
};
class SignalSettings
: public QDialog{
Q_OBJECT
public:
explicit SignalSettings
(SignalProperties
*p,
QWidget *parent
= 0);
~SignalSettings();
private:
SignalProperties *properties;
int krneki; // <------ Problem, works great without this line but but program crashes with this line of code.
signals:
void signalPropertiesChanged();
public slots:
void onBGButtonClicked();
void onFGButtonClicked();
void onShowHide(int state);
void onSignalHeightChange();
};
#endif // SIGNALSETTINGS_H
#ifndef SIGNALSETTINGS_H
#define SIGNALSETTINGS_H
#include <QDialog>
#include "signalfile.h"
#include <QLabel>
#include <QLineEdit>
#include <QCheckBox>
struct SignalProperties{
int signalHeight;
int verticalPosition;
int slotNumber;
bool isVisible;
QColor bgColour;
QColor signalColour;
QColor fillColour;
int signalThicness;
bool showAsAnalog;
Signal *signal; //Pointer to signal
};
class SignalSettings : public QDialog
{
Q_OBJECT
public:
explicit SignalSettings(SignalProperties *p, QWidget *parent = 0);
void paintEvent(QPaintEvent *event);
~SignalSettings();
private:
SignalProperties *properties;
QLabel *labelFGColour;
QLabel *labelBGColour;
QLineEdit *inputHeight;
int krneki; // <------ Problem, works great without this line but but program crashes with this line of code.
signals:
void signalPropertiesChanged();
public slots:
void onBGButtonClicked();
void onFGButtonClicked();
void onShowHide(int state);
void onSignalHeightChange();
};
#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:
private:
SignalProperties *properties;
int krneki; //<---- if integer between pointers than code irregulary crashes
private:
SignalProperties *properties;
int krneki; //<---- if integer between pointers than code irregulary crashes
QLabel *labelFGColour;
QLabel *labelBGColour;
QLineEdit *inputHeight;
To copy to clipboard, switch view to plain text mode
Bookmarks