我是靠谱客的博主 笨笨黄蜂,最近开发中收集的这篇文章主要介绍qt界面基类,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

QWidgets

所有用户界面对象的基类。
Header: #include
qmake: QT += widgets

内容函数名
窗口函数show(),hide(),raise()//顶层,lower()//底层,close()
顶层窗口windowModified, windowTitle, windowIcon, isActiveWindow, activateWindow(), minimized, showMinimized(), maximized, showMaximized(), fullScreen, showFullScreen(), showNormal().
窗口内容update(), repaint(), scroll().//update()不会立即进行重绘事件,有一个事件循环,不会像repaint()那样发生闪烁
常规pos, x(), y(), rect, size, width(), height(), move(), resize(), sizePolicy, sizeHint(), minimumSizeHint(), updateGeometry(), layout(), frameGeometry, geometry, childrenRect, childrenRegion, adjustSize(), mapFromGlobal(), mapToGlobal(), mapFromParent(), mapToParent(), maximumSize, minimumSize, sizeIncrement, baseSize, setFixedSize()
模式visible, isVisibleTo(), enabled, isEnabledTo(), modal, isWindow(), mouseTracking, updatesEnabled, visibleRegion().
stylestyle(), setStyle(), styleSheet, cursor, font, palette, backgroundRole(), setBackgroundRole(), fontInfo(), fontMetrics().
焦点focus, focusPolicy, setFocus(), clearFocus(), setTabOrder(), setFocusProxy(), focusNextChild(), focusPreviousChild().
事件event(), mousePressEvent(), mouseReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), keyPressEvent(), keyReleaseEvent(), focusInEvent(), focusOutEvent(), wheelEvent(), enterEvent(), leaveEvent(), paintEvent(), moveEvent(), resizeEvent(), closeEvent(), dragEnterEvent(), dragMoveEvent(), dragLeaveEvent(), dropEvent(), childEvent(), showEvent(), hideEvent(), customEvent(). changeEvent()
系统函数parentWidget(), window(), setParent(), winId(), find(), metric().
提示setToolTip(), setWhatsThis()
slots
bool    close()
void    hide()
void    lower()
void    raise()
void    repaint()
void    setDisabled(bool disable)
void    setEnabled(bool)
void    setFocus()
void    setHidden(bool hidden)
void    setStyleSheet(const QString &styleSheet)
virtual void    setVisible(bool visible)
void    setWindowModified(bool)
void    setWindowTitle(const QString &)
void    show()
void    showFullScreen()
void    showMaximized()
void    showMinimized()
void    showNormal()
void    update()
protect function大部分可重写virtual
virtual void    actionEvent(QActionEvent *event)
virtual void    changeEvent(QEvent *event)
virtual void    closeEvent(QCloseEvent *event)
virtual void    contextMenuEvent(QContextMenuEvent *event)
void    create(WId window = 0, 
void    destroy(bool destroyWindow = true, bool destroySubWindows = true)
virtual void    dragEnterEvent(QDragEnterEvent *event)
virtual void    dragLeaveEvent(QDragLeaveEvent *event)
virtual void    dragMoveEvent(QDragMoveEvent *event)
virtual void    dropEvent(QDropEvent *event)
virtual void    enterEvent(QEvent *event)
virtual void    focusInEvent(QFocusEvent *event)
virtual bool    focusNextPrevChild(bool next)
virtual void    focusOutEvent(QFocusEvent *event)
bool    focusPreviousChild()
virtual void    hideEvent(QHideEvent *event)
virtual void    inputMethodEvent(QInputMethodEvent *event)
virtual void    keyPressEvent(QKeyEvent *event)
virtual void    keyReleaseEvent(QKeyEvent *event)
virtual void    leaveEvent(QEvent *event)
virtual void    mouseDoubleClickEvent(QMouseEvent *event)
virtual void    mouseMoveEvent(QMouseEvent *event)
virtual void    mousePressEvent(QMouseEvent *event)
virtual void    mouseReleaseEvent(QMouseEvent *event)
virtual void    moveEvent(QMoveEvent *event)
virtual bool    nativeEvent(const QByteArray &eventType, void *message, long *result)
virtual void    paintEvent(QPaintEvent *event)
virtual void    resizeEvent(QResizeEvent *event)
virtual void    showEvent(QShowEvent *event)
virtual void    tabletEvent(QTabletEvent *event)
virtual void    wheelEvent(QWheelEvent *event)
QDialog

对话窗口的基类
Header: #include
qmake: QT += widgets

public Types
enum    DialogCode { Accepted, Rejected }
Public Functions
QDialog(QWidget *parent = nullptr, Qt::WindowFlags f = ...)
virtual ~QDialog()
bool    isSizeGripEnabled() const
int result() const
void    setModal(bool modal)
void    setResult(int i)
void    setSizeGripEnabled(bool)
Public Slots
virtual void    accept()
virtual void    done(int r)
virtual int exec()
virtual void    open()
virtual void    reject()
Signals
void    accepted()
void    finished(int result)
void    rejected()
QWindow

Header: #include
qmake: QT += gui

转载于:https://www.cnblogs.com/zylg/p/9831884.html

最后

以上就是笨笨黄蜂为你收集整理的qt界面基类的全部内容,希望文章能够帮你解决qt界面基类所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(36)

评论列表共有 0 条评论

立即
投稿
返回
顶部