Results 1 to 2 of 2

Thread: Checkable QLineEdit ?

  1. #1
    Join Date
    Feb 2009
    Posts
    79
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Checkable QLineEdit ?

    Hi!

    I need to have a QLineEdit which has a checkbox besides (left) it.

    So what I'd like is something like a QCheckBox, but instead the label, a line edit should be shown.

    I already tried something like
    Qt Code:
    1. QCheckbox * c =new QCheckBox("");
    2. QLineEdit * le = new QLineEdit;
    3. le->setParent(c);
    To copy to clipboard, switch view to plain text mode 
    But then only the line edit is shown.

    Also I don't know how to handle the lineedit, when subclassing QCheckBox

    Qt Code:
    1. class CheckableLineEdit : public QCheckBox
    2. {
    3. CheckableLineEdit(QWidget * p)
    4. : QCheckBox("", p)
    5. {
    6. //how can I set the lineedit as "content" instead of the label?
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 
    I do not want a checkbox inside the line edit, eg. like the delete buttons (I think in wxwidgets).


    Thanks in advance!
    Olli

  2. #2
    Join Date
    Feb 2009
    Posts
    79
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Checkable QLineEdit ?

    Ah, forget my question.
    [done]

    HBoxLayout * lay = new HBoxLayout;
    lay->add(new QCheckBox)
    lay->add(new QLineEdit)
    QWidget * w = new QWidget;
    w->setLayout(lay)

Similar Threads

  1. editingFinished of QLineEdit
    By weixj2003ld in forum Qt Programming
    Replies: 1
    Last Post: 3rd November 2009, 09:06
  2. Replies: 10
    Last Post: 12th February 2009, 07:23
  3. QLineEdit
    By rick_st3 in forum Newbie
    Replies: 1
    Last Post: 14th June 2008, 09:05
  4. Pointer Question related to QLineEdit
    By ChrisReath in forum Qt Programming
    Replies: 1
    Last Post: 23rd May 2008, 15:13
  5. QValidator, regular expressions and QLineEdit
    By hvengel in forum Qt Programming
    Replies: 1
    Last Post: 8th August 2007, 01:25

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.