Results 1 to 7 of 7

Thread: Input text to be listed in listWidget?

  1. #1
    Join Date
    Sep 2016
    Location
    Central Europe
    Posts
    5
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11

    Default Input text to be listed in listWidget?

    Hi,

    I'm developing a GUI with Qt Designer version 4.8.6 on Gentoo Linux.
    I can't attach it's .ui file because it is to big:
    The following errors occurred:
    Win2008Serv_MPS3_DealOutCollect_001.ui: Your file of 49.7 KB bytes exceeds the forum's limit of 19.5 KB for this filetype.
    Win2008Serv_MPS3_DealOutCollect_001.jpg
    My question follows.
    Can I input text into 'Input names of Classes' that is lineEdit widget so so the entered names appeares immediately in the 'The entered names of Classes listed:' listWidget?
    Or maybe there is another way to input names and get listed?

    Best, Pal
    Last edited by csanyipal; 18th September 2016 at 20:10.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Input text to be listed in listWidget?

    You can easily connect the line edit's editingFinished() signal to a slot in your form class and then call the list widget's addItem() method with the text that is currently in the line edit.

    Cheers,
    _

  3. #3
    Join Date
    Sep 2016
    Location
    Central Europe
    Posts
    5
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11

    Default Re: Input text to be listed in listWidget?

    When in Edit Signals/Slots mode drag with mouse lineEdit to listWidget, then in Configure Connection dialog select editingFinished() signal from lineEdit, at right I have no addItem() slot at all.
    I can not understand your sentence: 'to a slot in your form class'. I can't find it on my GUI..
    Best, Pali

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Input text to be listed in listWidget?

    QListWidget::addItem() is not a slot, also QLineEdit::editingFinishied() doesn't have any arguments, so even if addItem() where a slot it wouldn't match argument-wise.

    In any case this is a signal/slot connection that requires code, i.e. the slot needs to be implemented in the class that uses the form's generated code.

    How did you start with the form? Did you use "New Form Class" in QtCreator?

    That should have created three files: a header, a C++ source file and them form's ui file.
    Your slot needs to be declared in the header and the body implemented in the C++ source file.
    The connection can be made in code in the constructor of that class after the form's components have been initialized.

    Cheers,
    _

  5. #5
    Join Date
    Sep 2016
    Location
    Central Europe
    Posts
    5
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11

    Default Re: Input text to be listed in listWidget?

    How did you start with the form? Did you use "New Form Class" in QtCreator?
    I used New Form / Main Window form:
    NewForm_MainWindow.png
    Best, Pali

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Input text to be listed in listWidget?

    [QUOTE=csanyipal;293770]I used New Form / Main Window form:
    Well, yes, that's in Designer.

    How did you launch it? Manually? From QtCreator?

    If you launched it manually, did you also create your project manually?
    If so, which files does that currently consist of?

    Cheers,
    _

  7. #7
    Join Date
    Sep 2016
    Location
    Central Europe
    Posts
    5
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11

    Default Re: Input text to be listed in listWidget?

    [QUOTE=anda_skoa;293788]
    Quote Originally Posted by csanyipal View Post
    I used New Form / Main Window form:
    Well, yes, that's in Designer.

    How did you launch it? Manually? From QtCreator?

    If you launched it manually, did you also create your project manually?
    If so, which files does that currently consist of?

    Cheers,
    _
    Yes, I'm using Qt Designer.
    I launched it manually.
    I have not created project so far.
    I started this project with designing GUI yet.

    But now I heared from you for Qt-creator. It is being installing now on my Gentoo system.

    So, probably I shall use Qt Creator to create this project again.

    Any advices will be appreciated!
    Best, Pali

Similar Threads

  1. Replies: 0
    Last Post: 14th April 2016, 11:56
  2. Replies: 0
    Last Post: 5th December 2013, 07:46
  3. Custom ListWidget(QCheckBox + Icon + Text)
    By nrabara in forum Newbie
    Replies: 6
    Last Post: 13th May 2010, 07:35
  4. Text Alignment in a ListWidget
    By Krish_ng in forum Qt Programming
    Replies: 2
    Last Post: 21st July 2007, 03:19
  5. Rightjustify text in listwidget
    By Morea in forum Qt Programming
    Replies: 1
    Last Post: 24th March 2006, 11:17

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.