Results 1 to 3 of 3

Thread: I got them dialog box doldrums

  1. #1
    Join Date
    Jan 2010
    Posts
    63
    Qt products
    Qt4
    Platforms
    Windows

    Default I got them dialog box doldrums

    Here is the code:
    Qt Code:
    1. [B]main.cpp[/B]
    2. #include <QApplication>
    3. #include <QDialog>
    4. #include "ui_gotocelldialog.h"
    5. int main(int argc, char *argv[])
    6. {
    7. QApplication app(argc, argv);
    8. Ui::GoToCellDialog ui;
    9. QDialog *dialog = new QDialog;
    10. ui.setupUi(dialog);
    11. dialog->show();
    12. return app.exec();
    13. }
    14.  
    15. [B]gotocelldialog.h[/B]
    16. #ifndef GOTOCELLDIALOG_H
    17. #define GOTOCELLDIALOG_H
    18. #include <QDialog>
    19. #include "ui_gotocelldialog.h"
    20. class GoToCellDialog : public QDialog, public Ui::GoToCellDialog
    21. {
    22. Q_OBJECT
    23. public:
    24. GoToCellDialog(QWidget *parent = 0);
    25. private slots:
    26. void on_lineEdit_textChanged();
    27. };
    28. #endif
    29.  
    30. [B]gotocelldialog.cpp[/B]
    31. #include <QtGui>
    32. #include "gotocelldialog.h"
    33. GoToCellDialog::GoToCellDialog(QWidget *parent)
    34. : QDialog(parent)
    35. {
    36. setupUi(this);
    37. QRegExp regExp("[A-Za-z][1-9][0-9]{0,2}");
    38. lineEdit->setValidator(new QRegExpValidator(regExp, this));
    39. connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
    40. connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
    41. }
    42.  
    43.  
    44. void GoToCellDialog::on_lineEdit_textChanged()
    45. {
    46. okButton->setEnabled(lineEdit->hasAcceptableInput());
    47. }
    48.  
    49.  
    50. Ui_GoToCellDialog.h
    51. #ifndef GOTOCELLDIALOGMO5700_H
    52. #define GOTOCELLDIALOGMO5700_H
    53.  
    54. #include <QtCore/QVariant>
    55. #include <QtGui/QAction>
    56. #include <QtGui/QApplication>
    57. #include <QtGui/QButtonGroup>
    58. #include <QtGui/QDialog>
    59. #include <QtGui/QHeaderView>
    60. #include <QtGui/QLabel>
    61. #include <QtGui/QLineEdit>
    62. #include <QtGui/QPushButton>
    63.  
    64. QT_BEGIN_NAMESPACE
    65.  
    66. class Ui_dialog
    67. {
    68. public:
    69. QLabel *label;
    70. QLineEdit *lineEdit;
    71. QPushButton *pushButton;
    72. QPushButton *pushButton_2;
    73.  
    74. void setupUi(QDialog *dialog)
    75. {
    76. if (dialog->objectName().isEmpty())
    77. dialog->setObjectName(QString::fromUtf8("dialog"));
    78. dialog->resize(354, 140);
    79. label = new QLabel(dialog);
    80. label->setObjectName(QString::fromUtf8("label"));
    81. label->setGeometry(QRect(30, 30, 71, 16));
    82. lineEdit = new QLineEdit(dialog);
    83. lineEdit->setObjectName(QString::fromUtf8("lineEdit"));
    84. lineEdit->setGeometry(QRect(100, 30, 211, 20));
    85. pushButton = new QPushButton(dialog);
    86. pushButton->setObjectName(QString::fromUtf8("pushButton"));
    87. pushButton->setGeometry(QRect(100, 100, 75, 23));
    88. pushButton_2 = new QPushButton(dialog);
    89. pushButton_2->setObjectName(QString::fromUtf8("pushButton_2"));
    90. pushButton_2->setGeometry(QRect(220, 100, 75, 23));
    91.  
    92. retranslateUi(dialog);
    93.  
    94. QMetaObject::connectSlotsByName(dialog);
    95. } // setupUi
    96.  
    97. void retranslateUi(QDialog *dialog)
    98. {
    99. dialog->setWindowTitle(QApplication::translate("dialog", "Dialog", 0, QApplication::UnicodeUTF8));
    100. label->setText(QApplication::translate("dialog", "Cell Number:", 0, QApplication::UnicodeUTF8));
    101. pushButton->setText(QApplication::translate("dialog", "ok", 0, QApplication::UnicodeUTF8));
    102. pushButton_2->setText(QApplication::translate("dialog", "Cancel", 0, QApplication::UnicodeUTF8));
    103. } // retranslateUi
    104.  
    105. };
    106.  
    107. namespace Ui {
    108. class dialog: public Ui_dialog {};
    109. } // namespace Ui
    110.  
    111. QT_END_NAMESPACE
    112.  
    113. #endif // GOTOCELLDIALOGMO5700_H
    To copy to clipboard, switch view to plain text mode 


    These are the errors I get
    main.cpp: In function 'int qMain(int, char**)':
    main.cpp:7: error: 'GoToCellDialog' is not a member of 'Ui'
    main.cpp:7: error: expected ';' before 'ui'
    main.cpp:9: error: 'ui' was not declared in this scope

    Help !













































    [/CODE]

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: I got them dialog box doldrums

    Looks like you named it "dialog", not "GoToCellDialog" (notice the objectName property in Designer).
    J-P Nurmi

  3. #3
    Join Date
    Jan 2010
    Posts
    63
    Qt products
    Qt4
    Platforms
    Windows

    Talking Re: I got them dialog box doldrums

    Problem solved....
    Last edited by Petr_Kropotkin; 17th January 2010 at 02:01. Reason: incomplete

Similar Threads

  1. How to blur parent dialog when child dialog is displayed
    By abhilashajha in forum Qt Programming
    Replies: 4
    Last Post: 10th June 2009, 13:01
  2. Dialog to Dialog communication
    By jjbabu in forum Qt Tools
    Replies: 1
    Last Post: 1st October 2008, 10:54
  3. call the other dialog through dialog
    By narumi in forum Qt Programming
    Replies: 2
    Last Post: 3rd September 2008, 09:30
  4. Dialog
    By gyre in forum Newbie
    Replies: 3
    Last Post: 21st November 2007, 21:39
  5. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 14:52

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.