How to change the location of a Qwidget (code only please with how the code work)
How to change the location of a Qwidget.
@ui->Qwidget->y(want I want for the y core.)
ui->Qwidget->x(want I want for the x core.)@
but that don't work please help me i am coming from C# and what make sense to me doesn't work.
You can use "move":http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#pos-prop function for your QWidget.
C++ does not have the concept of Properties - you need to use a setter (set*()) to change values, and getter to read them.
Qt adds Properties, but modifying them is a bit more tedious than in C# due to language constrains.
Doesn't work :(.
[quote author="sierdzio" date="1364202910"]C++ does not have the concept of Properties - you need to use a setter (set*()) to change values, and getter to read them.
Qt adds Properties, but modifying them is a bit more tedious than in C# due to language constrains.[/quote]
Can you gice me a ex. how to do it I am a kinda of a noob to qt and c++.
Convention in Qt is: setter beginns with "set", and getter is just the property name.
QString currentText = lineEdit->text();
lineEdit->setText(currentString + "some changes");
Qt Properties are part of Qt Meta Object system (docs are very good, feel free to consult them):
QString currentText = lineEdit->property("text").toString();
lineEdit->setProperty("text", currentString + "some changes");
Hope this clears things up a bit. Don't worry, you'll get it this time. I imagine transferring from C# can be a bit challenging, C++ is different even if it sometimes looks similar.
You can use Move function of your widget with two parameters i.e. x and y coordinates. You can also use setGeometry function of your widget with four parameters. In setGeometry function, 1st and 2nd parameters are x and y coordinates respectively and 3rd and 4th parameters are width and height of your widget.
Usually you want to use layouts. Hardcoding positions of widgets is in 99.9% of the use-cases the wrong thing to do.