Results 1 to 8 of 8

Thread: Centering QPushButton within a QTableWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    122
    Thanks
    62
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Wink Centering QPushButton within a QTableWidget

    Does anyone know how to center a QPushButton within a QTableWidget.
    I need to create a dynamic set of menu icons in a grid, with scrollbars for
    content that may be off screen. The QTableWidget seems to work to some
    extent, but interested if others think a better Qt list class would be better.

    Attached is a sample screenshot. I want the pushbuttons to be centered
    within the larger grid size of the table.

    I have left the grid lines on for reference, but these will be removed in practice.

    Do the text alignment flags work here, or is a delegate required, or perhaps a derivative
    of QTableWidget.
    Attached Images Attached Images

  2. #2
    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: Centering QPushButton within a QTableWidget

    Why don't you just use QListView / QListWidget in icon mode with a grid setup without any push buttons?
    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.


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

    bob2oneil (5th March 2011)

Similar Threads

  1. Using QPushButton in QTableWidget
    By arpspatel in forum Qt Programming
    Replies: 2
    Last Post: 1st September 2010, 00:26
  2. Can QPushButton be put into a QTableWidget cell?
    By ShaChris23 in forum Newbie
    Replies: 4
    Last Post: 1st September 2010, 00:18
  3. Centering a QCheckBox in a TableView
    By scarleton in forum Qt Programming
    Replies: 2
    Last Post: 6th July 2010, 15:13
  4. How to centering the checkbox in qtableview
    By nemesisqp in forum Qt Programming
    Replies: 1
    Last Post: 8th April 2010, 17:22
  5. Centering a window
    By dwarnold45 in forum Newbie
    Replies: 1
    Last Post: 30th March 2010, 07:43

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.