Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:How to implement QToolBox

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Qt Quick should be used for all UI development on mobile devices. The approach described in this article (based on QWidget) is deprecated.

This code snippet shows how to implement a QToolBox; a widget that that displays a column of tabs one above the other, with the current item displayed below the current tab.

Article Metadata
Tested with
Devices(s): S60 Emulator
Compatibility
Platform(s): S60 3rd Edition/S60 5th Edition
Symbian
Article
Keywords: QToolBox
Created: mind_freak (21 Jul 2009)
Last edited: hamishwillee (11 Oct 2012)

Contents

Code snippet

Header file

#include <QtGui/QWidget>
#include<QToolBox>
#include<QHBoxLayout>
#include<QPushButton>
class tool : public QWidget
{
Q_OBJECT
 
public:
tool(QWidget *parent = 0);
~tool();
 
private:
QToolBox *box;
QHBoxLayout *lay;
QPushButton *but1;
QPushButton *but2;
QPushButton *but3;
};
 
#endif // TOOL_H

CPP file

#include "tool.h"
tool::tool(QWidget *parent)
: QWidget(parent)
{
box=new QToolBox(this);
lay=new QHBoxLayout(this);
but1=new QPushButton("Nokia N97",this);
but2=new QPushButton("Nokia E51",this);
but3=new QPushButton("Nokia 5800 XM",this);
 
box->addItem(but1,"Nokia N-Series");
box->addItem(but2,"Nokia E-series");
 
box->addItem(but3,"Xpress music");
lay->addWidget(box);
setLayout(lay);
setStyleSheet("* { background-color:rgb(0,0,0);color:rgb(200,150,100); padding: 7px}}");
showMaximized();
}
 
tool::~tool()
{
// No need to delete any object that has a parent which is properly deleted.
}

Screeenshot

Toolbox002.jpg

This page was last modified on 11 October 2012, at 01:14.
166 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.

×