Talk:Qt for Beginners: Difference between revisions
(Default compiler selected for builds - always all of the auto-detected compilers? even the ones that need installing?) |
Oliver Broad (talk | contribs) (→Pointers - does it really work that way?: new section) |
||
Line 6: | Line 6: | ||
It's nothing critical, just something that seems annoying unless you own a commercial version where you're preparing for massive software deployments. | It's nothing critical, just something that seems annoying unless you own a commercial version where you're preparing for massive software deployments. | ||
== Pointers - does it really work that way? == | |||
Reading the section on creating a "window" class I see: | |||
{| class="wikitable" | |||
|- | |||
| // Create and position the button | |||
m_button = new QPushButton("Hello World", this); | |||
m_button->setGeometry(10, 10, 80, 30); | |||
} | |||
Please note that there is no need for writing a destructor for deleting m_button. With the parenting system, when the Window instance is out of the stack, the m_button is automatically deleted. | |||
|} | |||
This had me a bit confused as although the pointer is a member of "window" it appears to be a plain vanilla pointer and not "smart" so m_button going out of scope wouldn't automatically delete the button. | |||
Then I read it again: "parenting system", so presumeably the process of passing "this" to the constructor transfers "ownership" of the object, making the inherited QWidget responsible for cleaning up? | |||
Looking again I see it is explained briefly, I think it needs to be made clearer. |
Latest revision as of 20:01, 21 June 2022
Configuring Qt? (Qtcreator v5.11+) - the default compilers auto-detected but needing attention are a bit annoying on re-builds:
I know it's a common question to me by now, but specifically when getting into the Qt Creator, I've noticed that I have the option to build on some of the new projects, and that's not the issue if the compiler hasn't even generated a make file, the issue is that when your program automatically selects all the compiler kit profiles you CAN have on the Qt IDE through auto-detection, when there may be only one compiler put in use? I have only the MingW 32bit compiler I want to use by default, and I've selected one manually and placed it as the default configuration: Windows - the Mingw 32bit gcc compiler and on Linux simply the GNU GCC compiler.
When I start a new build from a downloaded example, I get the selection of all the compilers that CAN be run on the Windows Qt version of the IDE (Linux too) and have to unselect ALL of them at the top to select the only one that is currently installed, and the default manual selection (a direct, unaltered copy of the 32bit MingW compiler profile - and set as default) doesn't get selected. What am I missing? How do I make it only ask to build the default profile? (scratching my head, feeling like I missed a setting somewhere.)
It's nothing critical, just something that seems annoying unless you own a commercial version where you're preparing for massive software deployments.
Pointers - does it really work that way?
Reading the section on creating a "window" class I see:
// Create and position the button
m_button = new QPushButton("Hello World", this); m_button->setGeometry(10, 10, 80, 30); } Please note that there is no need for writing a destructor for deleting m_button. With the parenting system, when the Window instance is out of the stack, the m_button is automatically deleted. |
This had me a bit confused as although the pointer is a member of "window" it appears to be a plain vanilla pointer and not "smart" so m_button going out of scope wouldn't automatically delete the button.
Then I read it again: "parenting system", so presumeably the process of passing "this" to the constructor transfers "ownership" of the object, making the inherited QWidget responsible for cleaning up?
Looking again I see it is explained briefly, I think it needs to be made clearer.