×
Namespaces

Variants
Actions
Revision as of 15:54, 1 October 2009 by Ikipou (Talk | contribs)

Archived:How to display a widget with normal and maximize size in Qt

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Emulator
Compatibility
Platform(s): S60 3rd Edition, S60 5th Edition
Symbian
Article
Keywords: QVBoxLayout,QHBoxLayout
Created: (28 Dec 2008)
Last edited: Ikipou (01 Oct 2009)
{{{width}}}
{{{width}}}


Code

#include <QApplication>
#include <QPushButton>
#include <QVBoxLayout>
 
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
 
// win is the top level widget
QWidget win;
QVBoxLayout* layout = new QVBoxLayout(&win);
 
// This button show the top level widget in a normal size
QPushButton* normalSizeButton = new QPushButton("Normal size");
QObject::connect(normalSizeButton, SIGNAL(clicked()), &win, SLOT(showNormal()));
layout->addWidget(normalSizeButton);
 
// This button maximize the widget size
QPushButton* maximzeButton = new QPushButton("Maximize");
QObject::connect(maximzeButton, SIGNAL(clicked()), &win, SLOT(showMaximized()));
layout->addWidget(maximzeButton);
 
// This button exit the application
QPushButton* exitButton = new QPushButton("Exit");
QObject::connect(exitButton, SIGNAL(clicked()), &app, SLOT(quit()));
layout->addWidget(exitButton);
 
win.show(); // show the top level widget
return app.exec(); // start the event loop
}


Output after clicking on Normal Size

Normalsize.jpg


Output after clicking on maximize

Maximize.jpg

111 page views in the last 30 days.