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. QListWidget bug
Forum Updated to NodeBB v4.3 + New Features

QListWidget bug

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 4.0k Views 1 Watching
  • 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.
  • X Offline
    X Offline
    xeroblast
    wrote on last edited by
    #1

    is this a bug? i created a QListWidget with more than 2 items and every first select of the 2nd and up item will cause the currentTextChanged(QString) signal to emit twice..

    @
    void Window::Window() {
    setupUI(this);
    QListWidgetItem *a = new QListWidgetItem("hello");
    QListWidgetItem *b = new QListWidgetItem("world");
    QListWidgetItem *c = new QListWidgetItem("foo");
    QListWidgetItem *d = new QListWidgetItem("bar");
    listWidget->addItem(a);
    listWidget->addItem(b);
    listWidget->addItem(c);
    listWidget->addItem(d);
    connect(listWidget, SIGNAL(currentTextChanged(QString)), this, SLOT(selectItem(QString)));
    }
    void Window::selectItem(QString val) {
    QMessageBox::information(this, "blah", val);
    }
    @

    if the QListWidget has no item selected yet and you select the 'world', 'foo' & 'bar' values, the messagebox appear twice unless you select the 'hello' value.
    this is what i understand, on your first select/click of the item in the QListWidget (except the first item), it sends a signal that the first item is selected then the chosen item will send a signal that it is the changes made in the QListWidget.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      I cannot reproduce this behavior. I get the signal only once.

      I'm on a Mac here. Could be some platform problem, but I doubt that.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        Hi,

        I did not check now, but might that be something with the focus?
        If the list widget has no focus, depending on the configuration of the designer, it might select one item on setFocus and then send the new selection....

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • ? This user is from outside of this forum
          ? This user is from outside of this forum
          Guest
          wrote on last edited by
          #4

          [quote author="Volker" date="1297171469"]I cannot reproduce this behavior. I get the signal only once. I'm on a Mac here. Could be some platform problem, but I doubt that.[/quote]

          just tried and can't reproduce this on windows too.

          1 Reply Last reply
          0
          • X Offline
            X Offline
            xeroblast
            wrote on last edited by
            #5

            i tested it on a stand-alone and when the UI gets loaded, the messagebox appear with the value of the first item. so i think, the problem is on focus because when i put another widget and it is on first select on tab. the messagebox dont appear but when i select an item (other than the first item) same problem occur.

            tested on ubuntu. i will try to test it in opensuse.

            1 Reply Last reply
            0
            • X Offline
              X Offline
              xeroblast
              wrote on last edited by
              #6

              updates : i tested it on opensuse and it produce the same problem. pressing TAB sends a signal also so it must be on focus. but when the QListWidget has already been focus, the problem will not occur anymore. only on first focus.

              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