本文整理汇总了C++中QWindow::flags方法的典型用法代码示例。如果您正苦于以下问题:C++ QWindow::flags方法的具体用法?C++ QWindow::flags怎么用?C++ QWindow::flags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWindow
的用法示例。
在下文中一共展示了QWindow::flags方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FullScreenVideoWindow
PlatformVideoWindow::PlatformVideoWindow()
{
QWindow* win = new FullScreenVideoWindow();
m_window = win;
win->setFlags(win->flags() | Qt::FramelessWindowHint);
m_videoWindowId = win->winId();
}
示例2: postEvent
void QMirClientInput::postEvent(QMirClientWindow *platformWindow, const MirEvent *event)
{
QWindow *window = platformWindow->window();
QCoreApplication::postEvent(this, new UbuntuEvent(
platformWindow, event, mEventType));
if ((window->flags().testFlag(Qt::WindowTransparentForInput)) && window->parent()) {
QCoreApplication::postEvent(this, new UbuntuEvent(
static_cast<QMirClientWindow*>(platformWindow->QPlatformWindow::parent()),
event, mEventType));
}
}
示例3: translateMouseEvent
bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
QtWindows::WindowsEventType et,
MSG msg, LRESULT *result)
{
#ifdef Q_COMPILER_CLASS_ENUM
enum : quint64 { signatureMask = 0xffffff00, miWpSignature = 0xff515700 };
#else
static const quint64 signatureMask = 0xffffff00;
static const quint64 miWpSignature = 0xff515700;
#endif // !Q_COMPILER_CLASS_ENUM
if (et == QtWindows::MouseWheelEvent)
return translateMouseWheelEvent(window, hwnd, msg, result);
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized;
// Check for events synthesized from touch. Lower byte is touch index, 0 means pen.
static const bool passSynthesizedMouseEvents =
!(QWindowsIntegration::instance()->options() & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch);
// Check for events synthesized from touch. Lower 7 bits are touch/pen index, bit 8 indicates touch.
// However, when tablet support is active, extraInfo is a packet serial number. This is not a problem
// since we do not want to ignore mouse events coming from a tablet.
// See https://msdn.microsoft.com/en-us/library/windows/desktop/ms703320.aspx
const quint64 extraInfo = quint64(GetMessageExtraInfo());
if ((extraInfo & signatureMask) == miWpSignature) {
if (extraInfo & 0x80) { // Bit 7 indicates touch event, else tablet pen.
source = Qt::MouseEventSynthesizedBySystem;
if (!passSynthesizedMouseEvents)
return false;
}
}
const QPoint winEventPosition(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam));
if (et & QtWindows::NonClientEventFlag) {
const QPoint globalPosition = winEventPosition;
const QPoint clientPosition = QWindowsGeometryHint::mapFromGlobal(hwnd, globalPosition);
const Qt::MouseButtons buttons = QWindowsMouseHandler::queryMouseButtons();
QWindowSystemInterface::handleFrameStrutMouseEvent(window, clientPosition,
globalPosition, buttons,
QWindowsKeyMapper::queryKeyboardModifiers(),
source);
return false; // Allow further event processing (dragging of windows).
}
*result = 0;
if (msg.message == WM_MOUSELEAVE) {
qCDebug(lcQpaEvents) << "WM_MOUSELEAVE for " << window << " previous window under mouse = " << m_windowUnderMouse << " tracked window =" << m_trackedWindow;
// When moving out of a window, WM_MOUSEMOVE within the moved-to window is received first,
// so if m_trackedWindow is not the window here, it means the cursor has left the
// application.
if (window == m_trackedWindow) {
QWindow *leaveTarget = m_windowUnderMouse ? m_windowUnderMouse : m_trackedWindow;
qCDebug(lcQpaEvents) << "Generating leave event for " << leaveTarget;
QWindowSystemInterface::handleLeaveEvent(leaveTarget);
m_trackedWindow = 0;
m_windowUnderMouse = 0;
}
return true;
}
QWindowsWindow *platformWindow = static_cast<QWindowsWindow *>(window->handle());
const Qt::MouseButtons buttons = keyStateToMouseButtons(int(msg.wParam));
// If the window was recently resized via mouse doubleclick on the frame or title bar,
// we don't get WM_LBUTTONDOWN or WM_LBUTTONDBLCLK for the second click,
// but we will get at least one WM_MOUSEMOVE with left button down and the WM_LBUTTONUP,
// which will result undesired mouse press and release events.
// To avoid those, we ignore any events with left button down if we didn't
// get the original WM_LBUTTONDOWN/WM_LBUTTONDBLCLK.
if (msg.message == WM_LBUTTONDOWN || msg.message == WM_LBUTTONDBLCLK) {
m_leftButtonDown = true;
} else {
const bool actualLeftDown = buttons & Qt::LeftButton;
if (!m_leftButtonDown && actualLeftDown) {
// Autocapture the mouse for current window to and ignore further events until release.
// Capture is necessary so we don't get WM_MOUSELEAVEs to confuse matters.
// This autocapture is released normally when button is released.
if (!platformWindow->hasMouseCapture()) {
platformWindow->applyCursor();
platformWindow->setMouseGrabEnabled(true);
platformWindow->setFlag(QWindowsWindow::AutoMouseCapture);
qCDebug(lcQpaEvents) << "Automatic mouse capture for missing buttondown event" << window;
}
m_previousCaptureWindow = window;
return true;
} else if (m_leftButtonDown && !actualLeftDown) {
m_leftButtonDown = false;
}
}
const QPoint globalPosition = QWindowsGeometryHint::mapToGlobal(hwnd, winEventPosition);
// In this context, neither an invisible nor a transparent window (transparent regarding mouse
// events, "click-through") can be considered as the window under mouse.
QWindow *currentWindowUnderMouse = platformWindow->hasMouseCapture() ?
QWindowsScreen::windowAt(globalPosition, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT) : window;
while (currentWindowUnderMouse && currentWindowUnderMouse->flags() & Qt::WindowTransparentForInput)
currentWindowUnderMouse = currentWindowUnderMouse->parent();
// QTBUG-44332: When Qt is running at low integrity level and
// a Qt Window is parented on a Window of a higher integrity process
//.........这里部分代码省略.........
示例4: create_sys
void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow)
{
Q_Q(QWidget);
Q_UNUSED(window);
Q_UNUSED(initializeWindow);
Q_UNUSED(destroyOldWindow);
Qt::WindowFlags flags = data.window_flags;
if (!q->testAttribute(Qt::WA_NativeWindow) && !q->isWindow())
return; // we only care about real toplevels
QWindow *win = topData()->window;
// topData() ensures the extra is created but does not ensure 'window' is non-null
// in case the extra was already valid.
if (!win) {
createTLSysExtra();
win = topData()->window;
}
win->setFlags(data.window_flags);
fixPosIncludesFrame();
if (q->testAttribute(Qt::WA_Moved))
win->setGeometry(q->geometry());
else
win->resize(q->size());
win->setScreen(QGuiApplication::screens().value(topData()->screenIndex, 0));
if (q->testAttribute(Qt::WA_TranslucentBackground)) {
QSurfaceFormat format;
format.setAlphaBufferSize(8);
win->setFormat(format);
}
if (QWidget *nativeParent = q->nativeParentWidget()) {
if (nativeParent->windowHandle()) {
if (flags & Qt::Window) {
win->setTransientParent(nativeParent->windowHandle());
win->setParent(0);
} else {
win->setTransientParent(0);
win->setParent(nativeParent->windowHandle());
}
}
}
qt_window_private(win)->positionPolicy = topData()->posIncludesFrame ?
QWindowPrivate::WindowFrameInclusive : QWindowPrivate::WindowFrameExclusive;
win->create();
// Enable nonclient-area events for QDockWidget and other NonClientArea-mouse event processing.
if ((flags & Qt::Desktop) == Qt::Window)
win->handle()->setFrameStrutEventsEnabled(true);
data.window_flags = win->flags();
QBackingStore *store = q->backingStore();
if (!store) {
if (win && q->windowType() != Qt::Desktop)
q->setBackingStore(new QBackingStore(win));
else
q->setAttribute(Qt::WA_PaintOnScreen, true);
}
setWindowModified_helper();
setWinId(win->winId());
// Check children and create windows for them if necessary
q_createNativeChildrenAndSetParent(q);
if (extra && !extra->mask.isEmpty())
setMask_sys(extra->mask);
// If widget is already shown, set window visible, too
if (q->isVisible())
win->setVisible(true);
}