| | |
| | | }; |
| | | |
| | | MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { |
| | | installWindowAgent(); |
| | | installWindowAgent(); |
| | | |
| | | #if 1 |
| | | auto clockWidget = new ClockWidget(); |
| | |
| | | setWindowTitle(tr("Example MainWindow")); |
| | | resize(800, 600); |
| | | |
| | | // setFixedHeight(600); |
| | | // windowAgent->centralize(); |
| | | } |
| | | |
| | |
| | | switch (event->type()) { |
| | | case QEvent::WindowActivate: { |
| | | auto menu = menuWidget(); |
| | | menu->setProperty("bar-active", true); |
| | | style()->polish(menu); |
| | | if (menu) { |
| | | menu->setProperty("bar-active", true); |
| | | style()->polish(menu); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | case QEvent::WindowDeactivate: { |
| | | auto menu = menuWidget(); |
| | | menu->setProperty("bar-active", false); |
| | | style()->polish(menu); |
| | | if (menu) { |
| | | menu->setProperty("bar-active", false); |
| | | style()->polish(menu); |
| | | } |
| | | break; |
| | | } |
| | | |
| | |
| | | windowBar->setTitleLabel(titleLabel); |
| | | windowBar->setHostWidget(this); |
| | | |
| | | windowAgent->setTitleBar(windowBar); |
| | | windowAgent->setTitleBar(windowBar); |
| | | #ifndef Q_OS_MAC |
| | | windowAgent->setSystemButton(QWK::WindowAgentBase::WindowIcon, iconButton); |
| | | windowAgent->setSystemButton(QWK::WindowAgentBase::Minimize, minButton); |
| | | windowAgent->setSystemButton(QWK::WindowAgentBase::Maximize, maxButton); |
| | | windowAgent->setSystemButton(QWK::WindowAgentBase::Close, closeButton); |
| | | windowAgent->setSystemButton(QWK::WindowAgentBase::WindowIcon, iconButton); |
| | | windowAgent->setSystemButton(QWK::WindowAgentBase::Minimize, minButton); |
| | | windowAgent->setSystemButton(QWK::WindowAgentBase::Maximize, maxButton); |
| | | windowAgent->setSystemButton(QWK::WindowAgentBase::Close, closeButton); |
| | | #endif |
| | | windowAgent->setHitTestVisible(menuBar, true); |
| | | windowAgent->setHitTestVisible(menuBar, true); |
| | | |
| | | #ifdef Q_OS_MAC |
| | | windowAgent->setSystemButtonAreaCallback([](const QSize &size) { |