I encountered this problem in the development of a violent audio detection system. The scenario was that I closed a video and then opened a video again, and found that the playback interface was already occupied by the previous video layer, resulting in the sound of video playback, but There is no picture. Still no picture. Later, I saw a blog to solve this problem, click me.
I used the simplest and clearest way. If they are different you will get an error because Qt tries to assign the second layout to your widget which has already had a layout set. Changing the above two lines to this will fix your problem. You can remove calls to setLayout as they are redundant. Below is a transformation that you might wish to perform. I've included a shortened version of your code to demonstrate. Initialize layouts in the class declaration by giving them the widgets they act on.
This makes the structure of the user interface all obvious from the header itself:. Add code from setupUi to the constructor's body, changing it appropriately to act on values, not pointers:. By using this Hook, you tell React that your component needs to do something after render.
This means that function inside useEffect will be called after rendering of the component. That's why you have an empty object. About the error. You have it because React doesn't remember your users variable - it will be recreated on each render of SetValue component. It will be better to use useState hook to set value in useEffect and remember it on the next render.
And one more note. I had corrected this when I tested your code. I've updated my answer accordingly. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Does ES6 make JavaScript frameworks obsolete?
Podcast Do polyglots have an edge when it comes to mastering programming Featured on Meta. Now live: A fully responsive profile.
Linked 0. Related 3. Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled. Accept all cookies Customize settings.
0コメント