220 QStylePainter
p(
this);
222 option.rect = QRect(
rect().right() - 15,
rect().bottom() - 15, 14, 14);
224 option.palette.setBrush(QPalette::ButtonText, Qt::black);
225 option.state = QStyle::State_Enabled;
226 p.setBrush(Qt::black);
228 p.drawPrimitive(QStyle::PE_IndicatorArrowDown, option);
233 QScreen *currentScreen =
nullptr;
234 auto getCurrentScreen = [
this, ¤tScreen] {
235 if (!currentScreen) {
236 QWindow *mainWinHandle = window()->windowHandle();
238 currentScreen = mainWinHandle->screen();
240 currentScreen = QApplication::primaryScreen();
243 return currentScreen;
249 QWindow *winHandle =
m_d->
frame->windowHandle();
251 winHandle->setScreen(getCurrentScreen());
256 QPoint pos = this->isVisible() ? this->mapToGlobal(QPoint(0, this->size().height())) : QCursor().pos();
258 QRect popupRect(pos, popSize);
261 QScreen *screen = [
this, &getCurrentScreen]() {
262 QWindow *winHandle =
m_d->
frame->windowHandle();
263 if (winHandle && winHandle->screen()) {
264 return winHandle->screen();
266 return getCurrentScreen();
268 QRect screenRect = screen->availableGeometry();
271 popupRect.moveTo(
m_d->
frame->geometry().topLeft());
273 popupRect.moveTo(this->window()->geometry().center() - QRect(QPoint(0, 0), popSize).center());