Namespaces
Variants
Actions
Revision as of 22:43, 27 June 2009 by mind_freak (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Archived:Creating Context Menu from QPushButton

Jump to: navigation, search
Article Metadata

Tested with
Devices(s): 5800 Xpress Muzic

Compatibility
Platform(s): S60 3rd Edition, S60 5th Edition

Article
Keywords: QPushButton
Created: (27 Jun 2009)
Last edited: mind_freak (27 Jun 2009)

Contents

Introdction

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()
{
 
}

Screenshot

Butmenu.JPG

Butmenu1.JPG


Related Links

How to use QPushButton

643 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved