Problem with Qt 5.8 and El Capitan



  • I recently updated to El Capitan, but I noticed some weird behaviours on my project. :
    I have a QCombobox with images, I set the size policy setSizeAdjustPolicy(QComboBox::AdjustToContents). If I run the project on OS X 10.9.5 I get the desired result: the QCombobox is resized to show the whole image, if I run it on the computer with El Capitan instead, the Combobox stays the "standard" size.
    Similarly I had a few Qlabels in which I set the font to Wingdings, on 10.9.5 I get the desired symbols, on El Capitan on the other hand i get a normal font.
    Does anyone have any experience with Qt on El Capitan and can give me some insight on why this is?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you provide a minimal compilable example that shows this behaviour ?



  • Sure, so here is the code:
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QLabel>
    #include <QFont>
    #include <QComboBox>
    #include <QVBoxLayout>
    #include <QFontDatabase>
    #include <QDebug>
    #include <QWidget>
    #include <QIcon>

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    QVBoxLayout *mainLayout = new QVBoxLayout();
    QWidget *mainWidget = new QWidget();
    QLabel *label1 = new QLabel();
    qDebug()<<QFontDatabase().families();
    QFont lblFont("Wingdings");
    label1->setFont(lblFont);
    label1->setText("Test text");

    QComboBox *cmbBox = new QComboBox();
    cmbBox->setIconSize(QSize(40,40));
    cmbBox->addItem(QIcon("Cpt_Bottom.png"),"");
    cmbBox->addItem(QIcon("Cpt_Top.png"),"");
    cmbBox->addItem(QIcon("Cpt_Left.png"),"");
    cmbBox->addItem(QIcon("Cpt_Right.png"),"");
    cmbBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    cmbBox->setMinimumHeight(60);
    mainLayout->addWidget(label1);
    mainLayout->addWidget(cmbBox);
    mainWidget->setLayout(mainLayout);
    setCentralWidget(mainWidget);
    

    }

    On osx 10.9.5 I get a label with strings and a thick combobox, while on el capital I just get the string and a normal height combobox.
    Is there a way to upload images?


  • Qt Champions 2016

    @caster89 said in Problem with Qt 5.8 and El Capitan:

    Is there a way to upload images?

    yes use external site and paste link here
    postimage.org as example.


Log in to reply