Results 1 to 15 of 15

Thread: Hopefully the last time: round buttons

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2009
    Posts
    61
    Thanks
    5
    Thanked 6 Times in 6 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Hopefully the last time: round buttons

    Yesterday I found a thread with "how to shape QPushbutton" and something like

    QIcon icon("myicon");
    ..dontknow...setMask(icon.getMask);

    and now I am searching again and find lots of "shapings" and "round widgets", but not the mentioned code

    So, can we do it one more time and then put the infos into the wiki? Round Buttons (or similiar)?

    In Qt3, it was like
    Qt Code:
    1. void TGuiObject::setBitmap(QWidget* w, const QString& file)
    2. {
    3. if( !file.isEmpty() && QFile::exists(file) ) {
    4. QPixmap pix(file);
    5. if( QFile::exists(file+fileMask) )
    6. pix.setMask(QBitmap(file+fileMask));
    7. QPalette pal;
    8. pal.setBrush(w->backgroundRole(), QBrush(pix));
    9. w->setPalette(pal);
    10. }
    11. }
    To copy to clipboard, switch view to plain text mode 
    wasn'it?

    I wanted the Starfleet logo to be the button. When I click it with the above code, it is not really shaped... it is still a rectangle with white corners around the round image...
    Attached Images Attached Images

Similar Threads

  1. Once again: buttons and time consuming tasks
    By pampo in forum Qt Programming
    Replies: 1
    Last Post: 4th May 2009, 18:26
  2. How to constantly refresh time on a view
    By salmanmanekia in forum Qt Programming
    Replies: 5
    Last Post: 23rd June 2008, 12:44
  3. Replies: 1
    Last Post: 1st February 2008, 18:55
  4. QDateTime GMT add sec. or - sec. from locale time....
    By patrik08 in forum Qt Programming
    Replies: 2
    Last Post: 20th February 2007, 16:39
  5. Problem with pointers while using localtime() and time()
    By jamadagni in forum General Programming
    Replies: 7
    Last Post: 11th January 2006, 15:48

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.