Archived:Como criar um Menu, usando um QPushButton
hamishwillee
(Talk | contribs) m (Hamishwillee - Bot update) |
hamishwillee
(Talk | contribs) m (Hamishwillee - Add Abstract. Tidy wiki text) |
||
| Line 1: | Line 1: | ||
| − | |||
[[Category:Lang-Portuguese]][[Category:QWidget UI]][[Category:Code Snippet]][[Category:MeeGo]][[Category:Symbian]] | [[Category:Lang-Portuguese]][[Category:QWidget UI]][[Category:Code Snippet]][[Category:MeeGo]][[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. | ||
| + | {{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.}} | ||
| + | |||
{{ArticleMetaData <!-- v1.2 --> | {{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]]) --> | ||
| Line 23: | Line 25: | ||
|author= [[User:Mind freak]] | |author= [[User:Mind freak]] | ||
}} | }} | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
==Código fonte== | ==Código fonte== | ||
Revision as of 08:58, 16 February 2012
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.
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.
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 Creating Context Menu from QPushButton
Por mind_freak
Última alteração feita por hamishwillee
em 16 Feb 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


