Results 1 to 1 of 1

Thread: QComboBox - view not as expected when ugraded to Qt 4.6.0

  1. #1
    Join Date
    Jan 2009
    Location
    Midlands UK
    Posts
    62
    Thanks
    6
    Thanked 9 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QComboBox - view not as expected when ugraded to Qt 4.6.0

    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:-

    Qt Code:
    1. #ifndef MAINWINDOW_H
    2. #define MAINWINDOW_H
    3.  
    4. #include <QMainWindow>
    5. #include <QComboBox>
    6.  
    7. /***********************************************************/
    8. class MainWindow : public QMainWindow {
    9. Q_OBJECT
    10.  
    11. public:
    12. MainWindow(QWidget *parent = 0);
    13. ~MainWindow();
    14.  
    15. private:
    16. QComboBox *Box1, *Box2 ;
    17. QStringList List1, List2 ;
    18.  
    19. };
    20.  
    21. /***********************************************************/
    22.  
    23. #endif // MAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 


    cpp file ;

    Qt Code:
    1. #include "mainwindow.h"
    2.  
    3. /***********************************************************/
    4. MainWindow::MainWindow(QWidget *parent) :
    5. QMainWindow(parent)
    6. {
    7. Box1 = new QComboBox(this) ;
    8. Box1->setGeometry(10,10,100,20) ;
    9. List1 << "B11" << "B12" << "B13" << "B14" ;
    10. Box1->addItems(List1);
    11. Box1->setCurrentIndex(1);
    12.  
    13. Box2 = new QComboBox(this) ;
    14. Box2->setGeometry(10,40,100,20) ;
    15. List2 << "B21" << "B22" << "B23" << "B24" ;
    16. Box2->addItems(List2);
    17. Box2->setCurrentIndex(2);
    18. }
    19.  
    20. /***********************************************************/
    21. MainWindow::~MainWindow()
    22. {
    23. }
    24.  
    25. /***********************************************************/
    To copy to clipboard, switch view to plain text mode 



    SteveH
    Last edited by wysota; 5th January 2010 at 13:41. Reason: Changed [qtclass] to [code]

Similar Threads

  1. Qmenu as View in a QCombobox
    By tyrdal in forum Qt Programming
    Replies: 1
    Last Post: 25th September 2009, 10:04
  2. Expected class-name before '{' token
    By imagiro1 in forum Newbie
    Replies: 16
    Last Post: 16th June 2009, 11:37
  3. QHTTP::GET doesn't work as expected !
    By tuthmosis in forum Qt Programming
    Replies: 1
    Last Post: 27th July 2008, 15:45
  4. expected initializer before »)« token
    By Holy in forum Qt Programming
    Replies: 2
    Last Post: 24th May 2008, 16:24
  5. Expected lifetime of QModelIndex?
    By Ishark in forum Qt Programming
    Replies: 1
    Last Post: 15th August 2007, 21:18

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.