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. setPlaceholderText segmentation fault for Qt 5.9
Forum Updated to NodeBB v4.3 + New Features

setPlaceholderText segmentation fault for Qt 5.9

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 594 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.
  • Evgeny SiberiaE Offline
    Evgeny SiberiaE Offline
    Evgeny Siberia
    wrote on last edited by Evgeny Siberia
    #1

    Hi. About differences QComboBox 5.9 and 5.15.

    QComboBox *cb = new QComboBox(this);
    cb->setPlaceholderText("something");
    

    When I compiled it for 5.15 - no problems. But setPlaceholderText's property was introduced in Qt 5.15. I need 5.9!
    I tried use it for QLineEdit, because QLineEnit has this property from 4.7 version:

    QComboBox *cb = new QComboBox(this);
    cb->lineEdit()->setPlaceholderText("something");
    

    But when I open my QDialog with this QComboBox (5.9 version!) I get "segmentation fault". Why ? What's a problem?

    if you see mistakes in English tell me about it

    JonBJ 1 Reply Last reply
    0
    • Evgeny SiberiaE Evgeny Siberia

      of course I understand, that QLineEnit no memory allocated. But why?)

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #6

      @Evgeny-Siberia
      449ac6a9-40aa-4246-a598-b7986e7779a4-image.png

      is your combobox set to editable ?


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      Evgeny SiberiaE 1 Reply Last reply
      4
      • Evgeny SiberiaE Evgeny Siberia

        Hi. About differences QComboBox 5.9 and 5.15.

        QComboBox *cb = new QComboBox(this);
        cb->setPlaceholderText("something");
        

        When I compiled it for 5.15 - no problems. But setPlaceholderText's property was introduced in Qt 5.15. I need 5.9!
        I tried use it for QLineEdit, because QLineEnit has this property from 4.7 version:

        QComboBox *cb = new QComboBox(this);
        cb->lineEdit()->setPlaceholderText("something");
        

        But when I open my QDialog with this QComboBox (5.9 version!) I get "segmentation fault". Why ? What's a problem?

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #2

        @Evgeny-Siberia
        Put in

        Q_ASSERT(cb->lineEdit());
        

        and you'll see why it segments....

        1 Reply Last reply
        1
        • Evgeny SiberiaE Offline
          Evgeny SiberiaE Offline
          Evgeny Siberia
          wrote on last edited by Evgeny Siberia
          #3

          I used debugger. And it breaked in this line

          cb->lineEdit()->setPlaceholderText("something");
          

          it the same result as Q_ASSERT.

          Fatal: ASSERT: "_cb->lineEdit()" in file...
          I have not information about the current problem. Why I can't use setPlaceholderText?

          if you see mistakes in English tell me about it

          JonBJ 1 Reply Last reply
          0
          • Evgeny SiberiaE Evgeny Siberia

            I used debugger. And it breaked in this line

            cb->lineEdit()->setPlaceholderText("something");
            

            it the same result as Q_ASSERT.

            Fatal: ASSERT: "_cb->lineEdit()" in file...
            I have not information about the current problem. Why I can't use setPlaceholderText?

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #4

            @Evgeny-Siberia
            Yes, it Q_ASSERT()s, that's the whole point of what I was showing you it would do! It has nothing to do with placeholder text. You need to understand this else you won't get far in C++....

            1 Reply Last reply
            0
            • Evgeny SiberiaE Offline
              Evgeny SiberiaE Offline
              Evgeny Siberia
              wrote on last edited by
              #5

              of course I understand, that QLineEnit no memory allocated. But why?)

              if you see mistakes in English tell me about it

              J.HilkJ 1 Reply Last reply
              0
              • Evgeny SiberiaE Evgeny Siberia

                of course I understand, that QLineEnit no memory allocated. But why?)

                J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by
                #6

                @Evgeny-Siberia
                449ac6a9-40aa-4246-a598-b7986e7779a4-image.png

                is your combobox set to editable ?


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                Evgeny SiberiaE 1 Reply Last reply
                4
                • J.HilkJ J.Hilk

                  @Evgeny-Siberia
                  449ac6a9-40aa-4246-a598-b7986e7779a4-image.png

                  is your combobox set to editable ?

                  Evgeny SiberiaE Offline
                  Evgeny SiberiaE Offline
                  Evgeny Siberia
                  wrote on last edited by Evgeny Siberia
                  #7

                  @J-Hilk said in setPlaceholderText segmentation fault for Qt 5.9:

                  @Evgeny-Siberia
                  449ac6a9-40aa-4246-a598-b7986e7779a4-image.png

                  is your combobox set to editable ?

                  I am sorry for that kid question. I read doc... but didn't see "only editable combo boxes have a line edit"

                  https://code.woboq.org/qt5/qtbase/src/widgets/widgets/qcheckbox.cpp.html#_ZN16QCheckBoxPrivate4initEv

                  if you see mistakes in English tell me about it

                  1 Reply Last reply
                  1

                  • Login

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