Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. How to set a comboBox Text an empty string if the index is 0?
Forum Updated to NodeBB v4.3 + New Features

How to set a comboBox Text an empty string if the index is 0?

Scheduled Pinned Locked Moved Solved Qt for Python
3 Posts 2 Posters 563 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.
  • L Offline
    L Offline
    LT-K101
    wrote on last edited by
    #1

    I want to set a comboBox text to an empty string when the comboBox index is 0. I tried the code below but it exits my application. Please any help on what am doing wrong. Thanks in advance.

    Check = " "
    qualification = self.ui.qualification_comboBox.currentText()
            if self.ui.qualification_comboBox.currentIndex() == 0:
                self.ui.qualification_comboBox.setCurrentText(Check)
    
    jsulmJ 1 Reply Last reply
    0
    • L LT-K101

      I want to set a comboBox text to an empty string when the comboBox index is 0. I tried the code below but it exits my application. Please any help on what am doing wrong. Thanks in advance.

      Check = " "
      qualification = self.ui.qualification_comboBox.currentText()
              if self.ui.qualification_comboBox.currentIndex() == 0:
                  self.ui.qualification_comboBox.setCurrentText(Check)
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #2

      @LT-K101 said in How to set a comboBox Text an empty string if the index is 0?:

      I tried the code below but it exits my application

      So, did you use debugger to see what happens and to provide stack trace here, so others can check what happens?
      Also the string you're setting is not empty.

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

      L 1 Reply Last reply
      2
      • jsulmJ jsulm

        @LT-K101 said in How to set a comboBox Text an empty string if the index is 0?:

        I tried the code below but it exits my application

        So, did you use debugger to see what happens and to provide stack trace here, so others can check what happens?
        Also the string you're setting is not empty.

        L Offline
        L Offline
        LT-K101
        wrote on last edited by
        #3
        This post is deleted!
        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