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 Does Not Display Current Text in UI When a Non-Default Value is Selected
Forum Updated to NodeBB v4.3 + New Features

QComboBox Does Not Display Current Text in UI When a Non-Default Value is Selected

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 767 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on 9 Mar 2020, 15:24 last edited by A Former User 3 Dec 2020, 12:17
    #1

    I am developing a UWP application for Windows 10 using Qt for UWP.

    One of the UI elements in my application is a QComboBox. The application's logic and the corresponding UI works as expected when the default value (text) is not changed.

    However, when I select a different value from the drop-down list, the selected value is not displayed once the drop-down list closes. The box still shows the default value (text). But when I observe the value received by currentIndex, it corresponds to the selected value. Whenever I select a non-default value, the UI seems to be blocked. I cannot interact with any other UI elements except the QComboBox element.

    Has anyone faced this problem before? How do I ensure that the current selected values is displayed in the QComboBox?

    UPDATE:

    I built a demo application to check the QComboBox functionality on its own and I see the same behavior. I just added a few items to the QComboBox widget and built the application with both msvc2017_64 and winrt_x64_msvc2017 of Qt 5.14.1.

    When I launch the app that was build using msvc2017_64, I get a window with the QComboBox widget. When I select a value, that value is displayed when the drop-down menu closes.

    However, when this is not the case with the UWP application that I build with winrt_x64_msvc2017. It does not show me the updated value. It stays stuck at the default value.

    Another problem that I observed in my original UWP app was that whenever I click on the QComboBox and select a value, I do not get control of the UI back. Everything in the UI is stuck but whichever button I click is emitting the signal in the background. The UI does not respond at all.

    I was tinkering around trying to understand what was causing this behavior. During this process, I stumbled upon a workaround to get the UI to respond again. If I launch a QMessageBox within the QComboBox's currentTextChanged signal, I get the UI control back (the currentText changes to the value that I previously selected) when I press OK on the QMessageBox pop-up.

    I do not understand why this workaround gives me back control of the UI and gets things working. Please help me understand this.

    J 1 Reply Last reply 10 Mar 2020, 06:32
    0
    • ? A Former User
      9 Mar 2020, 15:24

      I am developing a UWP application for Windows 10 using Qt for UWP.

      One of the UI elements in my application is a QComboBox. The application's logic and the corresponding UI works as expected when the default value (text) is not changed.

      However, when I select a different value from the drop-down list, the selected value is not displayed once the drop-down list closes. The box still shows the default value (text). But when I observe the value received by currentIndex, it corresponds to the selected value. Whenever I select a non-default value, the UI seems to be blocked. I cannot interact with any other UI elements except the QComboBox element.

      Has anyone faced this problem before? How do I ensure that the current selected values is displayed in the QComboBox?

      UPDATE:

      I built a demo application to check the QComboBox functionality on its own and I see the same behavior. I just added a few items to the QComboBox widget and built the application with both msvc2017_64 and winrt_x64_msvc2017 of Qt 5.14.1.

      When I launch the app that was build using msvc2017_64, I get a window with the QComboBox widget. When I select a value, that value is displayed when the drop-down menu closes.

      However, when this is not the case with the UWP application that I build with winrt_x64_msvc2017. It does not show me the updated value. It stays stuck at the default value.

      Another problem that I observed in my original UWP app was that whenever I click on the QComboBox and select a value, I do not get control of the UI back. Everything in the UI is stuck but whichever button I click is emitting the signal in the background. The UI does not respond at all.

      I was tinkering around trying to understand what was causing this behavior. During this process, I stumbled upon a workaround to get the UI to respond again. If I launch a QMessageBox within the QComboBox's currentTextChanged signal, I get the UI control back (the currentText changes to the value that I previously selected) when I press OK on the QMessageBox pop-up.

      I do not understand why this workaround gives me back control of the UI and gets things working. Please help me understand this.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 10 Mar 2020, 06:32 last edited by
      #2

      @vb0987 said in QComboBox Does Not Display Current Text in UI When a Non-Default Value is Selected:

      Whenever I select a non-default value, the UI seems to be blocked

      Does your application do anything special when you select values in this combo box?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on 10 Mar 2020, 07:36 last edited by
        #3

        No. In my original application, I connected currentIndexChanged() to a function that just disables other widgets, updates some local variables and unblocks the widgets.

        I built a demo application to check the QComboBox functionality on its own and I see the same behavior. I just added a few items to the QComboBox widget and built the application with both msvc2017_64 and winrt_x64_msvc2017 of Qt 5.14.1.

        When I launch the app that was build using msvc2017_64, I get a window with the QComboBox widget. When I select a value, that value is displayed when the drop-down menu closes.

        However, when this is not the case with the UWP application that I build with winrt_x64_msvc2017. It does not show me the updated value. It stays stuck at the default value.

        Another problem that I observed in my original UWP app was that whenever I click on the QComboBox and select a value, I do not get control of the UI back. Everything in the UI is stuck but whichever button I click is emitting the signal in the background. The UI does not respond at all.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on 10 Mar 2020, 07:56 last edited by
          #4

          @jsulm If you would like to look at the source code, I have uploaded it to GitHub.
          Please open the Visual Studio project file in DemoApplication/uwp/ for the UWP application. Thank you.

          1 Reply Last reply
          0

          1/4

          9 Mar 2020, 15:24

          • Login

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