Results 1 to 4 of 4

Thread: Best widget to use as container for row of QPushButtons?

  1. #1
    Join Date
    Mar 2011
    Posts
    22
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Question Best widget to use as container for row of QPushButtons?

    Hello friends,
    I was wondering what the best widget in QT is for acting as an container for a row of QPushButtons?
    Any recommendations?

    The push buttons will act as tabs for a different "page" in the main window (i.e. a page which will contain a different interface and different controls depending on which tab button is currently selected). My central widget of my main window is a QTextEdit. The idea is to have a different document loaded into that text editor for each tab, i.e. the document corresponding to the interface currently shown, so that a user can switch back and forth from one "page" to another at his leisure, and any changes he makes to the current document loaded into the editor will be saved between switching back and forth.

    Thanks.

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Best widget to use as container for row of QPushButtons?

    Tell us more about what you didn't manage to achieve, anyway generic answers:
    1) to hold the pointers in code you can use a QList<QPushButton*> and do all the work by yourself...
    1.1) to organize the buttons in gui you can use a QGroupBox
    or
    2) also take a look at QTabWidget - i think is a better solution... mainly because it has the native look and feel of such functionality.

  3. The following user says thank you to Zlatomir for this useful post:

    Coolname007 (25th November 2012)

  4. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Best widget to use as container for row of QPushButtons?

    You can use QTabBar or just put the set of buttons in a horizontal layout.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #4
    Join Date
    Mar 2011
    Posts
    22
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Best widget to use as container for row of QPushButtons?

    Quote Originally Posted by Zlatomir View Post
    Tell us more about what you didn't manage to achieve, anyway generic answers:
    1) to hold the pointers in code you can use a QList<QPushButton*> and do all the work by yourself...
    1.1) to organize the buttons in gui you can use a QGroupBox
    or
    2) also take a look at QTabWidget - i think is a better solution... mainly because it has the native look and feel of such functionality.
    Hey, thanks. Yes, I like the QTabWidget suggestion. I am busy implementing that right now.

    As for QGroupBox, I had already looked at that one, but it appeared to me that that kind of widget kind of likes to present its controls in a vertical structure, and I was wanting my buttons to be in a horizontal structure...thus me searching for something else that would work.

Similar Threads

  1. Replies: 1
    Last Post: 23rd June 2011, 23:09
  2. Custom Container widget plugin help needed
    By JohnKustrin in forum Newbie
    Replies: 1
    Last Post: 14th May 2010, 10:01
  3. Container widget with scrollbars
    By a550ee in forum Qt Programming
    Replies: 7
    Last Post: 15th July 2008, 10:44
  4. Problem with custom container widget
    By MrGarbage in forum Qt Tools
    Replies: 4
    Last Post: 25th August 2007, 03:37
  5. Replies: 4
    Last Post: 9th August 2007, 08:20

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.