zoukankan      html  css  js  c++  java
  • Qt 实现在隐藏标题栏情况下,窗口的缩放(未成功)

    呃,这是一个悲剧的版本,在这版本中,我按照网上大神的说法,试了一下,但是没有效果,不知道出错在了那里,和昨天一样,也是,没有理想的效果,这里贴上代码,记录一下

    资料连接:放评论

    需要包含头文件

    #include <windows.h>

    代码

    bool Widget::nativeEvent(const QByteArray &eventType, void *message, long *result)
    {
        Q_UNUSED(eventType);
        if (this->isMaximized())
        {
            return false;
        }
    
        const int HIT_BORDER = 5;
        const MSG *msg=static_cast<MSG*>(message);
        if(msg->message == WM_NCHITTEST) {
            int xPos = ((int)(short)LOWORD(msg->lParam)) - this->frameGeometry().x();
            int yPos = ((int)(short)HIWORD(msg->lParam)) - this->frameGeometry().y();
            if(this->childAt(xPos,yPos) == 0) {
                *result = HTCAPTION;
            } else {
                return false;
            }
            if(xPos > 0 && xPos < HIT_BORDER) {
                *result = HTLEFT;
            }
            if(xPos > (this->width() - HIT_BORDER) && xPos < (this->width() - 0)) {
                *result = HTRIGHT;
            }
            if(yPos > 0 && yPos < HIT_BORDER) {
                *result = HTTOP;
            }
            if(yPos > (this->height() - HIT_BORDER) && yPos < (this->height() - 0)) {
                *result = HTBOTTOM;
            }
            if(xPos > 0 && xPos < HIT_BORDER && yPos > 0 && yPos < HIT_BORDER) {
                *result = HTTOPLEFT;
            }
            if(xPos > (this->width() - HIT_BORDER) && xPos < (this->width() - 0) && yPos > 0 && yPos < HIT_BORDER) {
                *result = HTTOPRIGHT;
            }
            if(xPos > 0 && xPos < HIT_BORDER && yPos > (this->height() - HIT_BORDER) && yPos < (this->height() - 0)) {
                *result = HTBOTTOMLEFT;
            }
            if(xPos > (this->width() - HIT_BORDER) && xPos < (this->width() - 0) && yPos > (this->height() - HIT_BORDER) && yPos < (this->height() - 0)) {
                *result = HTBOTTOMRIGHT;
            }
            return true;
        }
        return false;
    
    }



  • 相关阅读:
    史上最强内网渗透知识点总结
    最全的网站渗透测试详细检测方法
    java代码审计
    信息收集
    Java Web安全之代码审计
    Bell-Lapadula和Biba的改进安全模型与应用
    浅谈Forrester零信任架构评估的7个技术维度
    CMD命令混淆高级对抗
    一篇文章带你领悟Frida的精髓(基于安卓8.1)
    svg作图
  • 原文地址:https://www.cnblogs.com/DreamDog/p/9160061.html
Copyright © 2011-2022 走看看