Qt界面无边框拖拽及拉伸

  • Post author:
  • Post category:其他


无边框拖拽及拉伸

由setWindowFlags(Qt::FramelessWindowHint)的无边框界面可以通过native接受windows消息处理。点击子界面支持拖拽必须有*result = HTCAPTION;

bool Test20210311::nativeEvent(const QByteArray &eventType, void *message, long *result)
{
   
    MSG* msg = (MSG*)message;
    switch(msg->message)
    {
   
    case WM_NCHITTEST:
        int xPos = GET_X_LPARAM(msg->lParam) - this->frameGeometry().x();
        int yPos = GET_Y_LPARAM(msg->lParam) - this->frameGeometry().y();

        int border = 5;
        if(xPos > 0 



版权声明:本文为FengOLei原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。