×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Creating Context Menu from QPushButton

From Nokia Developer Wiki
Jump to: navigation, search
mind_freak (Talk | contribs)
kiran10182 (Talk | contribs)
m
Line 11: Line 11:
 
[[Category:Qt]][[Category:Qt for S60]][[Category:S60]][[Category:How To]][[Category:Code Examples]]
 
[[Category:Qt]][[Category:Qt for S60]][[Category:S60]][[Category:How To]][[Category:Code Examples]]
  
==Introdction==
+
==Introduction==
 
Program shows the menu generated when button is pressed.
 
Program shows the menu generated when button is pressed.
  
Line 65: Line 65:
  
 
==Related Links==
 
==Related Links==
[http://wiki.forum.nokia.com/index.php/How_to_use_QPushButton_(Qt_for_S60) How to use QPushButton]
+
* [[How_to_use_QPushButton_(Qt_for_S60)|How to use QPushButton]]

Revision as of 13:37, 28 July 2009

Article Metadata
Tested with
Devices(s): 5800 Xpress Muzic
Compatibility
Platform(s): S60 3rd Edition, S60 5th Edition
Symbian
Article
Keywords: QPushButton
Created: (27 Jun 2009)
Last edited: kiran10182 (28 Jul 2009)

Contents

Introduction

Program shows the menu generated when button is pressed.

Preconditions

Source Code

Source File

#include "button.h"
#include "ui_button.h"
 
button::button(QWidget *parent)
: QWidget(parent)
{
lay=new QHBoxLayout();
menu=new QMenu();
menu->addMenu("Nokia");
menu->addMenu("N96");
menu->addMenu("N97");
but1=new QPushButton("Menu");
but1->setMenu(menu);
lay->addWidget(but1);
setLayout(lay);
}
 
button::~button()
{
if(menu)
{
delete menu;
}
if(but1)
{
delete but1;
}
if(lay)
{
delete lay;
}
 
}

Screenshot

Butmenu.JPG

Butmenu1.JPG


Related Links

242 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×