Results 1 to 5 of 5

Thread: QComboBox in QGroupBox header

  1. #1
    Join Date
    Jun 2018
    Posts
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default QComboBox in QGroupBox header

    Hi everyone,

    I'm new with Qt 5.11 and I can found a way to put a QComboBox or even an Icon in a QGroupBox header.
    My objective is to allow the content to change according to the QComboBox selection and the icon is to display an information window about this content.
    If someone has an idea fill free to help me.

    Thanks in advance.

  2. #2
    Join Date
    Jul 2008
    Posts
    401
    Thanks
    9
    Thanked 52 Times in 50 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QComboBox in QGroupBox header

    Hi, why not use a QComboBox and a QStackedWidget for the different contents? For the icon you can use a QLabel.

    Ginsengelf

  3. #3
    Join Date
    Jun 2018
    Posts
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QComboBox in QGroupBox header

    Hi,

    Thank you for your return.
    Unfortunately QStackedWidget is only useful to manage the inside of the QGroupBox for example (to change the contain according to the selection in the QComboBox).
    But what i'm currently trying to do is to put the QComboBox in the QGroupBox Header which only accept some text it seems.
    Maybe I'm not clear. In fact when creating a QGroupBox you specify a title/header which appears in the top left of the QGroupBox (same level as the surrounding line).
    I want to put a QComboBox in place of this text and even an icon if possible.

    Have a good day.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    3,995
    Thanks
    232
    Thanked 631 Times in 621 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QComboBox in QGroupBox header

    Maybe you should consider that what you want to do cannot be done with QGroupBox.

    Ginsengelf gave you an alternative way to make something with a similar appearance. If that isn't suitable, then you will have to write your own QWidget that looks like a group box but behaves the way you want it to.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  5. #5
    Join Date
    Jun 2018
    Posts
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QComboBox in QGroupBox header

    In fact I was almost sure that it was not possible (I read a large part of the documentation) but because I am new with Qt I was decided to ask here if it was possible or not.
    So as you said I will try to create something based on other API commands to build it.
    Thank you both for your time and answers.

    Have a good day.

Similar Threads

  1. Replies: 1
    Last Post: 20th May 2015, 11:21
  2. Generated UI header incorrectly includes class header?
    By droneone in forum Qt Programming
    Replies: 7
    Last Post: 14th June 2012, 14:48
  3. QStandardItem's header item and header label
    By feverzsj in forum Newbie
    Replies: 1
    Last Post: 14th January 2010, 19:57
  4. how to set QComboBox on qsqlquerymodel header
    By sivamuthaiah in forum Qt Programming
    Replies: 0
    Last Post: 21st July 2009, 06:35
  5. How to customize horizontal header (diagonal header view)
    By vairamuthu.g in forum Qt Programming
    Replies: 4
    Last Post: 4th September 2008, 15:59

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.