no message
parent
44177aa13c
commit
311096b8ae
2
Qss.cpp
2
Qss.cpp
|
@ -271,7 +271,7 @@ QssMainWindow::QssMainWindow(QWidget *parent/* = 0*/, Qt::WindowFlags flags/* =
|
|||
installEventFilter(this);
|
||||
|
||||
mFrameRect = m_frame->geometry();
|
||||
m_rcNormal = this->parentWidget()->geometry();
|
||||
m_rcNormal = m_frame->geometry();
|
||||
m_rcNormalCentral = this->geometry();
|
||||
connect(this->titleBar(),SIGNAL( OnMaxOrRestore(bool )),this,SLOT(OnMaxOrRestore(bool)));
|
||||
|
||||
|
|
23
Qss.h
23
Qss.h
|
@ -11,10 +11,13 @@
|
|||
#include <QPushButton>
|
||||
#include <QAbstractNativeEventFilter>
|
||||
#include <QDebug>
|
||||
|
||||
#include "ui_qsstoast.h"
|
||||
#ifdef __MINGW32__
|
||||
#include "windows.h"
|
||||
#include "winuser.h"
|
||||
#include "ui_qsstoast.h"
|
||||
|
||||
#pragma comment(lib, "libuser32.a")
|
||||
#endif
|
||||
|
||||
class QPushButton;
|
||||
class QLabel;
|
||||
|
@ -37,6 +40,8 @@ typedef enum{
|
|||
}ReiszeActions ;
|
||||
|
||||
|
||||
|
||||
|
||||
#define DECLARE_RESIZE() \
|
||||
void resize(int w, int h);void resize(const QSize &); void setFixedHeight(int w); \
|
||||
void setFixedWidth(int w);void setFixedSize(int w, int h);void setFixedSize(const QSize &s); \
|
||||
|
@ -45,12 +50,13 @@ typedef enum{
|
|||
void setMaximumSize(const QSize &);void setMaximumSize(int maxw, int maxh); \
|
||||
void setMaximumHeight(int minh);void setMaximumWidth(int minw);
|
||||
|
||||
// 用宏强制覆盖的方法不使用了,因为QSSMainWindow本身已经在event事件内做处理,每个event都重写了,无需再去覆盖。
|
||||
#define DEFINE_RESIZE(name)\
|
||||
void Qss##name::resize(int w, int h){ m_sizeActions |= RA_Resize; float scale = cale; m_size = QSize(w, h);Q##name::resize(m_size.width() * scale, m_size.height() * scale);}\
|
||||
void Qss##name::resize(const QSize & size){ m_sizeActions |= RA_Resize; float scale = cale;m_size = size;Q##name::resize(m_size * scale);}\
|
||||
void Qss##name::setFixedHeight(int h){m_sizeActions |= RA_FixedHeight;float scale = cale;m_size.setHeight(h);Q##name::setFixedHeight(m_size.height() * scale);}\
|
||||
void Qss##name::setFixedWidth(int w){m_sizeActions |= RA_FixedWidth;float scale = cale;m_size.setWidth(w);Q##name::setFixedWidth(m_size.width() * scale);}\
|
||||
void Qss##name::setFixedSize(int w, int h){m_sizeActions |= RA_FixedSize;float scale = cale; m_size = QSize(w, h); Q##name::setFixedSize(m_size.width() * scale, m_size.height() * scale);}\
|
||||
void Qss##name::setFixedSize(int w, int h){m_sizeActions |= RA_FixedSize;float scale = cale; m_size = QSize(w, h); this->m_frame->setFixedSize(m_size.width() * scale, m_size.height() * scale) ; }\
|
||||
void Qss##name::setFixedSize(const QSize & size){m_sizeActions |= RA_FixedSize;float scale = cale; m_size = size; Q##name::setFixedSize(m_size * scale);}\
|
||||
void Qss##name::setMinimumSize(const QSize & size){m_sizeActions |= RA_MinimumSize;float scale = cale;m_minimumSize = size; Q##name::setMinimumSize(m_minimumSize * scale);}\
|
||||
void Qss##name::setMinimumSize(int w, int h){m_sizeActions |= RA_MinimumSize;float scale = cale; m_minimumSize = QSize(w, h); Q##name::setMinimumSize(m_minimumSize.width() * scale, m_minimumSize.height() * scale);}\
|
||||
|
@ -183,22 +189,17 @@ public:
|
|||
virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE
|
||||
{
|
||||
MSG* pMsg = reinterpret_cast<MSG*>(message);
|
||||
if(nullptr != pMsg){
|
||||
switch (pMsg->message)
|
||||
{
|
||||
case WM_DPICHANGED:
|
||||
{
|
||||
qDebug()<<"DPI CHANGED";
|
||||
/*DWORD dpi = LOWORD(pMsg->wParam);
|
||||
//WId id = WINDOW_WINID;
|
||||
//if (DPIHelper()->DPIChanged(dpi, id))
|
||||
{
|
||||
ScaleChanged(DPIHelper()->GetDPIScale(id));
|
||||
RefrushSheet(this, id);
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: filter out or modify msg struct here
|
||||
// ...
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue