uwerat / qskinny

A lightweight framework on top of the Qt scene graph and only few classes from Qt/Quick. It is usable from C++ and/or QML.
1.45k stars 293 forks source link

dialog has a problem #419

Closed hestrro closed 2 months ago

hestrro commented 2 months ago

The select function of the pop-up box does not return the selected content, but returns an empty string. You can solve this problem by modifying the return values ​​of selectedEntry of QskSelectionWindow and QskSelectionsubWindow, and the qskselectsubwindow and qskselectwindow functions of QskDailog. dialog.docx

uwerat commented 2 months ago

The intention of the implementation is: QskDialog::select returns the selected string only when being accepted. Otherwise it returns an empty string.

Is this issue a bug report ( = it is not working that way ) or a change request ( = the selected string should always be returned ) ?

hestrro commented 2 months ago

The problem is that when I open the dialog, I select a line of content and click OK, but an empty string is returned. Also when I connect the signal auto diawin= new QskSelectionSubWindow(this); diawin->setEntries(entries);//设置内容 diawin->setTitle("select");//设置标题 diawin->setModal(true);//设置模态

                     connect(diawin,&QskSelectionSubWindow::selectedRowChanged,[=](int value)
                              {
                         qDebug()<<"选中文本"<<diawin->selectedEntry();
                         qDebug()<<"选中行数"<<diawin->selectedRow();
                      });

                     connect(diawin,&QskSelectionSubWindow::selectedEntryChanged,[](QString value)
                             {
                                 qDebug()<<value;
                             });
                     connect(diawin,&QskSelectionSubWindow::entriesChanged,[]()
                             {
                                 qDebug()<<"内容改变";
                             });
                     diawin->exec();//弹出窗口

The printed output is still an empty string

hestrro commented 2 months ago

QString QskSelectionSubWindow::selectedEntry() const { if ( auto listBox = qskListBox( this ) ) listBox->selectedEntry();

return QString();

}

You can find that you do not return listBox->selectedEntry();

uwerat commented 2 months ago

Of course - the return was missing. Fixed, thanks for reporting.