KDE/Qt Tips 004
来源:互联网 发布:免费打电话软件推荐 编辑:程序博客网 时间:2024/06/10 11:20
布局
QLabel
main
关于布局
QVBoxLayout
QHBoxLayout
QGridLayout
Inherits QBoxLayout.
常用的函数:
QLayout ( QWidget * parent, int margin = 0, int spacing = -1, const char * name = 0 )
QLayout ( QLayout * parentLayout, int spacing = -1, const char * name = 0 )
void addChildLayout ( QLayout * l )
The margin is the number of pixels between the edge of the widget and its managed children. The spacing is the default number of pixels between neighboring children. If spacing is -1 the value of margin is used for spacing.
void QLayout::setMenuBar ( QMenuBar * w ) [virtual]
Makes the geometry manager take account of the menu bar w. All child widgets are placed below the bottom edge of the menu bar.
bool QLayout::activate ()
Redoes the layout for mainWidget(). You should generally not need to call this because it is automatically called at the most appropriate times.
However, if you set up a QLayout for a visible widget without resizing that widget, you will need to call this function in order to lay it out.
QBoxLayout ( QWidget * parent, Direction d, int margin = 0, int spacing = -1, const char * name = 0 )
QBoxLayout ( QLayout * parentLayout, Direction d, int spacing = -1, const char *name = 0 )
Inherits QLayout.
Inherited by QHBoxLayout and QVBoxLayout.
void addWidget ( QWidget * widget, int stretch = 0, int alignment = 0 )
void addLayout ( QLayout * layout, int stretch = 0 )
bool setStretchFactor ( QWidget * w, int stretch )
bool setStretchFactor ( QLayout * l, int stretch )
QHBoxLayout ( QWidget * parent, int margin = 0, int spacing = -1, const char * name = 0 )
QHBoxLayout ( QLayout * parentLayout, int spacing = -1, const char * name = 0 )
关于QLabel
setScaledContents( TRUE );//可以使Label内的图像随label大小而拉伸,一直填满label
setPaletteBackgroundPixmap( pix );//拉伸时自动填充label
setPixmap(pix);//拉伸时大小不变
main函数中若
mainWin = new MyWidget;
app.setMainWidget(mainWin);
return app.exec;
程序关闭时不会调MyWidget;的析构函数
除非在app.exec后加上
delete mainWin;
或者
MyWidget mainWin;
app.setMainWidget(&mainWin);
return app.exec;
QLabel
main
关于布局
QVBoxLayout
QHBoxLayout
QGridLayout
Inherits QBoxLayout.
常用的函数:
QLayout ( QWidget * parent, int margin = 0, int spacing = -1, const char * name = 0 )
QLayout ( QLayout * parentLayout, int spacing = -1, const char * name = 0 )
void addChildLayout ( QLayout * l )
The margin is the number of pixels between the edge of the widget and its managed children. The spacing is the default number of pixels between neighboring children. If spacing is -1 the value of margin is used for spacing.
void QLayout::setMenuBar ( QMenuBar * w ) [virtual]
Makes the geometry manager take account of the menu bar w. All child widgets are placed below the bottom edge of the menu bar.
bool QLayout::activate ()
Redoes the layout for mainWidget(). You should generally not need to call this because it is automatically called at the most appropriate times.
However, if you set up a QLayout for a visible widget without resizing that widget, you will need to call this function in order to lay it out.
QBoxLayout ( QWidget * parent, Direction d, int margin = 0, int spacing = -1, const char * name = 0 )
QBoxLayout ( QLayout * parentLayout, Direction d, int spacing = -1, const char *name = 0 )
Inherits QLayout.
Inherited by QHBoxLayout and QVBoxLayout.
void addWidget ( QWidget * widget, int stretch = 0, int alignment = 0 )
void addLayout ( QLayout * layout, int stretch = 0 )
bool setStretchFactor ( QWidget * w, int stretch )
bool setStretchFactor ( QLayout * l, int stretch )
QHBoxLayout ( QWidget * parent, int margin = 0, int spacing = -1, const char * name = 0 )
QHBoxLayout ( QLayout * parentLayout, int spacing = -1, const char * name = 0 )
关于QLabel
setScaledContents( TRUE );//可以使Label内的图像随label大小而拉伸,一直填满label
setPaletteBackgroundPixmap( pix );//拉伸时自动填充label
setPixmap(pix);//拉伸时大小不变
main函数中若
mainWin = new MyWidget;
app.setMainWidget(mainWin);
return app.exec;
程序关闭时不会调MyWidget;的析构函数
除非在app.exec后加上
delete mainWin;
或者
MyWidget mainWin;
app.setMainWidget(&mainWin);
return app.exec;
- KDE/Qt Tips 004
- KDE/Qt GUI程序设计
- GTK QT Gnome KDE
- gnome kde qt gtk+
- Qt Tips
- qt tips
- GNOME/GTK+和KDE/Qt
- GNOME/GTK+和KDE/Qt
- KDE/QT VS. GNOME/GTK
- KDE/QT vs GNOME/GTK
- KDE/QT vs GNOME/GTK
- KDE/QT vs GNOME/GTK
- KDE/QT vs GNOME/GTK
- Qt's tips
- Symbian&Qt Tips
- QT Tips (持续更新)
- Qt Creator 使用tips
- Qt Little Tips
- 十四项心理定律 (转载)
- 网格剖分总结
- 些许感悟
- 二十六个字母自加1,不会进位
- 李维语录
- KDE/Qt Tips 004
- linux登录问题
- 初学Java后第一个作品,请大家多多支持!!!
- 光盘自动运行
- 好几天没写,各种原因
- 前置增量和后置增量在cout中的输出情况
- 发几个笑话,轻松一下。
- 20岁MM和25岁MM的区别
- 10部令人泣不成声的经典电影(多图)