Results 1 to 2 of 2

Thread: Leaving an empty space around a widget

  1. #1
    Join Date
    Sep 2010
    Location
    Germany
    Posts
    7
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Leaving an empty space around a widget

    Hello everyone,

    i'm having a problem with a 2x2 GridLayout. In it, i aligned 4 Lables. They all have the fixed size of 200x200 Pixels. On click i want to draw a QFrame around them, what works well because i fixed the maximum size to 200x200 pixels. That causes the Frame to be drawn on the edges of the Widgets. But as soon as the frame is drawn, the pic shifts to the right what looks pretty ugly. Is there a way to tell Qt that he should not move the picture itself but just to draw the frame on the given image?

    Here is the code where i draw the frame around the Label.

    Qt Code:
    1. (....)
    2. QPalette p = sender->palette();
    3. p.setColor(foregroundRole(), QColor(255,100,0));
    4. sender->setMaximumSize(200,200); // [COLOR="red"]the size of the Pixmap[/COLOR]
    5. sender->setPalette(p);
    6. sender->setFrameStyle(QFrame::Box | QFrame::Plain);
    7. sender->setLineWidth(6);
    8. (...)
    To copy to clipboard, switch view to plain text mode 

    Thanks in advance!

  2. #2
    Join Date
    Sep 2010
    Location
    Germany
    Posts
    7
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Leaving an empty space around a widget

    Maybe it hasn't become clear at all. In the attachments you can now find the inactive, non-selected button and the one where a orange frame is drawn around. As you can see the picture is slightly shifted to the right.

    I hope it has become clearer.
    Thanks!
    Attached Images Attached Images
    boredom is the reflex to the objective grey

Similar Threads

  1. QTableView empty space or too little space.
    By davemar in forum Qt Programming
    Replies: 2
    Last Post: 16th October 2009, 16:00
  2. Getting an item from an empty table widget
    By ProTonS in forum Qt Programming
    Replies: 2
    Last Post: 13th July 2009, 02:24
  3. empty space in QGridLayout
    By eleanor in forum Qt Programming
    Replies: 1
    Last Post: 4th July 2008, 09:36
  4. Replies: 4
    Last Post: 3rd March 2008, 22:15
  5. QTableWidget click in empty space results in error?
    By Giel Peters in forum Qt Programming
    Replies: 4
    Last Post: 21st January 2006, 00:07

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.