×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Exemplos de QWidgets

From Nokia Developer Wiki
Jump to: navigation, search
cabezonxdg (Talk | contribs)
(QSpinBox e QSlider)
cabezonxdg (Talk | contribs)
Line 1: Line 1:
 +
{{CodeSnippet
 +
|id=...
 +
|platform=S60 3rd Edition, FP1, FP2
 +
S60 5th Edition
 +
|devices=N95-1
 +
|category=Qt
 +
|subcategory=...
 +
|creationdate=25 de agosto, 2009
 +
|keywords=QTextEdit, QSpinBox, QSlider, QPushButton
 +
}}
 +
<br>
 
A definição de Widgets pode ser encontrada no artigo [[Widgets em Qt]].
 
A definição de Widgets pode ser encontrada no artigo [[Widgets em Qt]].
  
Line 31: Line 42:
  
 
== QPushButton ==
 
== QPushButton ==
 +
<code cpp>
 +
#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();
 +
}
 +
</code>
 
[[Image:BotaoQt.PNG|center]]
 
[[Image:BotaoQt.PNG|center]]
 
<div align=center>'''Exemplos de Widget: QPushButton'''</div>
 
<div align=center>'''Exemplos de Widget: QPushButton'''</div>
  
 
== QTextEdit ==
 
== QTextEdit ==
 +
<code cpp>
 +
#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();
 +
}
 +
</code>
 
[[Image:CampoTextoQt.PNG|center]]
 
[[Image:CampoTextoQt.PNG|center]]
 
<div align=center>'''Exemplos de Widget: QTextEdit'''</div>
 
<div align=center>'''Exemplos de Widget: QTextEdit'''</div>

Revision as of 02:02, 26 August 2009

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: cabezonxdg (26 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
258 page views in the last 30 days.