Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to delete the space int QLineEdit
QtWS25 Last Chance

How to delete the space int QLineEdit

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 880 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • qazaq408Q Offline
    qazaq408Q Offline
    qazaq408
    wrote on last edited by qazaq408
    #1
    Now I'm makeing a programme,this APP look likes a picture,and I can write a note in any place of this picture.for this ,
    

    Iput a QLineEdit on an area where I need note.when I finish note,I hide the QLineEdit,and put a QLabel in sane area,
    the code looks like this

    currentPoint = edits->pos();
    edits->hide();
    labels->moving(currentPoint);
    labels->setText(edits->text());
    

    But there is a question,when the QLabel replace theQLineEdit,the QLabel always moving a little distance to top left corner.Someone tell me,the text of QLabel always appear up against the top of QLabel,but there is a little space between the text of QLineEdit and the top of QLineEdit.
    alt text
    the red line.....

    I try the funtion

    setTextMaria();
    setAlignment();
    

    But they all can't remove this space....

    At last,I only find a way in QPoinf.

    const int MOVINGDIS = 2;
    currentPoint,setX(curentPoint.x() + MOVINGDIS);
    .
    .
    

    After I change the point,the (text of)QLabel and (text of) QLineEdit will display the same place.But this will cause another question,for get the right point ,I use the fixed value(MOVINGDIS),this APP will run in different Embedded system,I can't sure this value will make the APP work on every system.

    1. How can I delete the space.
      2.If can't,the space of QLineEdit(it's wide) is a fixed value or not?
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      How are you positioning your widgets ?

      What about using QStackedLayout ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved