Namespaces
Variants
Actions
Revision as of 04:14, 11 October 2012 by hamishwillee (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Archived:Como usar uma QToolBox

Jump to: navigation, search
Archived.png
Aquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

Qt Quick should be used for all UI development on mobile devices. The approach described in this article (based on QWidget) is deprecated.
Dados do artigo

Testado com
SDK: Qt 4.5
Aparelho(s): S60 Emulator

Compatibilidade
Plataforma(s): S60 3rd Edition/S60 5th Edition

Artigo
Palavras-chave: QToolBox
Tradução:
Última alteração feita por hamishwillee em 11 Oct 2012

Contents

Introdução

Uma toolBox é um widget que mostra uma coluna de abas, uma sobre a outra, com o item corrente mostrado abaixo da aba atual. Cada aba possui uma posição de índice na coluna de abas.

Isto é usado geralmente em muitas IDE'S, como no Qt Creator, onde a toolBox contem todos os widgets que podem ser arrastados e usados na construção de uma janela ou diálogo.

Código

Cabeçalhos de arquivo

#include <QtGui/QWidget>
#include<QToolBox>
#include<QHBoxLayout>
#include<QPushButton>
class tool : public QWidget
{
Q_OBJECT
 
public:
tool(QWidget *parent = 0);
~tool();
 
private:
QToolBox *box;
QHBoxLayout *lay;
QPushButton *but1;
QPushButton *but2;
QPushButton *but3;
};
 
#endif // TOOL_H

Arquivo CPP

#include "tool.h"
tool::tool(QWidget *parent)
: QWidget(parent)
{
box=new QToolBox(this);
lay=new QHBoxLayout(this);
but1=new QPushButton("Nokia N97",this);
but2=new QPushButton("Nokia E51",this);
but3=new QPushButton("Nokia 5800 XM",this);
 
box->addItem(but1,"Nokia N-Series");
box->addItem(but2,"Nokia E-series");
 
box->addItem(but3,"Xpress music");
lay->addWidget(box);
setLayout(lay);
setStyleSheet("* { background-color:rgb(0,0,0);color:rgb(200,150,100); padding: 7px}}");
showMaximized();
}
 
tool::~tool()
{
// No need to delete any object that has a parent which is properly deleted.
 
}

Captura de tela

Toolbox002.jpg

Mais sobre QToolBox

293 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved