summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_gui_widgets_qlabel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/snippets/code/src_gui_widgets_qlabel.cpp')
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qlabel.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_gui_widgets_qlabel.cpp b/doc/src/snippets/code/src_gui_widgets_qlabel.cpp
new file mode 100644
index 0000000..d3b9254
--- /dev/null
+++ b/doc/src/snippets/code/src_gui_widgets_qlabel.cpp
@@ -0,0 +1,24 @@
+//! [0]
+QLabel *label = new QLabel(this);
+label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
+label->setText("first line\nsecond line");
+label->setAlignment(Qt::AlignBottom | Qt::AlignRight);
+//! [0]
+
+
+//! [1]
+QLineEdit* phoneEdit = new QLineEdit(this);
+QLabel* phoneLabel = new QLabel("&Phone:", this);
+phoneLabel->setBuddy(phoneEdit);
+//! [1]
+
+
+//! [2]
+QLineEdit *nameEd = new QLineEdit(this);
+QLabel *nameLb = new QLabel("&Name:", this);
+nameLb->setBuddy(nameEd);
+QLineEdit *phoneEd = new QLineEdit(this);
+QLabel *phoneLb = new QLabel("&Phone:", this);
+phoneLb->setBuddy(phoneEd);
+// (layout setup not shown)
+//! [2]