QT Emails input widget



  • I want input emails widget like on Google email or other emails service. For example:
    http://postimg.org/image/7pnb42gyj/

    I find the solution with qlistwidget with icons mode and qlineedit. I want to input to qline edit a text, and when i press enter a new emails from qlineedit sets to qlistwidget. But, qlineedit not showing in qlistwidget. How to fix it?

    qhbl = new QHBoxLayout();
    qlw = new QListWidget();
    qlw->setViewMode(QListWidget::IconMode);
    qlw->setMovement(QListWidget::Static);
    qlw->setResizeMode(QListWidget::Adjust);

    connect(qlw, SIGNAL(customContextMenuRequested(const QPoint &)),
             SLOT(showContextMenuForWidget(const QPoint &)));
    qlw->setContextMenuPolicy(Qt::CustomContextMenu);
    
    
    addNewElement("test111111111");
    addNewElement("test222222222");
    addNewElement("test3333");
    addNewElement("test4444");
    
    QListWidgetItem* qlwiItem1 = new QListWidgetItem("test!");
    QPushButton* test = new QPushButton();
    test->setText("pushbutton");
    qlw->addItem(qlwiItem1);
    
    
    QListWidgetItem* qlwiItem = new QListWidgetItem();
    qle = new QLineEdit();
    qle->setText("input");
    connect(qle, SIGNAL(returnPressed()), this, SLOT(addNewElement()));
    qle->setFixedWidth(100);
    qle->setMinimumWidth(90);
    qle->setMaximumWidth(110);
    qlw->addItem(qlwiItem);
    qlw->setItemWidget(qlwiItem, qle);
    qlw->setStyleSheet("QListWidgetItem {border:1px}");
    qhbl->addWidget(qlw);
    ui->centralWidget->setLayout(qhbl);


  • This post is deleted!

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.