Results 1 to 4 of 4

Thread: Layout (widget overlay)

  1. #1
    Join Date
    May 2006
    Posts
    108
    Thanks
    35
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question Layout (widget overlay)

    Hi,

    i would be cereate a dialog with the qt designer as the attached picture.

    The picture on the right side should be a QLabel with a QPixmap and the labels (diagonal, sideward, ahead,...) a QLabel. The labels must be a QLabe to translate the text. The left side should be build with a Line, QLabel and QPushButton.

    My problem is to create a layout with a widget overlay for the left and right side. Can you tell me how can i do that?

    Thanks in advance
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Layout (widget overlay)

    What widget overlay do you mean? For me it seems you need two completely custom widgets, without any labels - just drawing and 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. #3
    Join Date
    May 2006
    Posts
    108
    Thanks
    35
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question Re: Layout (widget overlay)

    On the right side i mean the overlay from the QLabels. I have attached an example. The green border is a QLabel with a QPixmap and the red border is a QLabel with text and this QLabel is over the other QLabel. On the left side all Lines are overlapping.

    Have i no chance to build the dialog with the designer and a QGridLayout. If you answer no, what is the common way to drawing the widget that can resize?
    Attached Images Attached Images

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Layout (widget overlay)

    It's not that you can't do it this way, but I really wouldn't advise it.

    I would compose your widget from two widgets - one for the left side and another one for the right side.

    The left side would be a customly drawn widget with either 9 push button widgets (without a layout, geometry controlled manually upon resizeEvent) or with using QStyle to draw the buttons (which would be very easy if you don't require things such as keyboard focus).

    The right side would also be a completely custom drawn widget. I don't see any advantage for using QLabels - all they would do is to substitute a single call to QPainter::drawText() and it would be much more work to set them up.
    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.


Similar Threads

  1. changing layout of a widget
    By mikro in forum Qt Programming
    Replies: 10
    Last Post: 4th August 2009, 20:21
  2. Replies: 1
    Last Post: 14th May 2009, 22:00
  3. Resize widget force layout resizing
    By ^NyAw^ in forum Qt Programming
    Replies: 17
    Last Post: 11th February 2009, 11:27
  4. Hide widget, but not change layout
    By dimaz in forum Qt Programming
    Replies: 3
    Last Post: 21st November 2008, 14:32
  5. resizing events of a custom widget in a layout
    By Rooster in forum Qt Programming
    Replies: 7
    Last Post: 16th February 2008, 10:52

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.