Results 1 to 7 of 7

Thread: My first combobox does not react to the mouse

  1. #1
    Join Date
    Nov 2009
    Location
    Laval, France
    Posts
    124
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default My first combobox does not react to the mouse

    Hi,
    I am using QTCreator and Designer to create a Window, into which I placed a combo box. I added 21 items.
    The count property is 21, I checked it.
    Unfortunately, when I run the program and click on the combobox, nothing happens: no drop down behaviour.
    I've been scouring the official doc, and I cannot see a hint of why this might be.
    yours truly

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: My first combobox does not react to the mouse

    There is no reason this should be if the widget is enabled. If you think it is enabled (the default) then there is something you are not describing that we can only guess at.

  3. #3
    Join Date
    Nov 2009
    Location
    Laval, France
    Posts
    124
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: My first combobox does not react to the mouse

    OK, thanks, I should consider this as strange.

  4. #4
    Join Date
    Nov 2009
    Location
    Laval, France
    Posts
    124
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: My first combobox does not react to the mouse

    Now I think I know what was going on:
    I had added a "drawing widget" to the layout of the window programmatically. I created it from a class derived from QLabel so as to draw on, with extra methods, then I added it to the layout programmatically.
    I did not think that I could use widgets derived from classes with QtDesigner. I still dont know.
    on the other hand the combo box was drawn with QtDesigner, with no consideration for the layout. Yes that's not respectful.
    Probably the "drawing label" widget was taking up the whole screen and the combobox was being masked. Now I'm adding the combobox by program, but it appears to the side of the label, halfway between the top and the bottom of the window, which is not ideal. At least it is responding.

  5. #5
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: My first combobox does not react to the mouse

    The combo box has signals which need to be connected somewhere. The signals which could interest you are activated() and currentIndexChanged(). Depending on the relation of the combo box to the rest of your UI, there could be some default connecting but it need not suit you. This might be the reason why the combo box reacts sometimes and it does not do other times.

    Create signal handlers for the combo box, connect and place breaks in the handlers. Debug and see whether your handlers are called and whether the handlers do what they should do.

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: My first combobox does not react to the mouse

    Quote Originally Posted by feraudyh View Post
    I did not think that I could use widgets derived from classes with QtDesigner. I still dont know.
    Look at the section "Using Custom Widgets with Qt Designer" or search for "promote" in the Qt Designer manual

    For vertical placement of the combo box in its horizontal layout space have a look at the alignment options on the right-click context menu for the widget in Designer.

  7. #7
    Join Date
    Nov 2009
    Location
    Laval, France
    Posts
    124
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: My first combobox does not react to the mouse

    Thanks Chris, that's very useful.

Similar Threads

  1. Replies: 3
    Last Post: 22nd February 2013, 19:56
  2. React on KeyEvent inside QTreeWidget
    By Raadush in forum Qt Programming
    Replies: 2
    Last Post: 10th April 2012, 06:58
  3. Replies: 1
    Last Post: 13th January 2012, 07:09
  4. [Qt] Window don't react
    By theGuy in forum Newbie
    Replies: 1
    Last Post: 1st February 2009, 13:24
  5. Replies: 0
    Last Post: 28th April 2008, 15:17

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.