gui not showing, or closing to fast to see
-
@micha_eleric said in gui not showing, or closing to fast to see:
had no output, and std::cout << "name";, not doing anything.
Perhaps
std::flush()
orstd::endl
to flush, else you won't get it if you crash later on?however, i did find the line that was crashing the program.
And what was that then?
@JonB said in gui not showing, or closing to fast to see:
@micha_eleric said in gui not showing, or closing to fast to see:
however, i did find the line that was crashing the program.
And what was that then?
//ui->pushButton_22->connect(ui->pushButton_22, SIGNAL(clicked()),this, SLOT(CGUI::Btn_test_clicked()) ); //?? old qt4 ui->pushButton_22->connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked); //?? new qt5
CGUI::Btn_test_clicked exist
i tried inclosing in a try catch block, but still crashes -
@JonB said in gui not showing, or closing to fast to see:
@micha_eleric said in gui not showing, or closing to fast to see:
however, i did find the line that was crashing the program.
And what was that then?
//ui->pushButton_22->connect(ui->pushButton_22, SIGNAL(clicked()),this, SLOT(CGUI::Btn_test_clicked()) ); //?? old qt4 ui->pushButton_22->connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked); //?? new qt5
CGUI::Btn_test_clicked exist
i tried inclosing in a try catch block, but still crashesRemove everything on the left before
connect
-
Remove everything on the left before
connect
@Pl45m4 said in gui not showing, or closing to fast to see:
Remove everything on the left before
connect
well, now that i added a few \n at end of some std::cout, that line is not crashing, but something else is. it was running in regular run, with that commented out.
that format was working on other buttons.
why remove "ui->pushButton_22->"? -
ok. this makes no sense
in the constructorInitTestBoard(); std::cout << "constructor InitTestBoard finished \n" << std::flush;
void CGUI::InitTestBoard() { std::cout << "InitTestBoard \n" << std::flush; try { std::cout << "InitTestBoard try begin \n" << std::flush; //?? test arduino board leds //ui->pushButton_22->connect(ui->pushButton_22, SIGNAL(clicked()),this, SLOT(CGUI::Btn_test_clicked()) ); //?? old qt4 ui->pushButton_22->connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked); //?? new qt5 std::cout << "InitTestBoard try 2 \n" << std::flush; //?? Test Board/Motor wiring ui->textEdit_34->setFixedSize(30, 30); ui->textEdit_35->setFixedSize(30, 30); ui->textEdit_35->setFixedSize(30, 30); ui->textEdit_36->setFixedSize(30, 30); ui->textEdit_37->setFixedSize(30, 30); ui->textEdit_38->setFixedSize(30, 30); std::cout << "InitTestBoard try 3 \n" << std::flush; ui->textEdit_40->setFixedSize(30, 30); ui->textEdit_41->setFixedSize(30, 30); ui->textEdit_42->setFixedSize(30, 30); ui->textEdit_43->setFixedSize(30, 30); ui->textEdit_44->setFixedSize(30, 30); ui->textEdit_45->setFixedSize(30, 30); std::cout << "InitTestBoard try end \n" << std::flush; } catch(std::exception& e) { std::cout << "InitTestBoard catch begin \n" << std::flush; std::cout << e.what() << std::flush; MessageBoxError("InitTestBoard"); std::cout << e.what()<< std::flush; } }
console output
__name__ InitTestBoard InitTestBoard try begin InitTestBoard try 2 InitTestBoard try 3 Press <RETURN> to close this window...
it is crashing at end of try{}?
crashing in a try{}, but not getting caught?
well, now, if i comment out
ui->textEdit_40->setFixedSize(30, 30); ui->textEdit_41->setFixedSize(30, 30);
it does not crash on start
-
ok. this makes no sense
in the constructorInitTestBoard(); std::cout << "constructor InitTestBoard finished \n" << std::flush;
void CGUI::InitTestBoard() { std::cout << "InitTestBoard \n" << std::flush; try { std::cout << "InitTestBoard try begin \n" << std::flush; //?? test arduino board leds //ui->pushButton_22->connect(ui->pushButton_22, SIGNAL(clicked()),this, SLOT(CGUI::Btn_test_clicked()) ); //?? old qt4 ui->pushButton_22->connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked); //?? new qt5 std::cout << "InitTestBoard try 2 \n" << std::flush; //?? Test Board/Motor wiring ui->textEdit_34->setFixedSize(30, 30); ui->textEdit_35->setFixedSize(30, 30); ui->textEdit_35->setFixedSize(30, 30); ui->textEdit_36->setFixedSize(30, 30); ui->textEdit_37->setFixedSize(30, 30); ui->textEdit_38->setFixedSize(30, 30); std::cout << "InitTestBoard try 3 \n" << std::flush; ui->textEdit_40->setFixedSize(30, 30); ui->textEdit_41->setFixedSize(30, 30); ui->textEdit_42->setFixedSize(30, 30); ui->textEdit_43->setFixedSize(30, 30); ui->textEdit_44->setFixedSize(30, 30); ui->textEdit_45->setFixedSize(30, 30); std::cout << "InitTestBoard try end \n" << std::flush; } catch(std::exception& e) { std::cout << "InitTestBoard catch begin \n" << std::flush; std::cout << e.what() << std::flush; MessageBoxError("InitTestBoard"); std::cout << e.what()<< std::flush; } }
console output
__name__ InitTestBoard InitTestBoard try begin InitTestBoard try 2 InitTestBoard try 3 Press <RETURN> to close this window...
it is crashing at end of try{}?
crashing in a try{}, but not getting caught?
well, now, if i comment out
ui->textEdit_40->setFixedSize(30, 30); ui->textEdit_41->setFixedSize(30, 30);
it does not crash on start
@micha_eleric
You have several things wrong. Whether they cause the crash I don't know, but let's start by sorting them out....Remove your
try ... catch
. Qt does not throw C++ exceptions, and if you have a coding error/"crash" it won't catch it anyway.ui->pushButton_22->connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked); //?? new qt5
@Pl45m4 already said this is wrong. You want:
connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked); //?? new qt5
Before
ui->textEdit_40->setFixedSize(30, 30); ui->textEdit_41->setFixedSize(30, 30);
let's put in something like:
qDebug() << ui->textEdit_40 << ui->textEdit_41; // if previous line not acceptable to compiler remove it qDebug() << ui->textEdit_40->objectName() << ui->textEdit_41->objectName();
If either of these "crash"/"go wrong", narrow down to
textEdit_40
vstextEdit_41
one at a time. Is it because of just one of them, not the other? Or, does accessing either of them cause the problem?At one point you said a
SIGSTOP
was reported. Now you talk about "crashing", or just exiting. In any case, are you compiling for debug and running inside the debugger? Does the debugger catch anything/stop/report anything when your code goes wrong or exits? -
@micha_eleric
You have several things wrong. Whether they cause the crash I don't know, but let's start by sorting them out....Remove your
try ... catch
. Qt does not throw C++ exceptions, and if you have a coding error/"crash" it won't catch it anyway.ui->pushButton_22->connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked); //?? new qt5
@Pl45m4 already said this is wrong. You want:
connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked); //?? new qt5
Before
ui->textEdit_40->setFixedSize(30, 30); ui->textEdit_41->setFixedSize(30, 30);
let's put in something like:
qDebug() << ui->textEdit_40 << ui->textEdit_41; // if previous line not acceptable to compiler remove it qDebug() << ui->textEdit_40->objectName() << ui->textEdit_41->objectName();
If either of these "crash"/"go wrong", narrow down to
textEdit_40
vstextEdit_41
one at a time. Is it because of just one of them, not the other? Or, does accessing either of them cause the problem?At one point you said a
SIGSTOP
was reported. Now you talk about "crashing", or just exiting. In any case, are you compiling for debug and running inside the debugger? Does the debugger catch anything/stop/report anything when your code goes wrong or exits?@JonB both
ui->textEdit_40->setFixedSize(30, 30); ui->textEdit_41->setFixedSize(30, 30);
cause problems. comment out the first, second one crashes. comment out both, it runs.
-
@JonB both
ui->textEdit_40->setFixedSize(30, 30); ui->textEdit_41->setFixedSize(30, 30);
cause problems. comment out the first, second one crashes. comment out both, it runs.
@micha_eleric And the rest of the things I suggested you try?
-
@micha_eleric And the rest of the things I suggested you try?
qDebug() << ui->textEdit_40->objectName() << ui->textEdit_41->objectName(); qDebug() << ui->textEdit_40->objectName(); qDebug() << ui->textEdit_41->objectName();
all caused crash, no messages, that i found
-
Hi,
Is ui initialized properly ?
-
qDebug() << ui->textEdit_40->objectName() << ui->textEdit_41->objectName(); qDebug() << ui->textEdit_40->objectName(); qDebug() << ui->textEdit_41->objectName();
all caused crash, no messages, that i found
@micha_eleric
So it looks like you have a problem with those twotextEdit
pointers? Btw you have done a clean rebuild, so theuic
has been run on the latest.ui
file? You have initialised theui
prior to this code? -
@micha_eleric
You have several things wrong. Whether they cause the crash I don't know, but let's start by sorting them out....Remove your
try ... catch
. Qt does not throw C++ exceptions, and if you have a coding error/"crash" it won't catch it anyway.ui->pushButton_22->connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked); //?? new qt5
@Pl45m4 already said this is wrong. You want:
connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked); //?? new qt5
Before
ui->textEdit_40->setFixedSize(30, 30); ui->textEdit_41->setFixedSize(30, 30);
let's put in something like:
qDebug() << ui->textEdit_40 << ui->textEdit_41; // if previous line not acceptable to compiler remove it qDebug() << ui->textEdit_40->objectName() << ui->textEdit_41->objectName();
If either of these "crash"/"go wrong", narrow down to
textEdit_40
vstextEdit_41
one at a time. Is it because of just one of them, not the other? Or, does accessing either of them cause the problem?At one point you said a
SIGSTOP
was reported. Now you talk about "crashing", or just exiting. In any case, are you compiling for debug and running inside the debugger? Does the debugger catch anything/stop/report anything when your code goes wrong or exits?@JonB said in gui not showing, or closing to fast to see:
At one point you said a
SIGSTOP
was reported. Now you talk about "crashing", or just exiting. In any case, are you compiling for debug and running inside the debugger? Does the debugger catch anything/stop/report anything when your code goes wrong or exits?if i dont compile for debug, it runs, till i get to code that crashes. compile debug, and it crashes before getting to error code, and tells me nothing about where.
-
@micha_eleric
So it looks like you have a problem with those twotextEdit
pointers? Btw you have done a clean rebuild, so theuic
has been run on the latest.ui
file? You have initialised theui
prior to this code?@JonB said in gui not showing, or closing to fast to see:
@micha_eleric
So it looks like you have a problem with those twotextEdit
pointers? Btw you have done a clean rebuild, so theuic
has been run on the latest.ui
file? You have initialised theui
prior to this code?actually, i am using a .h file. just saw yesterday, that i could not open it with qt 5 designer, and qt 5 designer saves in .ui
most other text boxes and buttons run fine.
code in .h file for text boxes and buttons, look like copy/paste except numbers change.
dont know how to convert .h to .ui, or how to open .h with qt 5 designer. the qt designer i used before was much easier to design with. -
@JonB said in gui not showing, or closing to fast to see:
@micha_eleric
So it looks like you have a problem with those twotextEdit
pointers? Btw you have done a clean rebuild, so theuic
has been run on the latest.ui
file? You have initialised theui
prior to this code?actually, i am using a .h file. just saw yesterday, that i could not open it with qt 5 designer, and qt 5 designer saves in .ui
most other text boxes and buttons run fine.
code in .h file for text boxes and buttons, look like copy/paste except numbers change.
dont know how to convert .h to .ui, or how to open .h with qt 5 designer. the qt designer i used before was much easier to design with.@micha_eleric
I happen to notice that afterui->textEdit_38
ui->textEdit_39
is absent, then you say it goes wrong atui->textEdit_40
. Don't know what you want 40+ text edits for, but anyway why not delete all afterui->textEdit_38
, make sure it works at that point. Then add the further ones in and see how it goes. -
@micha_eleric
I happen to notice that afterui->textEdit_38
ui->textEdit_39
is absent, then you say it goes wrong atui->textEdit_40
. Don't know what you want 40+ text edits for, but anyway why not delete all afterui->textEdit_38
, make sure it works at that point. Then add the further ones in and see how it goes.@JonB said in gui not showing, or closing to fast to see:
@micha_eleric
I happen to notice that afterui->textEdit_38
ui->textEdit_39
is absent, then you say it goes wrong atui->textEdit_40
. Don't know what you want 40+ text edits for, but anyway why not delete all afterui->textEdit_38
, make sure it works at that point. Then add the further ones in and see how it goes.yah. not sure about that.
did find 39,40, and 41 cause a crash in another part that call those three, but not the other text boxes. -
@micha_eleric
I happen to notice that afterui->textEdit_38
ui->textEdit_39
is absent, then you say it goes wrong atui->textEdit_40
. Don't know what you want 40+ text edits for, but anyway why not delete all afterui->textEdit_38
, make sure it works at that point. Then add the further ones in and see how it goes.@JonB said in gui not showing, or closing to fast to see:
@micha_eleric
I happen to notice that afterui->textEdit_38
ui->textEdit_39
is absent, then you say it goes wrong atui->textEdit_40
. Don't know what you want 40+ text edits for, but anyway why not delete all afterui->textEdit_38
, make sure it works at that point. Then add the further ones in and see how it goes.
runs finestd::cout << "InitTestBoard try 3 \n" << std::flush; // ui->textEdit_40->setFixedSize(30, 30); // ui->textEdit_41->setFixedSize(30, 30); ui->textEdit_42->setFixedSize(30, 30); ui->textEdit_43->setFixedSize(30, 30); ui->textEdit_44->setFixedSize(30, 30); ui->textEdit_45->setFixedSize(30, 30); std::cout << "InitTestBoard try end \n" << std::flush;
crashes
std::cout << "InitTestBoard try 3 \n" << std::flush; ui->textEdit_40->setFixedSize(30, 30); ui->textEdit_41->setFixedSize(30, 30); ui->textEdit_42->setFixedSize(30, 30); ui->textEdit_43->setFixedSize(30, 30); ui->textEdit_44->setFixedSize(30, 30); ui->textEdit_45->setFixedSize(30, 30); std::cout << "InitTestBoard try end \n" << std::flush;
-
found it
in CUi_MainWindow.h [the file that has gui layout] file 39, 40, and 41 are different -
@micha_eleric
So it looks like you have a problem with those twotextEdit
pointers? Btw you have done a clean rebuild, so theuic
has been run on the latest.ui
file? You have initialised theui
prior to this code?@JonB said in gui not showing, or closing to fast to see:
Btw you have done a clean rebuild, so the
uic
has been run on the latest.ui
file?@micha_eleric
Do a complete project rebuild/make some change in Designer to update the.ui
file and forceuic
to run on it again.ui_MainWindow.h
is a generated file; don't change it yourself, it will get overwritten. -
@JonB said in gui not showing, or closing to fast to see:
Btw you have done a clean rebuild, so the
uic
has been run on the latest.ui
file?@micha_eleric
Do a complete project rebuild/make some change in Designer to update the.ui
file and forceuic
to run on it again.ui_MainWindow.h
is a generated file; don't change it yourself, it will get overwritten.@JonB not sure where to ui or uic files are. if i still have them
-
@JonB not sure where to ui or uic files are. if i still have them
uic
is the User Interface Compiler, which does exactly what you've mentioned before.. creates an usable header from your*.ui
design template...
And every time you re-run it, your header file will be created or updated... so it makes no sense to edit the file yourself and change some object names -
uic
is the User Interface Compiler, which does exactly what you've mentioned before.. creates an usable header from your*.ui
design template...
And every time you re-run it, your header file will be created or updated... so it makes no sense to edit the file yourself and change some object names@Pl45m4 just found the .iu file.
trying to remember what i did 4 years ago