Qt widgets

简介: 1,Qt部件Widgets--CheckWidgets,安置其他部件的Widgets,让用户选择数值的部件 选择部件---使用户能够从预定义的条目菜单中做出选择,combination QListBox,QComboBox,列表组合框 QListBox列表框部件一般用于使用户从中选择一个或多个...

1,Qt部件Widgets--CheckWidgets,安置其他部件的Widgets,让用户选择数值的部件

选择部件---使用户能够从预定义的条目菜单中做出选择,combination

QListBox,QComboBox,列表组合框

QListBox列表框部件一般用于使用户从中选择一个或多个条目,条目通常为文本类型,也可以是位图

QComboBox *combobox;

combobox = new QComboBox(false,this);设置组合框是否为读写,部件父对象

2,部件布局--程序中合理安排部件使程序看起来美观,从而更容易使用

部件类

QGroupBox,QButtonGroup,QSplitter,QWidgetStack

3,QGroupBox用于在部件周围绘制一个框架,在框架的上端添加描述信息

g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -I/opt/Qt5.4.1/5.4/gcc_64/include -I/opt/Qt5.4.1/5.4/gcc_64/include/QtWidgets -I/opt/Qt5.4.1/5.4/gcc_64/include/QtGui -I/opt/Qt5.4.1/5.4/gcc_64/include/QtCore -I. -I/opt/Qt5.4.1/5.4/gcc_64/mkspecs/linux-g++ -o box.o box.cpp
box.cpp: In constructor ‘MyMainWindow::MyMainWindow()’:
box.cpp:24:22: error: ‘AlignHCenter’ was not declared in this scope
  label->setAlignment(AlignHCenter | AlignVCenter);
                      ^
box.cpp:24:22: note: suggested alternative:
In file included from /opt/Qt5.4.1/5.4/gcc_64/include/QtCore/qbytearray.h:38:0,
                 from /opt/Qt5.4.1/5.4/gcc_64/include/QtCore/qstring.h:38,
                 from /opt/Qt5.4.1/5.4/gcc_64/include/QtCore/qcoreapplication.h:38,
                 from /opt/Qt5.4.1/5.4/gcc_64/include/QtWidgets/qapplication.h:37,
                 from /opt/Qt5.4.1/5.4/gcc_64/include/QtWidgets/QApplication:1,
                 from box.cpp:1:
/opt/Qt5.4.1/5.4/gcc_64/include/QtCore/qnamespace.h:232:9: note:   ‘AlignHCenter’
         AlignHCenter = 0x0004,
         ^
box.cpp:24:37: error: ‘AlignVCenter’ was not declared in this scope
  label->setAlignment(AlignHCenter | AlignVCenter);
                                     ^
box.cpp:24:37: note: suggested alternative:
In file included from /opt/Qt5.4.1/5.4/gcc_64/include/QtCore/qbytearray.h:38:0,
                 from /opt/Qt5.4.1/5.4/gcc_64/include/QtCore/qstring.h:38,
                 from /opt/Qt5.4.1/5.4/gcc_64/include/QtCore/qcoreapplication.h:38,
                 from /opt/Qt5.4.1/5.4/gcc_64/include/QtWidgets/qapplication.h:37,
                 from /opt/Qt5.4.1/5.4/gcc_64/include/QtWidgets/QApplication:1,
                 from box.cpp:1:
/opt/Qt5.4.1/5.4/gcc_64/include/QtCore/qnamespace.h:239:9: note:   ‘AlignVCenter’
         AlignVCenter = 0x0080,
         ^
make: *** [box.o] Error 1

创建和放置分组框架,QGroupBox::setTitle("");设置分组框的标题

4,QButtonGroup与QGroupBox 相似,有一些布局按钮方面的特殊功能

QButtonGroup对象的最常用的方法是布置单线按钮,在QButtonGroup

setExclusibe()

5,QSplitter()拆分对象使用户能够通过拖动拆分器所提供的部件间的分割线控制子部件的大小

 

目录
相关文章
|
11月前
Qt 之 QSystemTrayIcon
Qt 之 QSystemTrayIcon
242 0
|
11月前
|
存储
Qt之QLCDNumber
Qt之QLCDNumber
290 0
|
Java C++
Qt之QFuture
简述 QFuture 类代表一个异步计算的结果。 要启动一个计算,使用 Qt之Concurrent框架 中的 APIs 之一。 QFuture 允许线程与一个或多个结果同步,这些结果将在稍后的时间点准备就绪,该结果可以是具有默认构造函数和拷贝构造函数的任何类型。如果一个结果在调用 result()、resultAt() 或 results() 函数时不可用,QFutur
1969 0
|
安全 Java
Qt之QThreadPool和QRunnable
简述 QRunnable 是所有 runnable 对象的基类,而 QThreadPool 类用于管理 QThreads 集合。 QRunnable 类是一个接口,用于表示一个任务或要执行的代码,需要重新实现 run() 函数。 QThreadPool 管理和循环使用单独的 QThread 对象,以帮助程序减少创建线程的成本。每个 Qt 应用程序都有一个全局 QThre
3454 0
|
存储
Qt之QUrlQuery
简述 QUrlQuery 类提供了一种方法来操纵 URL 查询中的 key-value 对。 简述 详细描述 编码 处理空格和加号 全解码 非标准分隔符 使用 QUrlQuery 分隔符 查询 删除 是否为空 详细描述 QUrlQuery 用来解析 URL 中的查询字符串,像下面这样: 上述的查询字符串在 URL 中 被用来传输
2680 0
|
Windows
Qt之QProgressBar
简述 QProgressBar部件提供了一个水平或垂直进度条。 进度条用于给用户操作一个进度指示,并向它们说明应用程序仍在运行。 简述 详细描述 读取方向 进度方向 效果 源码 文本显示 效果 源码 繁忙指示 效果 源码 QSS 详细描述 可以通过setRange()来设置进度的最小值和最大值(取值范围),也可使用setMinimum(
2654 0
Qt之QSpinBox和QDoubleSpinBox
简述 QSpinBox和QDoubleSpinBox均派生自QAbstractSpinBox。 QSpinBox旨在处理整数和离散值(例如:月份名称),QDoubleSpinBox则用于处理浮点值。他们之间的区别就是处理数据的类型不同,其他功能都基本相同。 QDoubleSpinBox的默认的精度是2位小数,但可以通过setDecimals()来改变。 下面主要以QS
1880 0
|
网络协议 存储
Qt之QNetworkAddressEntry
简述 QNetworkAddressEntry类由网络接口支持,存储了一个IP地址,子网掩码和广播地址。 每个网络接口可以包含零个或多个IP地址,进而可以关联到一个子网掩码和/或一个广播地址(取决于操作系统的支持)。 这个类代表一个这样的组。 简述 常用接口 使用 更多参考 常用接口 QHostAddress broadcast() co
1716 0

热门文章

最新文章