Archived:Creating Context Menu from QPushButton
valderind4
(Talk | contribs) m (fix Qt for S60 to Qt for Symbian) |
|||
| Line 19: | Line 19: | ||
==Preconditions== | ==Preconditions== | ||
| − | * [http://pepper.troll.no/s60prereleases/ Download the latest Qt for | + | * [http://pepper.troll.no/s60prereleases/ Download the latest Qt for Symbian distribution from Qt]. |
| − | * Install Qt for | + | * Install Qt for Symbian:[[Installing Qt on Symbian]] |
* Check this link for installation guide: [http://pepper.troll.no/s60prereleases/doc/install-s60.html How to install the package]. | * Check this link for installation guide: [http://pepper.troll.no/s60prereleases/doc/install-s60.html How to install the package]. | ||
* Go through this article: [[Mobile Extension APIs]] | * Go through this article: [[Mobile Extension APIs]] | ||
| Line 59: | Line 59: | ||
==Related Links== | ==Related Links== | ||
| − | * [[How_to_use_QPushButton_( | + | * [[How_to_use_QPushButton_(Qt_for_Symbian)|How to use QPushButton]] |
Revision as of 20:09, 9 September 2009
Article Metadata
Tested with
Devices(s): Emulator
Compatibility
Platform(s): S60 3rd Edition, S60 5th Edition
Article
Keywords: QPushButton
Created: (27 Jun 2009)
Last edited: valderind4
(09 Sep 2009)
Contents |
Introduction
Associates the popup menu menu with this push button.
This turns the button into a menu button, which in some styles will produce a small triangle to the right of the button's text.
Preconditions
- Download the latest Qt for Symbian distribution from Qt.
- Install Qt for Symbian:Installing Qt on Symbian
- Check this link for installation guide: How to install the package.
- Go through this article: Mobile Extension APIs
Source Code
Source File
#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.
}
Screenshot


