LineEdit
-
hello
help me please
am trying to create a window wich contain a lineEdit but it 's not work fo me the lineEdit don't apear in the window
here is my code
@
#include <QApplication>
#include <QtWidgets>
#include <QtGui>
#include <QLineEdit>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);QWidget fenetre; fenetre.setWindowIcon(QIcon("depositphotos_4161065-Medical-background.jpg")); fenetre.setWindowTitle("yakine"); QLineEdit monChamp("Contenu du champ"); QString contenu = monChamp.text(); fenetre.show(); return app.exec();
}
@[edit, code tags added, koahnig]
-
"Please use code wrapping tags.":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01 Those make your code readable in the forum.
That is not the way you are using Qt for setting up a window with an input line. "Have a look to these examples":http://qt-project.org/doc/qt-5/examples-dialogs.html
-
Hi yakine,
the best way to start is indeed working through some samples.
I suggest you have a look at the Qt style sheet example - don't care for the style sheets itself but use it as a template for working with the Qt Creator and the most common widgets. -
"There are also many tutorials around, please check them out.":http://lmgtfy.com/?q=qt+start+tutorial In the tutorials on youtube you can find how to use Qt creator. They may be a bit outdated once in a while since Qt creator is still developed, but you will see and find easily youir way around.
The "dialog example":http://qt-project.org/doc/qt-5/qtwidgets-dialogs-standarddialogs-example.html is an easy one to start with. Just try to use it in Qt creator and comment out stuff to see the effects.
You see also in this example that nothing is really done in the main program.