PDA

View Full Version : QComboBox - view not as expected when ugraded to Qt 4.6.0



SteveH
5th January 2010, 14:14
Hi all,

I've a small problem with QComboBox's that has arisen when I updated a PC from Qt 4.5.1 to 4.6.0 (Windows XP SP3)
In the new version the box that has focus and is in the collapsed state just shows the highlight colour but no text. When expanded it shows the correct text item as normal with highlight. When focus moves to another box the unfocused box shows text as normal. The older version performs as expected.

I've attached a small bit of code to show the problem - I tried it on two pcs with both versions of Qt and it performed as described - not showing text in a collapsed box with focus in the later version.

Am I missing something that has been added in 4.6.0 and needs to be explicitly set - nothing obvious shows up in the docs - or is my Qt installations at fault ?

Header file:-


#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QComboBox>

/************************************************** *********/
class MainWindow : public QMainWindow {
Q_OBJECT

public:
MainWindow(QWidget *parent = 0);
~MainWindow();

private:
QComboBox *Box1, *Box2 ;
QStringList List1, List2 ;

};

/************************************************** *********/

#endif // MAINWINDOW_H


cpp file ;


#include "mainwindow.h"

/************************************************** *********/
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
Box1 = new QComboBox(this) ;
Box1->setGeometry(10,10,100,20) ;
List1 << "B11" << "B12" << "B13" << "B14" ;
Box1->addItems(List1);
Box1->setCurrentIndex(1);

Box2 = new QComboBox(this) ;
Box2->setGeometry(10,40,100,20) ;
List2 << "B21" << "B22" << "B23" << "B24" ;
Box2->addItems(List2);
Box2->setCurrentIndex(2);
}

/************************************************** *********/
MainWindow::~MainWindow()
{
}

/************************************************** *********/



:confused: SteveH