×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Como criar um Menu, usando um QPushButton

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Automated change of category from Lang-PT to Unlikely Category. (Moving))
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update of Template:ArticleMetaData)
Line 2: Line 2:
 
[[Category:Qt]]
 
[[Category:Qt]]
 
[[Category:Code Examples]]
 
[[Category:Code Examples]]
Original em: [[Creating Menu from QPushButton (Qt for Symbian)]]
 
  
 
{{ArticleMetaData
 
{{ArticleMetaData
|id=...
 
|platform=S60 3rd Edition, S60 5th Edition
 
|devices=Emulator
 
|category=Qt for Symbian
 
|subcategory= UI
 
|creationdate= 27 June 2009
 
|keywords=QPushButton
 
 
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices=Emulator
 
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
 
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
 +
|platform=S60 3rd Edition, S60 5th Edition
 
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
 
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
 
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
 
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices.) -->
 
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices.) -->
|author=[[User:Valderind4]]
+
|keywords=QPushButton
 +
|id=...
 +
|language=Lang-Portuguese
 +
|translated-by=[[User:Valderind4]]
 +
|translated-from-title=Creating Context Menu from QPushButton
 +
|translated-from-id=60712 <!-- automated guess -->
 +
|review-by=<!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate=20090911
 +
|author=[[User:Mind freak]]
 +
 
 +
<!-- The following items are not in the standard metadata template -->
 +
|category=Qt for Symbian
 +
|subcategory= UI
 
}}
 
}}
  
Line 66: Line 75:
 
==Links relacionados==
 
==Links relacionados==
 
* [[Como usar um QPushButton, em Qt para Symbian| Como usar um QPushButton, em Qt para Symbian]]
 
* [[Como usar um QPushButton, em Qt para Symbian| Como usar um QPushButton, em Qt para Symbian]]
 +
<!-- Translation --> [[en:Creating Context Menu from QPushButton]]

Revision as of 02:20, 19 December 2011


Article Metadata

Testado com
Aparelho(s): Emulator

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

Artigo
Palavras-chave: QPushButton
Tradução:
Por valderind4
Última alteração feita por hamishwillee em 19 Dec 2011

Contents

Introdução

Associa um popup menu a um push button.

Isso transforma o botão em um botão de menu, que em alguns estilos, produzirá um pequeno triângulo à direita do texto do botão.

Pré-requisitos

Baixe e instale a versão atual do Qt para Symbian segundo as instruções deste artigo.

Código fonte

Arquivo fonte

#include "button.h"
#include "ui_button.h"
 
button::button(QWidget *parent)
: QWidget(parent)
{
win=new QWidget(this);
win->resize(400,500);
lay=new QHBoxLayout(this);
menu=new QMenu(this);
menu->addMenu("Nokia");
menu->addMenu("N96");
menu->addMenu("N97");
but1=new QPushButton("Menu",this);
but1->setMenu(menu);
lay->addWidget(but1);
win->setLayout(lay);
win->win->setStyleSheet("* { background-color:rgb(125,100,50);color:rgb(200,150,100); padding: 7px}}");
}
 
button::~button()
{
// No need to delete any object that has a parent which is properly deleted.
}

Captura de tela

Mybutton001001.jpg


Links relacionados

136 page views in the last 30 days.
×