Results 1 to 3 of 3

Thread: CE_PushButton

  1. #1
    Join Date
    Jun 2008
    Posts
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default CE_PushButton

    Hi

    I’m using “drawControl” case “CE_PushButton:” to draw a button and now I want to show the button text and align it to the right, but I can’t…

    I hope somebody can help me, thanks

    Qt Code:
    1. case CE_PushButton:
    2. ... some code ...
    3. painter->setRenderHint(QPainter::Antialiasing, true);
    4. if(option->state & State_HasFocus)
    5. painter->setPen(QPen(QColor::QColor(204,255,0),1,Qt::SolidLine, Qt::RoundCap));
    6. else
    7. painter->setPen(Qt::NoPen);
    8. painter->setBrush(gradient);
    9. painter->drawRoundRect(roundRect, cx, cy);
    10.  
    11. break;
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: CE_PushButton

    There are a few overloads of QPainter::drawText(). Some of them support alignment flags. The button text is passed within QStyleOptionButton.
    J-P Nurmi

  3. #3
    Join Date
    Jun 2008
    Posts
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: CE_PushButton

    Thanks.

    Just what I needed.

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.