| 755 | if (!menu) |
| 756 | { |
| 757 | menu = new ElaMenu(this); |
| 758 | } |
| 759 | for (int i = 0; i < toolbars.size(); ++i) |
| 760 | { |
| 761 | QToolBar* toolBar = toolbars.at(i); |
| 762 | if (toolBar->parentWidget() == this) |
| 763 | { |
| 764 | menu->addAction(toolbars.at(i)->toggleViewAction()); |
| 765 | } |
| 766 | } |
| 767 | } |
| 768 | if (menu) |
| 769 | { |
| 770 | menu->setMenuItemHeight(28); |
| 771 | } |
| 772 | return menu; |
| 773 | } |
| 774 | |
| 775 | void ElaWindow::paintEvent(QPaintEvent* event) |
| 776 | { |
| 777 | Q_D(ElaWindow); |
| 778 | QPainter painter(this); |
| 779 | painter.save(); |
| 780 | painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); |
| 781 | switch (d->_windowDisplayMode) |
| 782 | { |
| 783 | case ElaApplicationType::Normal: |
| 784 | { |
| 785 | switch (d->_pWindowPaintMode) |
| 786 | { |
| 787 | case ElaWindowType::Normal: |
| 788 | { |
| 789 | painter.setPen(Qt::NoPen); |
| 790 | painter.setBrush(ElaColorAnimation::getColor(this, ElaThemeColor(d->_themeMode, WindowBase), "Background")); |
| 791 | painter.drawRect(rect()); |
| 792 | break; |
| 793 | } |
| 794 | case ElaWindowType::Pixmap: |
| 795 | { |
| 796 | QPixmap* pix = d->_themeMode == ElaThemeType::Light ? d->_lightWindowPix : d->_darkWindowPix; |
| 797 | qreal windowAspectRatio = (qreal)rect().width() / rect().height(); |
| 798 | qreal pixAspectRatio = (qreal)pix->width() / pix->height(); |
| 799 | int targetPixWidth, targetPixHeight; |
| 800 | if (windowAspectRatio < pixAspectRatio) |
| 801 | { |
| 802 | targetPixWidth = qRound(pix->width() * windowAspectRatio / pixAspectRatio); |
| 803 | targetPixHeight = pix->height(); |
| 804 | } |
| 805 | else |
| 806 | { |
| 807 | targetPixWidth = pix->width(); |
| 808 | targetPixHeight = qRound(pix->height() * pixAspectRatio / windowAspectRatio); |
| 809 | } |
| 810 | painter.drawPixmap(rect(), *pix, QRect((pix->width() - targetPixWidth) / 2, (pix->height() - targetPixHeight) / 2, targetPixWidth, targetPixHeight)); |
| 811 | break; |
| 812 | } |
| 813 | case ElaWindowType::Movie: |
| 814 | { |
nothing calls this directly
no outgoing calls
no test coverage detected