Results 1 to 4 of 4

Thread: QLabel inside QTextEdit

  1. #1
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default QLabel inside QTextEdit

    Hi,

    As you can see from the sample.png attached, the notification label overlays the message box and this leads a problem that message can be read partially.

    I want that label to be always one line lower then the last message letter.

    To do so, I wrote something like the following;

    Qt Code:
    1. my_notification_label->move(0, my_text_edit->viewport()->height());
    To copy to clipboard, switch view to plain text mode 

    it puts the label to the right place once but it didn't move message size grows(or scroll bar appears).
    Attached Images Attached Images
    Last edited by zgulser; 23rd July 2012 at 09:21.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    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: QLabel inside QTextEdit

    You forgot to attach the screenshot. Anyway, you should probably use layouts for controlling the size and placement of widgets.
    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
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: QLabel inside QTextEdit

    Oh yeah,

    I just attached it.

    Anyway, you should probably use layouts for controlling the size and placement of widgets
    But the label should overlay the QTextEdit at the bottom. I suppose I need to apart the message text in another textfield and put it into the main text field together with notification label.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    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: QLabel inside QTextEdit

    Make the label a child of the text edit, set viewport margins on the bottom of the text edit and reimplement the resize event for the text edit to adjust the bottom margin of the viewport and position of the label.
    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. Replies: 4
    Last Post: 19th January 2012, 09:17
  2. Replies: 3
    Last Post: 19th October 2011, 12:41
  3. How to make QTextEdit to look like QLabel?
    By pielas in forum Qt Programming
    Replies: 17
    Last Post: 8th April 2010, 15:36
  4. Replies: 1
    Last Post: 23rd January 2010, 13:16
  5. rotate Qlabel inside a QPopupMenu
    By mickey in forum Newbie
    Replies: 7
    Last Post: 1st May 2006, 17:33

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.