Results 1 to 4 of 4

Thread: Align a QPushButton in the cellwidget of QTableWidget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    254
    Thanks
    92
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Align a QPushButton in the cellwidget of QTableWidget

    Quote Originally Posted by Lykurg View Post
    Alter your LED class that is paints the "image" centered.
    It's not an image, it's a QPushButton. I'm not getting anything that gives me options to align/space/set margin.


    Is there any widget or something (which is not an image) which I can use as an LED indicator inside a QTableWidget cell?

    Qt Code:
    1. #ifndef DEVICESTATE_INDICATOR_H
    2. #define DEVICESTATE_INDICATOR_H
    3.  
    4. #include <QPushButton>
    5. #include <QString>
    6.  
    7. #define INDICATOR_GREEN "background-color: green; border-radius: 7px; "
    8. #define INDICATOR_RED "background-color: red; border-radius: 7px; "
    9. #define INDICATOR_YELLOW "background-color: yellow; border-radius: 7px; "
    10. #define INDICATOR_GRAY "background-color: lightGray; border-radius: 7px; "
    11.  
    12.  
    13. class DeviceState_Indicator : public QPushButton
    14. {
    15. Q_OBJECT
    16. public:
    17. explicit DeviceState_Indicator(QWidget *parent, QString Indicator_Color);
    18.  
    19. signals:
    20.  
    21. public slots:
    22.  
    23. };
    24.  
    25. #endif // DEVICESTATE_INDICATOR_H
    To copy to clipboard, switch view to plain text mode 

    Thank you.
    Last edited by rawfool; 3rd May 2012 at 06:50.

Similar Threads

  1. How to set focus to QTableWidget's cellWidget
    By danczer in forum Qt Programming
    Replies: 1
    Last Post: 21st February 2011, 16:12
  2. QtableWidget moving cellWidget
    By hubipet in forum Qt Programming
    Replies: 0
    Last Post: 22nd October 2010, 07:06
  3. Using QPushButton in QTableWidget
    By arpspatel in forum Qt Programming
    Replies: 2
    Last Post: 1st September 2010, 00:26
  4. QTableWidget & cellWidget : some pointers
    By prashant in forum Qt Programming
    Replies: 1
    Last Post: 18th October 2009, 10:48
  5. Replies: 0
    Last Post: 2nd May 2008, 07:57

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
  •  
Qt is a trademark of The Qt Company.