"does not refer to a value" error
-
ADDENDUM
OK, I had a chance to read similar post.
It sort of explains that "connect" needs to refer to an instance of the object.This is my code "hierarchy"
Main project ( QWindow()
mdiArea with menu ( bar) - main ":window"
selected menu (QWiidget) - child sub window
selected submenu (QDialog) - free floating formMy task is to copy / move the "selected submenu" dialog (GUI) to the main window as a new subwindow.
my connect should look like this is - in pseudo code
connect ( selected submenu, emit SIGNAl, main window , SLOT addSubwindow )
In the above described hierarchy - what is the "instance " of the main "window"?
My actual code
connect(this,SIGNAL(addSubwindow()),MainWindow,SLOT(newSubWindow()));
passes by compiler with the exception of "MainWindow" .
Again - I do not get how to determine / code the actual instance of "MainWindow".
What is confusing me is the code hierarchy when the final subMenu dialog is still running as part of the "MainWindow".
I am unimpressed with "new" format .
Is it over the developer's head to fix stuff instead of making irrelevant "cute" changes?
I can highlight my title and get a list of similar posts BUT I cannot open any of them.
..and I cannot do "search" until I am done "submitting" my current post.ANS NO , I am not submitting bug report - if "you - owners of this forum " want to have crappy forum it is your business.
So I will post this and than do a search for similar problems....
What does "does not refer to a value" mean is irrelevant - how do I fix it?
strikethrough text// event void MainWindow::newSubWindow(void) connect(this,SIGNAL(addSubwindow()),MainWindow,SLOT(newSubWindow())); //&MainWindow,SLOT(newSubWindow())); emit addSubwindow(1);
/mnt/07b7c3f8-0efb-45ab-8df8-2a468771de1f/PROJECTS/RECOVERY/BLUETOOTH/SOURCE/CCC_SOURCE/terminal_SERIAL_BLUETOOTH_VER_1/terminal_SERIAL_BLUETOOTH/terminal_BLUETOOTH/mainwindow_BT_Terminal.cpp:1440: error: 'MainWindow' does not refer to a value mainwindow_BT_Terminal.cpp:1440:45: error: 'MainWindow' does not refer to a value connect(this,SIGNAL(addSubwindow()),MainWindow,SLOT(newSubWindow())); ^ ../../../FT857_library/../MAIN_MDI/mainwindows/mdi/mainwindow.h:67:7: note: declared here class MainWindow : public QMainWindow // declaration ^
-
ADDENDUM
OK, I had a chance to read similar post.
It sort of explains that "connect" needs to refer to an instance of the object.This is my code "hierarchy"
Main project ( QWindow()
mdiArea with menu ( bar) - main ":window"
selected menu (QWiidget) - child sub window
selected submenu (QDialog) - free floating formMy task is to copy / move the "selected submenu" dialog (GUI) to the main window as a new subwindow.
my connect should look like this is - in pseudo code
connect ( selected submenu, emit SIGNAl, main window , SLOT addSubwindow )
In the above described hierarchy - what is the "instance " of the main "window"?
My actual code
connect(this,SIGNAL(addSubwindow()),MainWindow,SLOT(newSubWindow()));
passes by compiler with the exception of "MainWindow" .
Again - I do not get how to determine / code the actual instance of "MainWindow".
What is confusing me is the code hierarchy when the final subMenu dialog is still running as part of the "MainWindow".
I am unimpressed with "new" format .
Is it over the developer's head to fix stuff instead of making irrelevant "cute" changes?
I can highlight my title and get a list of similar posts BUT I cannot open any of them.
..and I cannot do "search" until I am done "submitting" my current post.ANS NO , I am not submitting bug report - if "you - owners of this forum " want to have crappy forum it is your business.
So I will post this and than do a search for similar problems....
What does "does not refer to a value" mean is irrelevant - how do I fix it?
strikethrough text// event void MainWindow::newSubWindow(void) connect(this,SIGNAL(addSubwindow()),MainWindow,SLOT(newSubWindow())); //&MainWindow,SLOT(newSubWindow())); emit addSubwindow(1);
/mnt/07b7c3f8-0efb-45ab-8df8-2a468771de1f/PROJECTS/RECOVERY/BLUETOOTH/SOURCE/CCC_SOURCE/terminal_SERIAL_BLUETOOTH_VER_1/terminal_SERIAL_BLUETOOTH/terminal_BLUETOOTH/mainwindow_BT_Terminal.cpp:1440: error: 'MainWindow' does not refer to a value mainwindow_BT_Terminal.cpp:1440:45: error: 'MainWindow' does not refer to a value connect(this,SIGNAL(addSubwindow()),MainWindow,SLOT(newSubWindow())); ^ ../../../FT857_library/../MAIN_MDI/mainwindows/mdi/mainwindow.h:67:7: note: declared here class MainWindow : public QMainWindow // declaration ^
@AnneRanch said in "does not refer to a value" error:
connect(this,SIGNAL(addSubwindow()),MainWindow,SLOT(newSubWindow()));
It seems that
MainWindow
is not the name of your object ofMainWindow
class.
If you are IN your MainWindow class, usethis
or the proper name of yourMainWindow
object, if you don't.BTW:
You still don't like the "new" (actually not new anymore) connection style, don't you?! :)BTW:
Your whole post is a mess and hard to understand. Non formatted code snippets between questions and other text, confusing images and more stuff.
Not offensive, but sometimes it's hard to understand what are you asking for :)To answer your question, what to put in your connect statement instead of
MainWindow
, you have to look where you create it (Or show the relevant part of the code, at least). -
@Pl45m4 Of course the post is a mess. It is peculiar that "they" cannot fix the "search" ...it has been an issue for years. It is unreasonable to expect the user to jump thru hoops to get thing posted - so GIGO...
No, II have no issues with "new " connect , but I am using OLD examples and THEY still use it , so ....
( I only which people likes you quit pushing it - it is my business...Yes, my main window is named "MainWindow" and the solution was to use an instance of it and I have no idea HOW to put it in code.
I was assuming that "this" belongs to the object where "connect" is coded , hence I do not want to run "SLOT" in THAT object.
-
ADDENDUM
OK, I had a chance to read similar post.
It sort of explains that "connect" needs to refer to an instance of the object.This is my code "hierarchy"
Main project ( QWindow()
mdiArea with menu ( bar) - main ":window"
selected menu (QWiidget) - child sub window
selected submenu (QDialog) - free floating formMy task is to copy / move the "selected submenu" dialog (GUI) to the main window as a new subwindow.
my connect should look like this is - in pseudo code
connect ( selected submenu, emit SIGNAl, main window , SLOT addSubwindow )
In the above described hierarchy - what is the "instance " of the main "window"?
My actual code
connect(this,SIGNAL(addSubwindow()),MainWindow,SLOT(newSubWindow()));
passes by compiler with the exception of "MainWindow" .
Again - I do not get how to determine / code the actual instance of "MainWindow".
What is confusing me is the code hierarchy when the final subMenu dialog is still running as part of the "MainWindow".
I am unimpressed with "new" format .
Is it over the developer's head to fix stuff instead of making irrelevant "cute" changes?
I can highlight my title and get a list of similar posts BUT I cannot open any of them.
..and I cannot do "search" until I am done "submitting" my current post.ANS NO , I am not submitting bug report - if "you - owners of this forum " want to have crappy forum it is your business.
So I will post this and than do a search for similar problems....
What does "does not refer to a value" mean is irrelevant - how do I fix it?
strikethrough text// event void MainWindow::newSubWindow(void) connect(this,SIGNAL(addSubwindow()),MainWindow,SLOT(newSubWindow())); //&MainWindow,SLOT(newSubWindow())); emit addSubwindow(1);
/mnt/07b7c3f8-0efb-45ab-8df8-2a468771de1f/PROJECTS/RECOVERY/BLUETOOTH/SOURCE/CCC_SOURCE/terminal_SERIAL_BLUETOOTH_VER_1/terminal_SERIAL_BLUETOOTH/terminal_BLUETOOTH/mainwindow_BT_Terminal.cpp:1440: error: 'MainWindow' does not refer to a value mainwindow_BT_Terminal.cpp:1440:45: error: 'MainWindow' does not refer to a value connect(this,SIGNAL(addSubwindow()),MainWindow,SLOT(newSubWindow())); ^ ../../../FT857_library/../MAIN_MDI/mainwindows/mdi/mainwindow.h:67:7: note: declared here class MainWindow : public QMainWindow // declaration ^
@AnneRanch said in "does not refer to a value" error:
// event void MainWindow::newSubWindow(void)
connect(this,SIGNAL(addSubwindow()),MainWindow,SLOT(newSubWindow()));
//&MainWindow,SLOT(newSubWindow()));
emit addSubwindow(1);What file/class we are in here? (i.e. what is
this
?). If this class doesn't have access to yourMainWindow
object, that you want to connect, this can't work. I doubt, that your object pointer is called/spelledMainWindow
. And if it does, it would be very confusing.