From 34c71b9941d8473bc7d1f6920b37fdba16cd8d6b Mon Sep 17 00:00:00 2001 From: Utkarsh Ayachit Date: Sat, 30 Mar 2019 08:25:17 -0400 Subject: [PATCH] fix pixmap size On macOS with Qt 5.12, the icon for popping a layout tab out was rendered quite large. Fixed that. Also uses newer api QStyle::standardIcon instead of QStyle::standardPixmap which has been deprecated. --- Qt/Components/pqTabbedMultiViewWidget.cxx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Qt/Components/pqTabbedMultiViewWidget.cxx b/Qt/Components/pqTabbedMultiViewWidget.cxx index b84c1ad493..ccf37034af 100644 --- Qt/Components/pqTabbedMultiViewWidget.cxx +++ Qt/Components/pqTabbedMultiViewWidget.cxx @@ -67,6 +67,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +static const int PQTABBED_WIDGET_PIXMAP_SIZE = 16; //----------------------------------------------------------------------------- // ******************** pqTabWidget ********************** //----------------------------------------------------------------------------- @@ -123,19 +124,23 @@ int pqTabbedMultiViewWidget::pqTabWidget::addAsTab( this->connect(item, SIGNAL(nameChanged(pqServerManagerModelItem*)), self, SLOT(onLayoutNameChanged(pqServerManagerModelItem*))); - QLabel* label = new QLabel(this); + QLabel* label = new QLabel(); label->setObjectName("popout"); label->setToolTip(pqTabWidget::popoutLabelText(false)); label->setStatusTip(pqTabWidget::popoutLabelText(false)); - label->setPixmap(this->style()->standardPixmap(pqTabWidget::popoutLabelPixmap(false))); + label->setPixmap(label->style() + ->standardIcon(pqTabWidget::popoutLabelPixmap(false)) + .pixmap(PQTABBED_WIDGET_PIXMAP_SIZE, PQTABBED_WIDGET_PIXMAP_SIZE)); this->setTabButton(tab_index, QTabBar::LeftSide, label); label->installEventFilter(self); - label = new QLabel(this); + label = new QLabel(); label->setObjectName("close"); label->setToolTip("Close layout"); label->setStatusTip("Close layout"); - label->setPixmap(this->style()->standardPixmap(QStyle::SP_TitleBarCloseButton)); + label->setPixmap(label->style() + ->standardIcon(QStyle::SP_TitleBarCloseButton) + .pixmap(PQTABBED_WIDGET_PIXMAP_SIZE, PQTABBED_WIDGET_PIXMAP_SIZE)); this->setTabButton(tab_index, QTabBar::RightSide, label); label->installEventFilter(self); label->setVisible(!this->ReadOnly); @@ -592,8 +597,9 @@ bool pqTabbedMultiViewWidget::eventFilter(QObject* obj, QEvent* evt) { QLabel* label = qobject_cast(obj); bool popped_out = tabPage->togglePopout(); - label->setPixmap( - this->style()->standardPixmap(pqTabWidget::popoutLabelPixmap(popped_out))); + label->setPixmap(label->style() + ->standardIcon(pqTabWidget::popoutLabelPixmap(popped_out)) + .pixmap(PQTABBED_WIDGET_PIXMAP_SIZE, PQTABBED_WIDGET_PIXMAP_SIZE)); label->setToolTip(pqTabWidget::popoutLabelText(popped_out)); label->setStatusTip(pqTabWidget::popoutLabelText(popped_out)); } -- 2.21.0