• 20946阅读
  • 20回复

【提问】如何在窗口标题栏上添加“最大化”和“最小化”按钮(Qt4) [复制链接]

上一主题 下一主题
离线guyansrg
 

只看楼主 正序阅读 楼主  发表于: 2005-12-10
在Qt4中,窗口标题栏上只有帮助按钮和关闭按钮。
想问一下大家,如何在窗口标题栏上添加“最大化”和“最小化”按钮?
离线morriszy

只看该作者 20楼 发表于: 2010-12-10
树叶片,你太有才了...
VS2010+Qt4.7.0
离线ttylikl

只看该作者 19楼 发表于: 2009-05-12
不管QT3还是QT4,只要从QWidget看下来总是能找到答案的。楼主在求助之前还需多费点心思看看自己能不能解决问题啊。
离线zwrabbit
只看该作者 18楼 发表于: 2009-05-11
在Qwidget累下
好好学习
离线water_wf

只看该作者 17楼 发表于: 2008-07-27
版主脾气真好!
离线htyoung

只看该作者 16楼 发表于: 2008-07-24
这种问题是很难回答的,就像问1+1=?
***
QT5
***
离线hanxing30

只看该作者 15楼 发表于: 2008-07-24
我用的也是4,,里面的确有。

老大是冤枉的。
离线nmiirq

只看该作者 14楼 发表于: 2008-07-23
这个帖子比较有意思,呵呵~
离线fanbinnet

只看该作者 13楼 发表于: 2007-08-17
老大 你好可怜呀
离线szy333

只看该作者 12楼 发表于: 2007-08-17
搞笑了。
离线wengweng
只看该作者 11楼 发表于: 2006-08-24
q3 和q4 有很多本质上的区别.所以提问的时候务必说明版本
q4 下面用 setWindowFlags(Qt::WindowMinMaxButtonsHint);
q3尚为用过
离线shenjinqi
只看该作者 10楼 发表于: 2006-08-02
Qt3是setWFlags().
离线XChinux

只看该作者 9楼 发表于: 2005-12-30
下面是引用guyansrg于2005-12-30 08:19发表的:
真的有 setWindowFlags? 不会是你搞错了吧?
给别人解答问题是好事,但说一些错误的东西误导别人,是不能让人容忍的。
真的有 setWindowFlags?我把Qt4的 Assistant整个的翻了一遍,就是没有。
.......
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
离线guyansrg

只看该作者 8楼 发表于: 2005-12-30
下面是引用XChinux于2005-12-15 21:41发表的:
我晕,我就不信你用的Qt4查不到setWindowFlags


真的有 setWindowFlags? 不会是你搞错了吧?
给别人解答问题是好事,但说一些错误的东西误导别人,是不能让人容忍的。
真的有 setWindowFlags?我把Qt4的 Assistant整个的翻了一遍,就是没有。
肯定是你瞎编的。
我知道自己只查到 Qt::WidgetFlags ,里面有Qt::WStyle_Minimize 和 Qt::WStyle_Maximize
和Qt::WStyle_MinMax 。


真晕,让别人给唬得晕晕的…………………………
离线guyansrg

只看该作者 7楼 发表于: 2005-12-16
晕,我真的没查到。
因为我装了Qt3.3.4 和Qt4.01,两个好像混到一块儿了……
算了,算自己的运气不好,没查到……
至今我还在晕……
谢啦
离线XChinux

只看该作者 6楼 发表于: 2005-12-15
enum Qt::WindowType
flags Qt::WindowFlags
This enum type is used to specify various window-system properties for the widget. They are fairly unusual but necessary in a few cases. Some of these flags depend on whether the underlying window manager supports them.
The main types are
Constant
Value
Description
Qt::Widget
0x00000000
This is the default type for QWidget. Widgets of this type are child widgets if they have a parent, and independent windows if they have no parent. See also Qt::Window and Qt::SubWindow.
Qt::Window
0x00000001
Indicates that the widget is a window, usually with a window system frame and a title bar, irrespective of whether the widget has a parent or not.
Qt::Dialog
0x00000002 | Window
Indicates that the widget is a window that should be decorated as a dialog (i.e., typically no maximize or minimize buttons in the title bar). This is the default type for QDialog. If you want to use it as a modal dialog, it should be launched from another window, or have a parent and used with the Qt::WA_ShowModal attribute. If you make it modal, the dialog will prevent other top-level windows in the application from getting any input. We refer to a top-level window that has a parent as a secondary window. (See also Qt::WA_GroupLeader.)
Qt::Sheet
0x00000004 | Window
Indicates that the widget is a Macintosh sheet.
Qt::Drawer
0x00000006 | Window
Indicates that the widget is a Macintosh drawer.
Qt::Popup
0x00000008 | Window
Indicates that the widget is a popup top-level window, i.e. that it is modal, but has a window system frame appropriate for popup menus.
Qt::Tool
0x0000000a | Window
Indicates that the widget is a tool window. A tool window is often a small window with a smaller than usual title bar and decoration, typically used for collections of tool buttons. It there is a parent, the tool window will always be kept on top of it. If there isn't a parent, you may consider using Qt::WindowStaysOnTopHint as well. If the window system supports it, a tool window can be decorated with a somewhat lighter frame. It can also be combined with Qt::FramelessWindowHint.
Qt::ToolTip
0x0000000c | Window
Indicates that the widget is a tooltip. This is used internally to implement tooltips.
Qt::SplashScreen
0x0000000e | Window
Indicates that the window is a splash screen. This is the default type for QSplashScreen.
Qt::Desktop
0x00000010 | Window
Indicates that this widget is the desktop. This is the type for QDesktopWidget.
Qt::SubWindow
0x00000012
Indicates that this widget is a child widget, irrespective of whether the widget has a parent or not.
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
离线XChinux

只看该作者 5楼 发表于: 2005-12-15
我晕,我就不信你用的Qt4查不到setWindowFlags

windowFlags : Qt::WindowFlags
Window flags are a combination of a type (e.g. Qt::Dialog) and zero or more hints to the window system (e.g. Qt::FramelessWindowHint).
If the widget had type Qt::Widget or Qt::SubWindow and becomes a window (Qt::Window, Qt::Dialog, etc.), it is put at position (0, 0) on the desktop. If the widget is a window and becomes a Qt::Widget or Qt::SubWindow, it is put at position (0, 0) relative to its parent widget.
Access functions:
Qt::WindowFlags windowFlags () const
void setWindowFlags ( Qt::WindowFlags type )
See also windowType().
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
离线guyansrg

只看该作者 4楼 发表于: 2005-12-15
晕,要是我真查到了,我还问你干什么?
离线XChinux

只看该作者 3楼 发表于: 2005-12-13
用Assistant自己查。
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
离线guyansrg

只看该作者 2楼 发表于: 2005-12-13
问一下:setWindowFlags函数在哪个类里面?
离线XChinux

只看该作者 1楼 发表于: 2005-12-12
看一看setWindowFlags()这个函数。
窗口标题栏上的按钮以及窗体的风格,随着WindowFlags的设置不同而不同,你详细看一下文档就明白了。
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
快速回复
限100 字节
 
上一个 下一个