Results 1 to 19 of 19

Thread: Text box and list box connectivity

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Jul 2006
    Posts
    18
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Text box and list box connectivity

    no its not wkg..
    i will add code what i had written again 4m starting
    /////////////////code/////////////////

    Qt Code:
    1. class Ui_Dialog
    2. {
    3. public:
    4. QWidget *layoutWidget;
    5. QHBoxLayout *hboxLayout;
    6. QPushButton *exit;
    7. QTextEdit *text2;
    8. QListWidget *list1;
    9. QTextEdit *text1;
    10. QPushButton *enter;
    11.  
    12. void setupUi(QDialog *Dialog)
    13. {
    14. Dialog->setObjectName(QString::fromUtf8("Dialog"));
    15. Dialog->resize(QSize(552, 555).expandedTo(Dialog->minimumSizeHint()));
    16. layoutWidget = new QWidget(Dialog);
    17. layoutWidget->setObjectName(QString::fromUtf8("layoutWidget"));
    18. layoutWidget->setGeometry(QRect(20, 430, 351, 38));
    19. hboxLayout = new QHBoxLayout(layoutWidget);
    20. hboxLayout->setSpacing(6);
    21. hboxLayout->setMargin(0);
    22. hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
    23. exit = new QPushButton(layoutWidget);
    24. exit->setObjectName(QString::fromUtf8("exit"));
    25.  
    26. hboxLayout->addWidget(exit);
    27.  
    28. text2 = new QTextEdit(Dialog);
    29. text2->setObjectName(QString::fromUtf8("text2"));
    30. text2->setGeometry(QRect(60, 220, 104, 52));
    31. list1 = new QListWidget(Dialog);
    32. list1->setObjectName(QString::fromUtf8("list1"));
    33. list1->setGeometry(QRect(380, 90, 120, 80));
    34. text1 = new QTextEdit(Dialog);
    35. text1->setObjectName(QString::fromUtf8("text1"));
    36. text1->setGeometry(QRect(60, 80, 104, 52));
    37. enter = new QPushButton(Dialog);
    38. enter->setObjectName(QString::fromUtf8("enter"));
    39. enter->setGeometry(QRect(210, 90, 108, 36));
    40. QWidget::setTabOrder(text1, enter);
    41. QWidget::setTabOrder(enter, list1);
    42. QWidget::setTabOrder(list1, text2);
    43. QWidget::setTabOrder(text2, exit);
    44. retranslateUi(Dialog);
    45. QObject::connect(exit, SIGNAL(clicked()), Dialog, SLOT(reject()));
    46. QObject::connect(enter, SIGNAL(clicked()), list1, SLOT(show()));
    47. QObject::connect(list1, SIGNAL(itemDoubleClicked(QListWidgetItem*)), text2, SLOT(copy()));
    48.  
    49. QMetaObject::connectSlotsByName(Dialog);
    50. } // setupUi
    51.  
    52. void retranslateUi(QDialog *Dialog)
    53. {
    54. Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", 0, QApplication::UnicodeUTF8));
    55. exit->setText(QApplication::translate("Dialog", "Exit", 0, QApplication::UnicodeUTF8));
    56. enter->setText(QApplication::translate("Dialog", "Enter", 0, QApplication::UnicodeUTF8));
    57. Q_UNUSED(Dialog);
    58. } // retranslateUi
    59.  
    60. void show()
    61. {
    62. QTextStream str,str2;
    63. str=text1.text();
    64. str1=length(str);
    65. list1.addItem(text1.toPlainText());
    66. for(int i=0;i<str1;i++)
    67. {
    68.  
    69. str2=insertText(list1.at(i));
    70.  
    71. i++;
    72. }
    73. display->setText(display->text()+str2);
    74. }
    75.  
    76.  
    77. };
    To copy to clipboard, switch view to plain text mode 


    The problem is in void show() ;
    Last edited by wysota; 25th July 2006 at 09:28. Reason: Added [code] tags

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
  •  
Qt is a trademark of The Qt Company.