×
Namespaces

Variants
Actions
Revision as of 16:30, 27 August 2009 by lpvalente (Talk | contribs)

Archived:Exemplos de QWidgets

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): N95-1
Compatibility
Platform(s): S60 3rd Edition, FP1, FP2 S60 5th Edition
Symbian
S60 3rd Edition FP2
S60 3rd Edition FP1
S60 3rd Edition (initial release)
Article
Keywords: QTextEdit, QSpinBox, QSlider, QPushButton
Created: (25 de agosto, 2009)
Last edited: lpvalente (27 Aug 2009)


A definição de Widgets pode ser encontrada no artigo Widgets em Qt.

Contents

Introdução

Widgets são elementos visuais que quando combinados formam a interface do usuário de uma aplicação Qt. Abaixo são listado alguns exemplos de widgets:

Exemplos

QSpinBox e QSlider

#include <QSlider>
#include <QSpinBox>
#include <QApplication>
 
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget* w = new QWidget();
QHBoxLayout* l = new QHBoxLayout();
QSlider* sl = new QSlider( Qt::Horizontal );
QSpinBox* sb = new QSpinBox();
 
l->addWidget( sb );
l->addWidget( sl );
w->setLayout( l );
w->show();
return app.exec();
}
SliderQt.PNG
Exemplos de Widget: QSpinBox e QSlider

QPushButton

#include <QPushButton>
#include <QApplication>
 
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton* b = new QPushButton("Botão em Qt");
b->show();
return app.exec();
}
BotaoQt.PNG
Exemplos de Widget: QPushButton

QTextEdit

#include <QTextEdit>
#include <QApplication>
 
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTextEdit* t = new QTextEdit("Campo de texto");
t->show();
return app.exec();
}
CampoTextoQt.PNG
Exemplos de Widget: QTextEdit
88 page views in the last 30 days.
×