Archived:Como criar um Menu, usando um QPushButton
hamishwillee
(Talk | contribs) m (Text replace - "Category:MeeGo" to "Category:MeeGo Harmattan") |
hamishwillee
(Talk | contribs) m (Text replace - "<code cpp>" to "<code cpp-qt>") |
||
| (2 intermediate revisions by one user 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:Lang-Portuguese]][[Category:Qt C++ UI]][[Category:Code Snippet]][[Category:MeeGo Harmattan]][[Category:Symbian]] | [[Category:Lang-Portuguese]][[Category:Qt C++ UI]][[Category:Code Snippet]][[Category:MeeGo Harmattan]][[Category:Symbian]] | ||
{{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. | {{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 --> | {{ArticleMetaData <!-- v1.2 --> | ||
| Line 16: | Line 16: | ||
|language= Lang-Portuguese | |language= Lang-Portuguese | ||
|translated-by= [[User:Valderind4]] | |translated-by= [[User:Valderind4]] | ||
| − | |translated-from-title= Creating Context Menu from QPushButton | + | |translated-from-title= Archived: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]] --> | ||
| Line 28: | Line 28: | ||
==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 61: | Line 61: | ||
==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


