What do you know, being lazy and initializing Qt GUI objects in the
constructor cause problems. (AKA a segfault when running as a test case).
This patch allocates the various GUI objects in an actual function
(which is so the different contstructors can use the same initialization
code.
It looks like another coding standard to remember.
SequenceDescription::SequenceDescription(QWidget *parent)
: QFrame(parent),
SequenceDescription::SequenceDescription(QWidget *parent)
: QFrame(parent),
- layout(new QVBoxLayout),
- name_label(new QLineEdit),
- position_label(new QLabel),
- length_label(new QLabel),
+ layout(0),
+ name_label(0),
+ position_label(0),
+ length_label(0),
pos(-1) // set pos to an invalid value so the setPos function will call
// setText
{
pos(-1) // set pos to an invalid value so the setPos function will call
// setText
{
}
SequenceDescription::SequenceDescription(
}
SequenceDescription::SequenceDescription(
QWidget *parent
) : QFrame(parent)
{
QWidget *parent
) : QFrame(parent)
{
-void SequenceDescription::createWidget()
+void SequenceDescription::setupWidgets()
+ layout = new QVBoxLayout;
+ name_label = new QLineEdit;
+ position_label = new QLabel;
+ length_label = new QLabel;
+
setFrameStyle(QFrame::Panel | QFrame::Sunken);
setLineWidth(1);
setFrameStyle(QFrame::Panel | QFrame::Sunken);
setLineWidth(1);
boost::shared_ptr<GlSequence> glsequence_;
int pos;
boost::shared_ptr<GlSequence> glsequence_;
int pos;
+ //! finish initializing GUI widgets
+ void setupWidgets();
//! format the length and set the QLabel
void setLength(int length);
};
//! format the length and set the QLabel
void setLength(int length);
};