Terreox
7th February 2012, 15:11
Hi there
i dont know how to solve one problem.
I designed a controlpanel for my program with QtDesigner and added controlpanel.cpp and controlpanel.h to be able to add more functionality.
Now i have a problem:
On the GUI there are several Comboboxes. If a new ControlPanel is created all comboboxes should be cleared and initialized with some items.
Controlpanel.h
#ifndef CONTROLPANEL_H
#define CONTROLPANEL_H
#include <QMainWindow>
#include "ui_controlpanel.h"
class ControlPanel : public QMainWindow, public Ui::ControlPanel
{
Q_OBJECT
public:
ControlPanel();
private:
void initStatusVectors();
void setComboBoxes();
QVector<QString> statusVec;
};
#endif // CONTROLPANEL_H
And this is Controlpanel.cpp
#include <QMainWindow>
#include <QtGui>
#include "controlpanel.h"
//INITIALIZE STATUS-VECTOR
void ControlPanel::initStatusVectors()
{
statusVec.push_back("1");
statusVec.push_back("2");
statusVec.push_back("3");
statusVec.push_back("4");
statusVec.push_back("5");
statusVec.push_back("6");
statusVec.push_back("7");
statusVec.push_back("8");
statusVec.push_back("9");
}
void ControlPanel::setComboBoxes()
{
this->combStatus1->clear();
}
ControlPanel::ControlPanel(QWidget *parent)
: QMainWindow(parent)
{
//INITIALIZE STATUS-VECTOR
initStatusVectors();
setComboBoxes();
setupUi(this);
}
If i leave out setComboBoxes() everything works fine i guess. Nothing bad happens.
But if i call setComboBoxes(); the program crashes before showing the GUI. So i press CTRL+R and then the crash message of windows appears
"ControlPanel has crashed and so on..."
I really dont know whats the problem is? Can anyone help me?
Greetz
i dont know how to solve one problem.
I designed a controlpanel for my program with QtDesigner and added controlpanel.cpp and controlpanel.h to be able to add more functionality.
Now i have a problem:
On the GUI there are several Comboboxes. If a new ControlPanel is created all comboboxes should be cleared and initialized with some items.
Controlpanel.h
#ifndef CONTROLPANEL_H
#define CONTROLPANEL_H
#include <QMainWindow>
#include "ui_controlpanel.h"
class ControlPanel : public QMainWindow, public Ui::ControlPanel
{
Q_OBJECT
public:
ControlPanel();
private:
void initStatusVectors();
void setComboBoxes();
QVector<QString> statusVec;
};
#endif // CONTROLPANEL_H
And this is Controlpanel.cpp
#include <QMainWindow>
#include <QtGui>
#include "controlpanel.h"
//INITIALIZE STATUS-VECTOR
void ControlPanel::initStatusVectors()
{
statusVec.push_back("1");
statusVec.push_back("2");
statusVec.push_back("3");
statusVec.push_back("4");
statusVec.push_back("5");
statusVec.push_back("6");
statusVec.push_back("7");
statusVec.push_back("8");
statusVec.push_back("9");
}
void ControlPanel::setComboBoxes()
{
this->combStatus1->clear();
}
ControlPanel::ControlPanel(QWidget *parent)
: QMainWindow(parent)
{
//INITIALIZE STATUS-VECTOR
initStatusVectors();
setComboBoxes();
setupUi(this);
}
If i leave out setComboBoxes() everything works fine i guess. Nothing bad happens.
But if i call setComboBoxes(); the program crashes before showing the GUI. So i press CTRL+R and then the crash message of windows appears
"ControlPanel has crashed and so on..."
I really dont know whats the problem is? Can anyone help me?
Greetz