Archived:Como criar um Menu, usando um QPushButton
valderind4
(Talk | contribs) (Created page with 'Category:Lang-PT Category:Qt (Português) Category:Exemplos de código Qt Original em: Creating Menu from QPushButton (Qt for Symbian) {{CodeSnippet |id=... |pla…') |
hamishwillee
(Talk | contribs) m (Text replace - "<code cpp>" to "<code cpp-qt>") |
||
| (14 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
| − | [[ | + | {{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: | + | {{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 <!-- v1.2 --> |
| − | | | + | |sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) --> |
| − | |platform=S60 3rd Edition, S60 5th Edition | + | |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]) --> |
| − | | | + | |platform= S60 3rd Edition, S60 5th Edition |
| − | | | + | |devicecompatability= <!-- Compatible devices (e.g.: All* (must have GPS) ) --> |
| − | |keywords=QPushButton | + | |dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 --> |
| + | |signing= <!-- Empty or one of Self-Signed, DevCert, Manufacturer --> | ||
| + | |capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. --> | ||
| + | |keywords= QPushButton | ||
| + | |language= Lang-Portuguese | ||
| + | |translated-by= [[User:Valderind4]] | ||
| + | |translated-from-title= Archived: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]] | ||
}} | }} | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
==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 56: | 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: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


