Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QComboBox doing weird things on first show
QtWS25 Last Chance

QComboBox doing weird things on first show

Scheduled Pinned Locked Moved General and Desktop
20 Posts 4 Posters 7.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cincirin
    wrote on last edited by
    #5

    I have a simple test on Win7 and it works fine. I have added 100 items to combo box.
    !http://imageshack.us/photo/my-images/716/combobox.jpg/(combo box)!

    1 Reply Last reply
    0
    • E Offline
      E Offline
      EukeSnud
      wrote on last edited by
      #6

      [quote author="cincirin" date="1309853968"]I have a simple test on Win7 and it works fine. I have added 100 items to combo box.
      !https://dl-web.dropbox.com/get/comboBox.jpg?w=0c4c0b8a(comboBox)![/quote]

      I changed Win7-Style to Windows7-Basic and I did not work...

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tobias.hunger
        wrote on last edited by
        #7

        Please "file a bug report":http://bugreports.qt.nokia.com/, especially if you have some small application demonstrating the issue.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          cincirin
          wrote on last edited by
          #8

          [quote author="EukeSnud" date="1309854079"]I changed Win7-Style to Windows7-Basic and I did not work...[/quote]
          Interestingly enough, I also changed Windows 7 Aero themes to Windows 7 Basic, and all works perfectly.

          1 Reply Last reply
          0
          • E Offline
            E Offline
            EukeSnud
            wrote on last edited by
            #9

            [quote author="cincirin" date="1309854965"][quote author="EukeSnud" date="1309854079"]I changed Win7-Style to Windows7-Basic and I did not work...[/quote]
            Interestingly enough, I also changed Windows 7 Aero themes to Windows 7 Basic, and all works perfectly.
            [/quote]

            But you did have problems with Windows 7 aero theme?

            1 Reply Last reply
            0
            • C Offline
              C Offline
              cincirin
              wrote on last edited by
              #10

              [quote author="EukeSnud" date="1309855086"]But you did have problems with Windows 7 aero theme[/quote]
              No, it works on both Win 7 themes. I also played with and without layouts, but I didn't reproduce your bug.

              1 Reply Last reply
              0
              • E Offline
                E Offline
                EukeSnud
                wrote on last edited by
                #11

                My combobox won't cause trouble unless I have more than 3 entries in it...

                1 Reply Last reply
                0
                • E Offline
                  E Offline
                  EukeSnud
                  wrote on last edited by
                  #12

                  Just added a combobox to my main widget and filled it with 100 entries. No problems with this one ...

                  1 Reply Last reply
                  0
                  • E Offline
                    E Offline
                    EukeSnud
                    wrote on last edited by
                    #13

                    Might it be a problem with my QDialog? Let me post a small project containing a slim version of it...

                    qdbdialog.h
                    @#ifndef QDBDIALOG_H
                    #define QDBDIALOG_H

                    #include <QDialog>
                    #include <QString>
                    #include <QtGui/QLabel>
                    #include <QtGui/QLineEdit>
                    #include <QtGui/QCheckBox>
                    #include <QtGui/QComboBox>
                    #include <QtGui/QDialogButtonBox>

                    class QDbDialog : public QDialog
                    {
                    Q_OBJECT
                    public:
                    QDbDialog(QWidget * parent = 0, Qt::WindowFlags f = 0);
                    QDbDialog(QString *usr, QString *pwd, QString *dsn);
                    ~QDbDialog();

                    public slots:
                    void closeWithOk();
                    void closeWithCancel();
                    void closeWithB(bool b);

                    private:
                    QString *user;
                    QString *passwd;
                    QString *dstn;

                    QLabel *lblUsr;
                    QLabel *lblPwd;
                    QLabel *lblDsn;
                    QLineEdit *txtUsr;
                    QLineEdit *txtPwd;
                    QComboBox *cbDsn;
                    QDialogButtonBox *btnBox;
                    

                    };
                    #endif@

                    qdbdialog.cpp
                    @#include "qdbdialog.h"
                    #include <QLayout>

                    QDbDialog::QDbDialog(QWidget * parent, Qt::WindowFlags f) :
                    QDialog(parent,f),user(new QString("user")),passwd(new QString("pwd")),dstn(new QString("dsn")) {
                    }

                    QDbDialog::QDbDialog(QString *usr, QString *pwd, QString *dsn) : user(usr),passwd(pwd),dstn(dsn) {
                    lblUsr = new QLabel("&Username:");
                    txtUsr = new QLineEdit;
                    lblUsr->setBuddy(txtUsr);

                    lblPwd = new QLabel("&Password:");
                    txtPwd = new QLineEdit;
                    

                    txtPwd->setEchoMode(QLineEdit::Password);
                    lblPwd->setBuddy(txtPwd);

                    lblDsn = new QLabel("&ODBC-Datasource");
                    cbDsn = new QComboBox();
                    lblDsn->setBuddy(cbDsn);

                    QStringList dsnlist;
                    for (int i=0;i<100;i++) {
                    dsnlist.push_back("TEST" + QString::number(i+1));
                    }

                    dsnlist.sort();
                    cbDsn->addItems(dsnlist);

                    btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
                    connect(btnBox,SIGNAL(accepted()),this,SLOT(closeWithOk()));
                    connect(btnBox,SIGNAL(rejected()),this,SLOT(reject()));

                    QGridLayout *mainLayout = new QGridLayout();
                    mainLayout->addWidget(lblUsr,0,0);
                    mainLayout->addWidget(txtUsr,0,1);
                    mainLayout->addWidget(lblPwd,1,0);
                    mainLayout->addWidget(txtPwd,1,1);
                    mainLayout->addWidget(lblDsn,2,0);
                    mainLayout->addWidget(cbDsn,2,1);
                    mainLayout->addWidget(btnBox,4,0,1,2);

                    setLayout(mainLayout);
                    }

                    QDbDialog::~QDbDialog() {

                    }

                    void QDbDialog::closeWithOk() {
                    *user = txtUsr->text();
                    *passwd = txtPwd->text();
                    *dstn = cbDsn->currentText();
                    done(QDialog::Accepted);
                    }

                    void QDbDialog::closeWithCancel() {
                    done(QDialog::Rejected);
                    }

                    void QDbDialog::closeWithB(bool b) {
                    if (b)
                    done(QDialog::Accepted);
                    else
                    done(QDialog::Rejected);
                    }@

                    main.cpp
                    @#include "qdbdialog.h"
                    #include <QtGui/QApplication>

                    int main(int argc, char *argv[])
                    {
                    QApplication a(argc, argv);

                    QString usr;
                    QString pwd;
                    QString dsn;

                    QDbDialog dbdiag(&usr,&pwd,&dsn);
                    dbdiag.exec();

                    return a.exec();
                    }
                    @

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      cincirin
                      wrote on last edited by
                      #14

                      I tested your posted code both with Win7 Aero theme and with Win7 Basic, but I could not replicate your problem.
                      [quote author="EukeSnud" date="1309849910"]But then the entries suddenly move to the top[/quote]
                      This happens without you doing anything?

                      1 Reply Last reply
                      0
                      • E Offline
                        E Offline
                        EukeSnud
                        wrote on last edited by
                        #15

                        [quote author="cincirin" date="1309861645"]I tested your posted code both with Win7 Aero theme and with Win7 Basic, but I could not replicate your problem.
                        [quote author="EukeSnud" date="1309849910"]But then the entries suddenly move to the top[/quote]
                        This happens without you doing anything?
                        [/quote]

                        Yes, the entries are in the right spot for less than a second and then jump to the top. (As shown on the screens)

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          cincirin
                          wrote on last edited by
                          #16

                          [quote author="EukeSnud" date="1309856718"]Just added a combobox to my main widget and filled it with 100 entries. No problems with this one ... [/quote]
                          From what I understand, it is part of the code you posted, and you have no problems.
                          Are you sure that when you fill other combo box with ODBC drivers, you don't call other functions ?

                          1 Reply Last reply
                          0
                          • E Offline
                            E Offline
                            EukeSnud
                            wrote on last edited by
                            #17

                            The code I posted is of a dialog window which can be executed as shown in main.cpp and this code causes the combobox on my dialog to perform the strange steps described...
                            However the dialog is part of a greater project and because I didn't want to post all of its source files I created this slim project above just executing my custom dialog.

                            What I meant was, that I added a combobox to the main widget in my greater project and filled it with 100 entries. This combobox does not show the strange behaviour like the one mentioned in the code above!

                            1 Reply Last reply
                            0
                            • C Offline
                              C Offline
                              cincirin
                              wrote on last edited by
                              #18

                              Sorry, I can not replicate your problem with posted code on Win 7 (with both Aero & Basic themes). Maybe someone else can get an idea of ​​what can happen.

                              1 Reply Last reply
                              0
                              • E Offline
                                E Offline
                                EukeSnud
                                wrote on last edited by
                                #19

                                I just tried it on another Win7 machine in the office and it worked just fine, so the problem seems to be bound to my local machine. But what could it be????

                                1 Reply Last reply
                                0
                                • C Offline
                                  C Offline
                                  cincirin
                                  wrote on last edited by
                                  #20

                                  Maybe DPI ? ... or something else specific to your Win7 configuration

                                  1 Reply Last reply
                                  0

                                  • Login

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Users
                                  • Groups
                                  • Search
                                  • Get Qt Extensions
                                  • Unsolved