jimbo
27th November 2017, 20:40
Hello.
Qt 5.9.1
I'm showing a ui form and the passed variables come up as not accessible.
I had it working for a while and for some reason, now it does not.
I'm using some of Qt Creators built in slot mechanisms.
Maybe I deleted something, I don't know.
Anybody have an insiight?
Regards
//Debug output
Locals
activeLayer <not accessible> QString
btnArea 0x4 QWidget*
captionList <not accessible> QList<QString>
layout 0x30 QLayout*
parent 0x0 QWidget*
this @0x27d1c050 qg_divideoptions
Inspector
Expressions
Return Value
Tooltip
//Constructor
//activeLayer and buttonCaptions have valid data
QDialog *myNewform = new qg_divideoptions( activeLayer, buttonCaptions );
myNewform->setWindowFlags( myNewform->windowFlags() & ~Qt::WindowContextHelpButtonHint );
myNewform->setFixedSize(300, 400);
QObject::connect( myNewform,
SIGNAL( dataToSend(const int&, //newticks
const int&, //newsize
const bool&, //hidedhow
const bool&, //breaks
const int&)), //newLayer
this,
SLOT( gotData(const int, //ticksR
const int, //sizeR
const bool, //showhideR
const bool, //breaksR
const int)) ); //layerR
myNewform->exec(); //*** modal ***
//Form header
#ifndef QG_DIVIDEOPTIONS_H
#define QG_DIVIDEOPTIONS_H
#include <QDialog>
#include <QRadioButton>
namespace Ui {
class qg_divideoptions;
}
class qg_divideoptions : public QDialog
{
Q_OBJECT
public:
explicit qg_divideoptions( QString, QList<QString>, QWidget *parent = 0 );
~qg_divideoptions();
Ui::qg_divideoptions *ui;
private:
void closeEvent(QCloseEvent *event);
int newticks, newsize, newLayer, qty;
bool showhide, breaks;
signals:
void dataToSend( const int& newticks,
const int& newsize,
const bool& showhide,
const bool& breaks,
const int& newLayer );
private slots:
void on_buttonBox_accepted();
void on_buttonBox_rejected();
void on_Sp1_valueChanged( int );
void on_Sp2_valueChanged( int );
void on_showhide_pressed();
void on_breaks_pressed();
void slot_on_layer_btn_pressed();
void slot_btn_lost_focus( bool );
void delete_form_items();
};
#endif // QG_DIVIDEOPTIONS_H
//Form .cpp
qg_divideoptions::qg_divideoptions( QString activeLayer,
QList<QString> captionList,
QWidget *parent ) :
QDialog(parent),
ui(new Ui::qg_divideoptions)
{
this->show(); // for debug
qDebug() << "1" << captionList;
qDebug() << "2" << activeLayer;
qDebug() << "3" << ui->Sp1->value();
qDebug() << "4" << ui->Sp2->value();
newticks = ui->Sp1->value();
newsize = ui->Sp2->value();
qty = captionList.size();
showhide = false;
breaks = false;
QWidget* btnArea = new QWidget;
btnArea->setObjectName( "btnArea" );
btnArea->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
btnArea->setLayout(new QVBoxLayout(btnArea));
ui->scrollArea->setWidget(btnArea);
QLayout *layout = btnArea->layout();
layout->setSpacing(0);
for (int i = 0; i < qty; i++)
{
QRadioButton* btn = new QRadioButton( captionList.at(i) );
QObject::connect( btn, SIGNAL(toggled(bool)), this, SLOT(slot_btn_lost_focus(bool)) );
QObject::connect( btn, SIGNAL( clicked(bool) ), this, SLOT( slot_on_layer_btn_pressed() ) );
btn->setObjectName( QString::number(i) );
layout->addWidget( btn );
}
}
Qt 5.9.1
I'm showing a ui form and the passed variables come up as not accessible.
I had it working for a while and for some reason, now it does not.
I'm using some of Qt Creators built in slot mechanisms.
Maybe I deleted something, I don't know.
Anybody have an insiight?
Regards
//Debug output
Locals
activeLayer <not accessible> QString
btnArea 0x4 QWidget*
captionList <not accessible> QList<QString>
layout 0x30 QLayout*
parent 0x0 QWidget*
this @0x27d1c050 qg_divideoptions
Inspector
Expressions
Return Value
Tooltip
//Constructor
//activeLayer and buttonCaptions have valid data
QDialog *myNewform = new qg_divideoptions( activeLayer, buttonCaptions );
myNewform->setWindowFlags( myNewform->windowFlags() & ~Qt::WindowContextHelpButtonHint );
myNewform->setFixedSize(300, 400);
QObject::connect( myNewform,
SIGNAL( dataToSend(const int&, //newticks
const int&, //newsize
const bool&, //hidedhow
const bool&, //breaks
const int&)), //newLayer
this,
SLOT( gotData(const int, //ticksR
const int, //sizeR
const bool, //showhideR
const bool, //breaksR
const int)) ); //layerR
myNewform->exec(); //*** modal ***
//Form header
#ifndef QG_DIVIDEOPTIONS_H
#define QG_DIVIDEOPTIONS_H
#include <QDialog>
#include <QRadioButton>
namespace Ui {
class qg_divideoptions;
}
class qg_divideoptions : public QDialog
{
Q_OBJECT
public:
explicit qg_divideoptions( QString, QList<QString>, QWidget *parent = 0 );
~qg_divideoptions();
Ui::qg_divideoptions *ui;
private:
void closeEvent(QCloseEvent *event);
int newticks, newsize, newLayer, qty;
bool showhide, breaks;
signals:
void dataToSend( const int& newticks,
const int& newsize,
const bool& showhide,
const bool& breaks,
const int& newLayer );
private slots:
void on_buttonBox_accepted();
void on_buttonBox_rejected();
void on_Sp1_valueChanged( int );
void on_Sp2_valueChanged( int );
void on_showhide_pressed();
void on_breaks_pressed();
void slot_on_layer_btn_pressed();
void slot_btn_lost_focus( bool );
void delete_form_items();
};
#endif // QG_DIVIDEOPTIONS_H
//Form .cpp
qg_divideoptions::qg_divideoptions( QString activeLayer,
QList<QString> captionList,
QWidget *parent ) :
QDialog(parent),
ui(new Ui::qg_divideoptions)
{
this->show(); // for debug
qDebug() << "1" << captionList;
qDebug() << "2" << activeLayer;
qDebug() << "3" << ui->Sp1->value();
qDebug() << "4" << ui->Sp2->value();
newticks = ui->Sp1->value();
newsize = ui->Sp2->value();
qty = captionList.size();
showhide = false;
breaks = false;
QWidget* btnArea = new QWidget;
btnArea->setObjectName( "btnArea" );
btnArea->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
btnArea->setLayout(new QVBoxLayout(btnArea));
ui->scrollArea->setWidget(btnArea);
QLayout *layout = btnArea->layout();
layout->setSpacing(0);
for (int i = 0; i < qty; i++)
{
QRadioButton* btn = new QRadioButton( captionList.at(i) );
QObject::connect( btn, SIGNAL(toggled(bool)), this, SLOT(slot_btn_lost_focus(bool)) );
QObject::connect( btn, SIGNAL( clicked(bool) ), this, SLOT( slot_on_layer_btn_pressed() ) );
btn->setObjectName( QString::number(i) );
layout->addWidget( btn );
}
}