×
Namespaces

Variants
Actions
Revision as of 04:15, 11 October 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Archived:如何显示正常和最大尺寸的widget

From Nokia Developer Wiki
Jump to: navigation, search

Archived.png存档: 这篇文章是存档,因为考虑到今天它与第三方开发者建立商业解决方案不相关。

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

Article Metadata

兼容于
平台:
Symbian

文章
翻译:
hoolee
最后由 hamishwillee 在 11 Oct 2012 编辑


示例代码

#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
}


当点击Normal Size后的输出

Normalsize.jpg


点击最大化后的输出

Maximize.jpg

This page was last modified on 11 October 2012, at 04:15.
110 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.

×