Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwizard_win.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <QtWidgets/private/qtwidgetsglobal_p.h>
5
6#if QT_CONFIG(style_windowsvista)
7
8#include "qwizard_win_p.h"
9#include <private/qapplication_p.h>
10#include <private/qwindowsfontdatabasebase_p.h>
11#include <qpa/qplatformwindow.h>
12#include <qpa/qplatformwindow_p.h>
13#include "qwizard.h"
14#include "qpaintengine.h"
15#include "qapplication.h"
16#include <QtCore/QOperatingSystemVersion>
17#include <QtCore/QVariant>
18#include <QtCore/QDebug>
19#include <QtGui/QMouseEvent>
20#include <QtGui/QWindow>
21#include <QtGui/private/qhighdpiscaling_p.h>
22
23#include <uxtheme.h>
24#include <vssym32.h>
25#include <dwmapi.h>
26
27// ### move to qmargins.h
29
30#ifndef WM_DWMCOMPOSITIONCHANGED
31# define WM_DWMCOMPOSITIONCHANGED 0x031E
32#endif
33
35
36qreal QVistaHelper::m_devicePixelRatio = 1.0;
37
38/******************************************************************************
39** QVistaBackButton
40*/
41
42QVistaBackButton::QVistaBackButton(QWidget *widget)
44{
45 setFocusPolicy(Qt::NoFocus);
46 // Native dialogs use ALT-Left even in RTL mode, so do the same, even if it might be counter-intuitive.
47#if QT_CONFIG(shortcut)
49#endif
50}
51
52QSize QVistaBackButton::sizeHint() const
53{
54 ensurePolished();
55 int size = int(QStyleHelper::dpiScaled(32, this));
56 int width = size, height = size;
57 return QSize(width, height);
58}
59
60void QVistaBackButton::enterEvent(QEnterEvent *event)
61{
62 if (isEnabled())
63 update();
65}
66
67void QVistaBackButton::leaveEvent(QEvent *event)
68{
69 if (isEnabled())
70 update();
72}
73
74void QVistaBackButton::paintEvent(QPaintEvent *)
75{
76 QPainter p(this);
77 QRect r = rect();
78 const HANDLE theme = OpenThemeData(0, L"Navigation");
79 //RECT rect;
80 QPoint origin;
81 const HDC hdc = QVistaHelper::backingStoreDC(parentWidget(), &origin);
82 RECT clipRect;
83 int xoffset = origin.x() + QWidget::mapToParent(r.topLeft()).x() - 1;
84 int yoffset = origin.y() + QWidget::mapToParent(r.topLeft()).y() - 1;
85 const qreal dpr = devicePixelRatio();
86 const QRect rDp = QRect(r.topLeft() * dpr, r.size() * dpr);
87 const int xoffsetDp = xoffset * dpr;
88 const int yoffsetDp = yoffset * dpr;
89
90 clipRect.top = rDp.top() + yoffsetDp;
91 clipRect.bottom = rDp.bottom() + yoffsetDp;
92 clipRect.left = rDp.left() + xoffsetDp;
93 clipRect.right = rDp.right() + xoffsetDp;
94
95 int state = NAV_BB_NORMAL;
96 if (!isEnabled())
97 state = NAV_BB_DISABLED;
98 else if (isDown())
99 state = NAV_BB_PRESSED;
100 else if (underMouse())
101 state = NAV_BB_HOT;
102
103 DrawThemeBackground(theme, hdc,
104 layoutDirection() == Qt::LeftToRight ? NAV_BACKBUTTON : NAV_FORWARDBUTTON,
105 state, &clipRect, &clipRect);
106}
107
108/******************************************************************************
109** QVistaHelper
110*/
111
112QVistaHelper::QVistaHelper(QWizard *wizard)
113 : QObject(wizard)
114 , pressed(false)
115 , wizard(wizard)
116 , backButton_(0)
117{
118 QVistaHelper::m_devicePixelRatio = wizard->devicePixelRatio();
119
120 backButton_ = new QVistaBackButton(wizard);
121 backButton_->hide();
122
123 iconSpacing = QStyleHelper::dpiScaled(7, wizard);
124}
125
126QVistaHelper::~QVistaHelper() = default;
127
128void QVistaHelper::updateCustomMargins(bool vistaMargins)
129{
130 using namespace QNativeInterface::Private;
131
132 if (QWindow *window = wizard->windowHandle()) {
133 // Reduce top frame to zero since we paint it ourselves. Use
134 // device pixel to avoid rounding errors.
135 const QMargins customMarginsDp = vistaMargins
136 ? QMargins(0, -titleBarSizeDp(), 0, 0)
137 : QMargins();
138 const QVariant customMarginsV = QVariant::fromValue(customMarginsDp);
139 // The dynamic property takes effect when creating the platform window.
140 window->setProperty("_q_windowsCustomMargins", customMarginsV);
141 // If a platform window exists, change via native interface.
142 if (auto platformWindow = dynamic_cast<QWindowsWindow *>(window->handle()))
143 platformWindow->setCustomMargins(customMarginsDp);
144 }
145}
146
147void QVistaHelper::disconnectBackButton()
148{
149 if (backButton_) // Leave QStyleSheetStyle's connections on destroyed() intact.
150 backButton_->disconnect(SIGNAL(clicked()));
151}
152
153QColor QVistaHelper::basicWindowFrameColor()
154{
155 DWORD rgb;
156 const HANDLE hTheme = OpenThemeData(GetDesktopWindow(), L"WINDOW");
157 GetThemeColor(hTheme, WP_CAPTION, CS_ACTIVE,
158 wizard->isActiveWindow() ? TMT_FILLCOLORHINT : TMT_BORDERCOLORHINT, &rgb);
159 BYTE r = GetRValue(rgb);
160 BYTE g = GetGValue(rgb);
161 BYTE b = GetBValue(rgb);
162 return QColor(r, g, b);
163}
164
165bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type)
166{
167 MARGINS mar = {0, 0, 0, 0};
168 if (type == NormalTitleBar)
169 mar.cyTopHeight = 0;
170 else
171 mar.cyTopHeight = (titleBarSize() + topOffset(wizard)) * QVistaHelper::m_devicePixelRatio;
172 if (const HWND wizardHandle = wizardHWND()) {
173 if (SUCCEEDED(DwmExtendFrameIntoClientArea(wizardHandle, &mar)))
174 return true;
175 }
176 return false;
177}
178
179Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &);
180
181static LOGFONT getCaptionLogFont(HANDLE hTheme)
182{
183 LOGFONT result = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { 0 } };
184
185 if (!hTheme || FAILED(GetThemeSysFont(hTheme, TMT_CAPTIONFONT, &result))) {
186 NONCLIENTMETRICS ncm;
187 ncm.cbSize = sizeof(NONCLIENTMETRICS);
188 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, false);
189 result = ncm.lfMessageFont;
190 }
191 return result;
192}
193
194static bool getCaptionQFont(int dpi, QFont *result)
195{
196 const HANDLE hTheme = OpenThemeData(GetDesktopWindow(), L"WINDOW");
197 if (!hTheme)
198 return false;
199 // Call into QWindowsNativeInterface to convert the LOGFONT into a QFont.
200 const LOGFONT logFont = getCaptionLogFont(hTheme);
202 return true;
203}
204
205void QVistaHelper::drawTitleBar(QPainter *painter)
206{
207 Q_ASSERT(backButton_);
208 QPoint origin;
209 const bool isWindow = wizard->isWindow();
210 const HDC hdc = QVistaHelper::backingStoreDC(wizard, &origin);
211
212 if (isWindow)
213 drawBlackRect(QRect(0, 0, wizard->width(),
214 titleBarSize() + topOffset(wizard)), hdc);
215 // The button is positioned in QWizardPrivate::handleAeroStyleChange(),
216 // all calculation is relative to it.
217 const int btnTop = backButton_->mapToParent(QPoint()).y();
218 const int btnHeight = backButton_->size().height();
219 const int verticalCenter = (btnTop + btnHeight / 2) - 1;
220
221 const QString text = wizard->window()->windowTitle();
222 QFont font;
223 if (!isWindow || !getCaptionQFont(wizard->logicalDpiY() * wizard->devicePixelRatio(), &font))
224 font = QApplication::font("QMdiSubWindowTitleBar");
226 const QRect brect = fontMetrics.boundingRect(text);
227 const int glowOffset = glowSize(wizard);
228 int textHeight = brect.height() + 2 * glowOffset;
229 int textWidth = brect.width() + 2 * glowOffset;
230
231 const int titleLeft = (wizard->layoutDirection() == Qt::LeftToRight
232 ? titleOffset() - glowOffset
233 : wizard->width() - titleOffset() - textWidth + glowOffset);
234
235 const QRect textRectangle(titleLeft, verticalCenter - textHeight / 2, textWidth, textHeight);
236 if (isWindow) {
237 drawTitleText(painter, text, textRectangle, hdc);
238 } else {
239 painter->save();
242 painter->restore();
243 }
244
245 const QIcon windowIcon = wizard->windowIcon();
246 if (!windowIcon.isNull()) {
247 const int size = QVistaHelper::iconSize(wizard);
248 const int iconLeft = (wizard->layoutDirection() == Qt::LeftToRight
249 ? leftMargin(wizard)
250 : wizard->width() - leftMargin(wizard) - size);
251
252 const QPoint pos(origin.x() + iconLeft, origin.y() + verticalCenter - size / 2);
253 const QPoint posDp = pos * QVistaHelper::m_devicePixelRatio;
254 const HICON hIcon = qt_pixmapToWinHICON(windowIcon.pixmap(size * QVistaHelper::m_devicePixelRatio));
255 DrawIconEx(hdc, posDp.x(), posDp.y(), hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT);
256 DestroyIcon(hIcon);
257 }
258}
259
260void QVistaHelper::setTitleBarIconAndCaptionVisible(bool visible)
261{
262 WTA_OPTIONS opt;
263 opt.dwFlags = WTNCA_NODRAWICON | WTNCA_NODRAWCAPTION;
264 if (visible)
265 opt.dwMask = 0;
266 else
267 opt.dwMask = WTNCA_NODRAWICON | WTNCA_NODRAWCAPTION;
268 if (const HWND handle = wizardHWND())
269 SetWindowThemeAttribute(handle, WTA_NONCLIENT, &opt, sizeof(WTA_OPTIONS));
270}
271
272bool QVistaHelper::winEvent(MSG* msg, qintptr *result)
273{
274 switch (msg->message) {
275 case WM_NCHITTEST: {
276 LRESULT lResult;
277 // Perform hit testing using DWM
278 if (DwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult)) {
279 // DWM returned a hit, no further processing necessary
280 *result = lResult;
281 } else {
282 // DWM didn't return a hit, process using DefWindowProc
283 lResult = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam);
284 // If DefWindowProc returns a window caption button, just return HTCLIENT (client area).
285 // This avoid unnecessary hits to Windows NT style caption buttons which aren't visible but are
286 // located just under the Aero style window close button.
287 if (lResult == HTCLOSE || lResult == HTMAXBUTTON || lResult == HTMINBUTTON || lResult == HTHELP)
288 *result = HTCLIENT;
289 else
290 *result = lResult;
291 }
292 break;
293 }
294 default:
295 LRESULT lResult;
296 // Pass to DWM to handle
297 if (DwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult))
298 *result = lResult;
299 // If the message wasn't handled by DWM, continue processing it as normal
300 else
301 return false;
302 }
303
304 return true;
305}
306
307void QVistaHelper::setMouseCursor(QPoint pos)
308{
309#ifndef QT_NO_CURSOR
310 if (rtTop.contains(pos))
312 else
313 wizard->setCursor(Qt::ArrowCursor);
314#endif
315}
316
317void QVistaHelper::mouseEvent(QEvent *event)
318{
319 switch (event->type()) {
321 mouseMoveEvent(static_cast<QMouseEvent *>(event));
322 break;
324 mousePressEvent(static_cast<QMouseEvent *>(event));
325 break;
327 mouseReleaseEvent(static_cast<QMouseEvent *>(event));
328 break;
329 default:
330 break;
331 }
332}
333
334bool QVistaHelper::handleWinEvent(MSG *message, qintptr *result)
335{
336 bool status = false;
337 if (wizard->wizardStyle() == QWizard::AeroStyle) {
338 status = winEvent(message, result);
339 if (message->message == WM_NCPAINT)
340 wizard->update();
341 }
342 return status;
343}
344
345void QVistaHelper::resizeEvent(QResizeEvent * event)
346{
348 rtTop = QRect (0, 0, wizard->width(), frameSize());
349 int height = captionSize() + topOffset(wizard);
350 rtTitle = QRect (0, frameSize(), wizard->width(), height);
351}
352
353void QVistaHelper::paintEvent(QPaintEvent *event)
354{
356 QPainter painter(wizard);
357 drawTitleBar(&painter);
358}
359
360void QVistaHelper::mouseMoveEvent(QMouseEvent *event)
361{
362 if (wizard->windowState() & Qt::WindowMaximized) {
363 event->ignore();
364 return;
365 }
366
367 QRect rect = wizard->geometry();
368 if (pressed) {
369 switch (change) {
370 case resizeTop:
371 {
372 const int dy = event->pos().y() - pressedPos.y();
373 if ((dy > 0 && rect.height() > wizard->minimumHeight())
374 || (dy < 0 && rect.height() < wizard->maximumHeight()))
375 rect.setTop(rect.top() + dy);
376 }
377 break;
378 case movePosition: {
379 QPoint newPos = event->pos() - pressedPos;
380 rect.moveLeft(rect.left() + newPos.x());
381 rect.moveTop(rect.top() + newPos.y());
382 break; }
383 default:
384 break;
385 }
386 wizard->setGeometry(rect);
387
388 } else {
389 setMouseCursor(event->pos());
390 }
391 event->ignore();
392}
393
394void QVistaHelper::mousePressEvent(QMouseEvent *event)
395{
396 change = noChange;
397
398 if (event->button() != Qt::LeftButton || wizard->windowState() & Qt::WindowMaximized) {
399 event->ignore();
400 return;
401 }
402
403 if (rtTitle.contains(event->pos())) {
404 change = movePosition;
405 } else if (rtTop.contains(event->pos()))
406 change = resizeTop;
407
408 if (change != noChange) {
409 setMouseCursor(event->pos());
410 pressed = true;
411 pressedPos = event->pos();
412 } else {
413 event->ignore();
414 }
415}
416
417void QVistaHelper::mouseReleaseEvent(QMouseEvent *event)
418{
419 change = noChange;
420 if (pressed) {
421 pressed = false;
422 wizard->releaseMouse();
423 setMouseCursor(event->pos());
424 }
425 event->ignore();
426}
427
428static inline LPARAM pointToLParam(const QPointF &p, const QWidget *w)
429{
430 const auto point = QHighDpi::toNativePixels(p, w->screen()).toPoint();
431 return MAKELPARAM(point.x(), point.y());
432}
433
434bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
435{
436 if (obj != wizard)
438
439 if (event->type() == QEvent::MouseMove) {
440 QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
442 MSG msg;
443 msg.message = WM_NCHITTEST;
444 msg.wParam = 0;
445 msg.lParam = pointToLParam(mouseEvent->globalPosition(), wizard);
446 msg.hwnd = wizardHWND();
447 winEvent(&msg, &result);
448 msg.wParam = result;
449 msg.message = WM_NCMOUSEMOVE;
450 winEvent(&msg, &result);
451 } else if (event->type() == QEvent::MouseButtonPress) {
452 QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
453
454 if (mouseEvent->button() == Qt::LeftButton) {
456 MSG msg;
457 msg.message = WM_NCHITTEST;
458 msg.wParam = 0;
459 msg.lParam = pointToLParam(mouseEvent->globalPosition(), wizard);
460 msg.hwnd = wizardHWND();
461 winEvent(&msg, &result);
462 msg.wParam = result;
463 msg.message = WM_NCLBUTTONDOWN;
464 winEvent(&msg, &result);
465 }
466 } else if (event->type() == QEvent::MouseButtonRelease) {
467 QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
468
469 if (mouseEvent->button() == Qt::LeftButton) {
471 MSG msg;
472 msg.message = WM_NCHITTEST;
473 msg.wParam = 0;
474 msg.lParam = pointToLParam(mouseEvent->globalPosition(), wizard);
475 msg.hwnd = wizardHWND();
476 winEvent(&msg, &result);
477 msg.wParam = result;
478 msg.message = WM_NCLBUTTONUP;
479 winEvent(&msg, &result);
480 }
481 }
482
483 return false;
484}
485
486// Return a HDC for the wizard along with the transformation if the
487// wizard is a child window.
488HDC QVistaHelper::backingStoreDC(const QWidget *wizard, QPoint *offset)
489{
490 HDC hdc = static_cast<HDC>(QGuiApplication::platformNativeInterface()->nativeResourceForBackingStore(QByteArrayLiteral("getDC"), wizard->backingStore()));
491 *offset = QPoint(0, 0);
492 if (!wizard->windowHandle())
493 if (QWidget *nativeParent = wizard->nativeParentWidget())
494 *offset = wizard->mapTo(nativeParent, *offset);
495 return hdc;
496}
497
498HWND QVistaHelper::wizardHWND() const
499{
500 // Obtain the HWND if the wizard is a top-level window.
501 // Do not use winId() as this enforces native children of the parent
502 // widget when called before show() as happens when calling setWizardStyle().
503 if (QWindow *window = wizard->windowHandle())
504 if (window->handle())
505 if (void *vHwnd = QGuiApplication::platformNativeInterface()->nativeResourceForWindow(QByteArrayLiteral("handle"), window))
506 return static_cast<HWND>(vHwnd);
507 qWarning().nospace() << "Failed to obtain HWND for wizard.";
508 return 0;
509}
510
511void QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc)
512{
514
515 const QRect rectDp = QRect(rect.topLeft() * QVistaHelper::m_devicePixelRatio,
516 rect.size() * QVistaHelper::m_devicePixelRatio);
517 const HANDLE hTheme = OpenThemeData(GetDesktopWindow(), L"WINDOW");
518 if (!hTheme)
519 return;
520 // Set up a memory DC and bitmap that we'll draw into
521 HDC dcMem;
522 HBITMAP bmp;
523 BITMAPINFO dib;
524 ZeroMemory(&dib, sizeof(dib));
525 dcMem = CreateCompatibleDC(hdc);
526
527 dib.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
528 dib.bmiHeader.biWidth = rectDp.width();
529 dib.bmiHeader.biHeight = -rectDp.height();
530 dib.bmiHeader.biPlanes = 1;
531 dib.bmiHeader.biBitCount = 32;
532 dib.bmiHeader.biCompression = BI_RGB;
533
534 bmp = CreateDIBSection(hdc, &dib, DIB_RGB_COLORS, NULL, NULL, 0);
535
536 // Set up the DC
537 const LOGFONT captionLogFont = getCaptionLogFont(hTheme);
538 const HFONT hCaptionFont = CreateFontIndirect(&captionLogFont);
539 auto hOldBmp = reinterpret_cast<HBITMAP>(SelectObject(dcMem, (HGDIOBJ) bmp));
540 auto hOldFont = reinterpret_cast<HFONT>(SelectObject(dcMem, (HGDIOBJ) hCaptionFont));
541
542 // Draw the text!
543 DTTOPTS dto;
544 memset(&dto, 0, sizeof(dto));
545 dto.dwSize = sizeof(dto);
546 const UINT uFormat = DT_SINGLELINE|DT_CENTER|DT_VCENTER|DT_NOPREFIX;
547 RECT rctext ={0,0, rectDp.width(), rectDp.height()};
548
549 dto.dwFlags = DTT_COMPOSITED|DTT_GLOWSIZE;
550 dto.iGlowSize = glowSize(wizard);
551
552 DrawThemeTextEx(hTheme, dcMem, 0, 0, reinterpret_cast<LPCWSTR>(text.utf16()), -1, uFormat, &rctext, &dto );
553 BitBlt(hdc, rectDp.left(), rectDp.top(), rectDp.width(), rectDp.height(), dcMem, 0, 0, SRCCOPY);
554 SelectObject(dcMem, (HGDIOBJ) hOldBmp);
555 SelectObject(dcMem, (HGDIOBJ) hOldFont);
556 DeleteObject(bmp);
557 DeleteObject(hCaptionFont);
558 DeleteDC(dcMem);
559 //ReleaseDC(hwnd, hdc);
560}
561
562void QVistaHelper::drawBlackRect(const QRect &rect, HDC hdc)
563{
564 // Set up a memory DC and bitmap that we'll draw into
565 const QRect rectDp = QRect(rect.topLeft() * QVistaHelper::m_devicePixelRatio,
566 rect.size() * QVistaHelper::m_devicePixelRatio);
567 HDC dcMem;
568 HBITMAP bmp;
569 BITMAPINFO dib;
570 ZeroMemory(&dib, sizeof(dib));
571 dcMem = CreateCompatibleDC(hdc);
572
573 dib.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
574 dib.bmiHeader.biWidth = rectDp.width();
575 dib.bmiHeader.biHeight = -rectDp.height();
576 dib.bmiHeader.biPlanes = 1;
577 dib.bmiHeader.biBitCount = 32;
578 dib.bmiHeader.biCompression = BI_RGB;
579
580 bmp = CreateDIBSection(hdc, &dib, DIB_RGB_COLORS, NULL, NULL, 0);
581 auto hOldBmp = reinterpret_cast<HBITMAP>(SelectObject(dcMem, (HGDIOBJ) bmp));
582
583 BitBlt(hdc, rectDp.left(), rectDp.top(), rectDp.width(), rectDp.height(), dcMem, 0, 0, SRCCOPY);
584 SelectObject(dcMem, (HGDIOBJ) hOldBmp);
585
586 DeleteObject(bmp);
587 DeleteDC(dcMem);
588}
589
590int QVistaHelper::frameSizeDp()
591{
592 return GetSystemMetrics(SM_CXSIZEFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER);
593}
594
595int QVistaHelper::captionSizeDp()
596{
597 return GetSystemMetrics(SM_CYCAPTION);
598}
599
600int QVistaHelper::titleOffset()
601{
602 int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize(wizard) + iconSpacing;
603 return leftMargin(wizard) + iconOffset;
604}
605
606int QVistaHelper::iconSize(const QPaintDevice *device)
607{
608 return QStyleHelper::dpiScaled(16, device); // Standard Aero
609}
610
611int QVistaHelper::glowSize(const QPaintDevice *device)
612{
614}
615
616int QVistaHelper::topOffset(const QPaintDevice *device)
617{
618 static const int aeroOffset = QStyleHelper::dpiScaled(13, device);
619 return aeroOffset + titleBarSize();
620}
621
623
624#endif // style_windowsvista
IOBluetoothDevice * device
The QAbstractButton class is the abstract base class of button widgets, providing functionality commo...
static QFont font()
Returns the default application font.
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtGui
Definition qevent.h:165
\inmodule QtCore
Definition qcoreevent.h:45
@ MouseMove
Definition qcoreevent.h:63
@ MouseButtonPress
Definition qcoreevent.h:60
@ MouseButtonRelease
Definition qcoreevent.h:61
\reentrant \inmodule QtGui
\reentrant
Definition qfont.h:22
static QPlatformNativeInterface * platformNativeInterface()
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
Definition qicon.cpp:1019
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
Definition qicon.cpp:834
The QKeySequence class encapsulates a key sequence as used by shortcuts.
\inmodule QtCore
Definition qmargins.h:24
\inmodule QtGui
Definition qevent.h:196
\inmodule QtCore
Definition qobject.h:103
virtual bool eventFilter(QObject *watched, QEvent *event)
Filters events if this object has been installed as an event filter for the watched object.
Definition qobject.cpp:1555
qreal devicePixelRatio() const
int logicalDpiY() const
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:486
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
void restore()
Restores the current painter state (pops a saved state off the stack).
void save()
Saves the current painter state (pushes the state onto a stack).
void setFont(const QFont &f)
Sets the painter's font to the given font.
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
\inmodule QtCore\reentrant
Definition qpoint.h:217
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
Definition qpoint.h:343
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:348
\inmodule QtCore\reentrant
Definition qpoint.h:25
constexpr int x() const noexcept
Returns the x coordinate of this point.
Definition qpoint.h:130
constexpr int y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:135
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr int height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:239
constexpr int width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:236
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:188
The QResizeEvent class contains event parameters for resize events.
Definition qevent.h:548
QPointF globalPosition() const
Returns the position of the point in this event on the screen or virtual desktop.
Definition qevent.h:123
Qt::MouseButton button() const
Returns the button that caused the event.
Definition qevent.h:116
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
Definition qstring.cpp:6995
\inmodule QtCore
Definition qvariant.h:65
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Definition qvariant.h:536
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QWidget * nativeParentWidget() const
Definition qwidget.cpp:4333
QWidget * window() const
Returns the window for this widget, i.e.
Definition qwidget.cpp:4313
void setGeometry(int x, int y, int w, int h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qwidget.h:886
Qt::LayoutDirection layoutDirection
the layout direction for this widget.
Definition qwidget.h:170
virtual void leaveEvent(QEvent *event)
This event handler can be reimplemented in a subclass to receive widget leave events which are passed...
Definition qwidget.cpp:9731
int minimumHeight
the widget's minimum height in pixels
Definition qwidget.h:125
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition qwidget.h:106
int width
the width of the widget excluding any window frame
Definition qwidget.h:114
int maximumHeight
the widget's maximum height in pixels
Definition qwidget.h:129
virtual void enterEvent(QEnterEvent *event)
This event handler can be reimplemented in a subclass to receive widget enter events which are passed...
Definition qwidget.cpp:9715
QIcon windowIcon
the widget's icon
Definition qwidget.h:152
void update()
Updates the widget unless updates are disabled or the widget is hidden.
QWindow * windowHandle() const
If this is a native widget, return the associated QWindow.
Definition qwidget.cpp:2483
QString windowTitle
the window title (caption)
Definition qwidget.h:151
QPointF mapTo(const QWidget *, const QPointF &) const
Translates the widget coordinate pos to the coordinate system of parent.
Definition qwidget.cpp:4197
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition qwidget.h:811
Qt::WindowStates windowState() const
Returns the current window state.
Definition qwidget.cpp:2888
QBackingStore * backingStore() const
bool isActiveWindow
whether this widget's window is the active window
Definition qwidget.h:139
QPointF mapToParent(const QPointF &) const
Translates the widget coordinate pos to a coordinate in the parent widget.
Definition qwidget.cpp:4263
void releaseMouse()
Releases the mouse grab.
void setCursor(const QCursor &)
Definition qwidget.cpp:4960
\inmodule QtGui
Definition qwindow.h:63
static QFont LOGFONT_to_QFont(const LOGFONT &lf, int verticalDPI=0)
Raster or OpenGL Window.
The QWizard class provides a framework for wizards.
Definition qwizard.h:19
WizardStyle wizardStyle
the look and feel of the wizard
Definition qwizard.h:21
@ AeroStyle
Definition qwizard.h:58
QOpenGLWidget * widget
[1]
QString text
opt iconSize
rect
[4]
QStyleOptionButton opt
fontMetrics
else opt state
[0]
T toNativePixels(const T &value, const C *context)
Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, qreal dpi)
Combined button and popup list for selecting options.
bool isEnabled()
@ WindowMaximized
Definition qnamespace.h:254
@ AlignVCenter
Definition qnamespace.h:155
@ AlignHCenter
Definition qnamespace.h:148
@ ALT
@ LeftButton
Definition qnamespace.h:58
@ LeftToRight
@ NoFocus
Definition qnamespace.h:107
@ SizeVerCursor
@ ArrowCursor
@ Key_Left
Definition qnamespace.h:677
void * HANDLE
#define QByteArrayLiteral(str)
Definition qbytearray.h:52
#define rgb(r, g, b)
Definition qcolor.cpp:124
#define qWarning
Definition qlogging.h:166
#define Q_DECLARE_METATYPE(TYPE)
Definition qmetatype.h:1525
#define SIGNAL(a)
Definition qobjectdefs.h:53
GLboolean GLboolean GLboolean b
GLuint64 GLenum void * handle
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLboolean r
[2]
GLint GLint GLint yoffset
GLint GLsizei width
GLenum type
GLuint GLsizei const GLchar * message
GLint GLint xoffset
GLenum GLuint GLintptr offset
GLboolean GLboolean g
struct _cl_event * event
GLhandleARB obj
[2]
GLuint64EXT * result
[6]
GLfloat GLfloat p
[1]
HICON qt_pixmapToWinHICON(const QPixmap &p)
static constexpr QSize frameSize(const T &frame)
static QT_BEGIN_NAMESPACE qreal dpr(const QWindow *w)
static bool isWindow(QObject *object)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define Q_UNUSED(x)
double qreal
Definition qtypes.h:187
ptrdiff_t qintptr
Definition qtypes.h:166
struct tagMSG MSG
QPainter painter(this)
[7]
aWidget window() -> setWindowTitle("New Window Title")
[2]
button setShortcut(tr("Alt+F7"))