PDA

View Full Version : Is there a limit to number of widgets on a gui page?



emp1953
17th June 2017, 15:15
I made up a demo showing how to change colors and text of various widgets. I have 9 Qdial, 9 QRadioButton, 11 pushbutton on the page.

When I add one more pushbutton it shows on the designer view but not when running. Also when I associate a pressed() slot with it the compiler complains about it.

Is there a limit?

Thanks in advance

d_stranz
17th June 2017, 22:18
Is there a limit?

None except the limit imposed by the size of your screen. And if you put them in a scrolling window, then there really isn't a size limit either.


Also when I associate a pressed() slot with it the compiler complains about it.


Then you're likely using the wrong variable name in your code. Go back to Qt Designer and see what it thinks it is named and either rename it there and save the file or fix your code to match.

emp1953
18th June 2017, 05:40
The problem is frustrating. I cant add any widgets at all. I'm wondering if something got corrupted. Working in creator I open the .ui file and add a pushbutton or textedit box. It shows up in on the gui. When I compile it does not show up when the app is executed. If I add a slot, the compiler complains that the widget named, no matter what I call it, I get the error 'class Ui::buttonDemo' has no member named widget1.

What could be wrong, The name is copied out of the object name field of the widget members/methods window on the right side of the creator window, so there's no error in the spelling of the name. No matter what I name it the results are the same.

Thanks for helping

Added after 1 34 minutes:

An interesting chain of events fixed things, but I'm not comfortable with it.

I went to a command line, did a qmake on the pro file and did a make It built without the errors that creator was giving.

The widgets were there and slots functioned as expected.

I went back to creator, did a build/run and it compiled without error and ran fine.

Could it be that the CLEAN in creator doesn't completely do what it is supposed to do.

This is unnerving.

Thanks for your help, if anyone knows of a bug that might cause this please let us know.

d_stranz
18th June 2017, 20:06
Thanks for your help, if anyone knows of a bug that might cause this please let us know.

I usually use Visual Studio (which has Microsoft project files, not Qt .pro files), but on the few occasions when I use Qt Creator I have observed that you do not need to run qmake unless you've added new GUI files to a project and the Makefiles need to be updated. Making changes to a .ui file doesn't change the set of files in the project, and the build rules -should- take care of it.

On the other hand, if you do experience unexplained build behavior, re-running qmake is often a good solution. I don't know if it is a bug as such, maybe just an occasional loss of synchronization between all the moving parts.

---
Someone on the admin side of this forum needs to nuke the spammer (akram009) who posted the comment prior to this one. Seems we have more and more of these idiots popping up lately.