Archived:Como criar um Menu, usando um QPushButton
hamishwillee
(Talk | contribs) m (Hamishwillee - Addition to article of: Category:MeeGo Category:Symbian. (Add platform categories)) |
hamishwillee
(Talk | contribs) m (Text replace - "<code cpp>" to "<code cpp-qt>") |
||
| (8 intermediate revisions by one user not shown) | |||
| Line 1: | Line 1: | ||
| − | [[Category:Lang-Portuguese]] | + | {{Archived|language=Lang-Portuguese|timestamp=20120216050358|user=[[User:Hamishwillee|<br />----]]|[[:Category:Qt Quick|Qt Quick]] should be used for all UI development on mobile devices. The approach described in this article (based on {{Qapiname|QWidget}}) is deprecated.}} |
| − | [[Category:Qt]] | + | [[Category:Lang-Portuguese]][[Category:Qt C++ UI]][[Category:Code Snippet]][[Category:MeeGo Harmattan]][[Category:Symbian]] |
| − | [[Category:Code | + | {{Abstract|Associa um ''popup menu'' a um {{Qapiname|QPushButton}}.}} 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. |
| − | {{ArticleMetaData | + | {{ArticleMetaData <!-- v1.2 --> |
|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 | + | |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 | + | |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 --> | + | |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 by the article/code example (e.g. Location, NetworkServices. --> |
| − | |keywords=QPushButton | + | |keywords= QPushButton |
| − | + | |language= Lang-Portuguese | |
| − | |language=Lang-Portuguese | + | |translated-by= [[User:Valderind4]] |
| − | |translated-by=[[User:Valderind4]] | + | |translated-from-title= Archived:Creating Context Menu from QPushButton |
| − | |translated-from-title=Creating Context Menu from QPushButton | + | |translated-from-id= 60712 <!-- automated guess --> |
| − | |translated-from-id=60712 <!-- automated guess --> | + | |review-by= <!-- After re-review: [[User:username]] --> |
| − | |review-by=<!-- After re-review: [[User:username]] --> | + | |
|review-timestamp= <!-- After re-review: YYYYMMDD --> | |review-timestamp= <!-- After re-review: YYYYMMDD --> | ||
|update-by= <!-- After significant update: [[User:username]]--> | |update-by= <!-- After significant update: [[User:username]]--> | ||
|update-timestamp= <!-- After significant update: YYYYMMDD --> | |update-timestamp= <!-- After significant update: YYYYMMDD --> | ||
| − | |creationdate=20090911 | + | |creationdate= 20090911 |
| − | |author=[[User:Mind freak]] | + | |author= [[User:Mind freak]] |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
}} | }} | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
==Código fonte== | ==Código fonte== | ||
== Arquivo fonte== | == Arquivo fonte== | ||
| − | <code cpp> | + | <code cpp-qt> |
#include "button.h" | #include "button.h" | ||
#include "ui_button.h" | #include "ui_button.h" | ||
| Line 70: | Line 57: | ||
==Captura de tela== | ==Captura de tela== | ||
| − | [[ | + | [[File:Mybutton001001.jpg]] |
==Links relacionados== | ==Links relacionados== | ||
| − | * [[Como usar um QPushButton | + | * [[Archived:Como usar um QPushButton]] |
| − | <!-- Translation --> [[en:Creating Context Menu from QPushButton | + | |
| + | <!-- Translation --> [[en:Archived:Creating Context Menu from QPushButton]] | ||
Latest revision as of 04:13, 11 October 2012
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.
Qt Quick should be used for all UI development on mobile devices. The approach described in this article (based on QWidget) is deprecated.
Associa um popup menu a um QPushButton. 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.
Dados do artigo
Testado com
Aparelho(s): Emulator
Compatibilidade
Plataforma(s): S60 3rd Edition, S60 5th Edition
Artigo
Palavras-chave: QPushButton
Tradução:
Originado de Archived:Creating Context Menu from QPushButton
Por valderind4
Última alteração feita por hamishwillee
em 11 Oct 2012
Contents |
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


