Results 1 to 2 of 2

Thread: Why?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Why?

    Error Hint :"Attempting to add QLayout "" to QFrame "WelcomePage", which already has a layout."
    Qt Code:
    1. int
    2. main (int argc, char *argv[])
    3. {
    4. QApplication app (argc, argv);
    5. Q_INIT_RESOURCE (InstallerForQt4);
    6.  
    7. QDialog dlg;
    8. UiInstallerDlg uidlg;
    9. uidlg.setupUi (&dlg);
    10. WelcomePage wp;
    11. wp.setupUi (uidlg.m_PageFrame);
    12. uidlg.m_PageFrame->adjustSize();
    13.  
    14.  
    15. dlg.show ();
    16. return app.exec ();
    17. }
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. //WelcomePage.h
    2. .................
    3. {
    4. public:
    5. .........
    6.  
    7. void setupUi(QWidget *WelcomePage)
    8. {
    9. WelcomePage->setObjectName(QString::fromUtf8("WelcomePage"));
    10. WelcomePage->resize(QSize(755, 454).expandedTo(WelcomePage->minimumSizeHint()));//??Why useless
    11. WelcomePage->setMinimumSize(QSize(755, 454));//??Why useless
    12. WelcomePage->setMaximumSize(QSize(755, 454));//??Why useless
    13.  
    14. hboxLayout = new QHBoxLayout(WelcomePage);
    15. hboxLayout->setSpacing(0);
    16. hboxLayout->setMargin(0);
    17. hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
    18. hboxLayout1 = new QHBoxLayout();
    19. hboxLayout1->setSpacing(0);
    20. hboxLayout1->setMargin(0);
    21. hboxLayout1->setObjectName(QString::fromUtf8("hboxLayout1"));
    22. frame_2 = new QFrame(WelcomePage);
    23. frame_2->setObjectName(QString::fromUtf8("frame_2"));
    24. frame_2->setMaximumSize(QSize(260, 16777215));
    25. frame_2->setFrameShape(QFrame::StyledPanel);
    26. frame_2->setFrameShadow(QFrame::Raised);
    27. label = new QLabel(frame_2);
    28. label->setObjectName(QString::fromUtf8("label"));
    29. label->setGeometry(QRect(20, 30, 201, 41));
    30.  
    31. hboxLayout1->addWidget(frame_2);
    32.  
    33. line = new QFrame(WelcomePage);
    34. line->setObjectName(QString::fromUtf8("line"));
    35. line->setFrameShape(QFrame::VLine);
    36.  
    37. hboxLayout1->addWidget(line);
    38.  
    39. frame = new QFrame(WelcomePage);
    40. frame->setObjectName(QString::fromUtf8("frame"));
    41. frame->setFrameShape(QFrame::StyledPanel);
    42. frame->setFrameShadow(QFrame::Raised);
    43.  
    44. hboxLayout1->addWidget(frame);
    45.  
    46. hboxLayout->addLayout(hboxLayout1);
    47.  
    48. retranslateUi(WelcomePage);
    49.  
    50. QMetaObject::connectSlotsByName(WelcomePage);
    51. } // setupUi
    52.  
    53. void retranslateUi(QWidget *WelcomePage)
    54. {
    55. ...
    56. ...
    57. ...
    58. } // retranslateUi
    59.  
    60. };
    61.  
    62. namespace Ui {
    63. class WelcomePage: public Ui_WelcomePage {};
    64. } // namespace Ui
    65.  
    66. #endif // WELCOMEPAGE_H
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. //UiInstallerDlg.h
    2. #ifndef UIINSTALLERDLG_H
    3. #define UIINSTALLERDLG_H
    4. #include <...>
    5.  
    6. class Ui_UiInstallerDlg
    7. {
    8. ...................
    9.  
    10. void setupUi(QDialog *UiInstallerDlg)
    11. {
    12. UiInstallerDlg->setObjectName(QString::fromUtf8("UiInstallerDlg"));
    13. UiInstallerDlg->resize(QSize(755, 580).expandedTo(UiInstallerDlg->minimumSizeHint()));
    14. UiInstallerDlg->setMinimumSize(QSize(755, 580));
    15. UiInstallerDlg->setMaximumSize(QSize(755, 580));
    16. UiInstallerDlg->setBaseSize(QSize(755, 580));
    17. label = new QLabel(UiInstallerDlg);
    18. label->setObjectName(QString::fromUtf8("label"));
    19.  
    20. line_2 = new QFrame(UiInstallerDlg);
    21. line_2->setObjectName(QString::fromUtf8("line_2"));
    22. line_2->setGeometry(QRect(1, 518, 753, 16));
    23. line_2->setFrameShape(QFrame::HLine);
    24. m_PageFrame = new QFrame(UiInstallerDlg);
    25. m_PageFrame->setObjectName(QString::fromUtf8("m_PageFrame"));
    26. m_PageFrame->setGeometry(QRect(1, 64, 755, 454));
    27.  
    28. m_PageFrame->setFrameShadow(QFrame::Raised);
    29. gridLayout = new QGridLayout(m_PageFrame);
    30. gridLayout->setSpacing(0);
    31. gridLayout->setMargin(0);
    32. gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
    33. frame = new QFrame(UiInstallerDlg);
    34. frame->setObjectName(QString::fromUtf8("frame"));
    35. frame->setGeometry(QRect(1, 521, 755, 58));
    36. frame->setFrameShape(QFrame::NoFrame);
    37. frame->setFrameShadow(QFrame::Raised);
    38. hboxLayout = new QHBoxLayout(frame);
    39. hboxLayout->setSpacing(0);
    40. hboxLayout->setMargin(2);
    41. hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
    42. hboxLayout1 = new QHBoxLayout();
    43. hboxLayout1->setSpacing(0);
    44. hboxLayout1->setMargin(4);
    45. hboxLayout1->setObjectName(QString::fromUtf8("hboxLayout1"));
    46. progressBar = new QProgressBar(frame);
    47. progressBar->setObjectName(QString::fromUtf8("progressBar"));
    48. progressBar->setMaximumSize(QSize(16777215, 18));
    49.  
    50. progressBar->setValue(24);
    51.  
    52.  
    53. hboxLayout1->addWidget(progressBar);
    54.  
    55. spacerItem = new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Minimum);
    56.  
    57. hboxLayout1->addItem(spacerItem);
    58.  
    59. backBtn = new QPushButton(frame);
    60. backBtn->setObjectName(QString::fromUtf8("backBtn"));
    61. backBtn->setEnabled(false);
    62.  
    63. hboxLayout1->addWidget(backBtn);
    64.  
    65. nextBtn = new QPushButton(frame);
    66. nextBtn->setObjectName(QString::fromUtf8("nextBtn"));
    67. nextBtn->setEnabled(true);
    68. nextBtn->setAutoFillBackground(true);
    69.  
    70. hboxLayout1->addWidget(nextBtn);
    71.  
    72. cancelBtn = new QPushButton(frame);
    73. cancelBtn->setObjectName(QString::fromUtf8("cancelBtn"));
    74.  
    75. hboxLayout1->addWidget(cancelBtn);
    76.  
    77. spacerItem1 = new QSpacerItem(4, 2, QSizePolicy::Fixed, QSizePolicy::Minimum);
    78.  
    79. hboxLayout1->addItem(spacerItem1);
    80.  
    81.  
    82. hboxLayout->addLayout(hboxLayout1);
    83.  
    84. retranslateUi(UiInstallerDlg);
    85. QObject::connect(cancelBtn, SIGNAL(clicked()), UiInstallerDlg, SLOT(close()));
    86.  
    87. QMetaObject::connectSlotsByName(UiInstallerDlg);
    88. } // setupUi
    89.  
    90. void retranslateUi(QDialog *UiInstallerDlg)
    91. {
    92. ...
    93. ...
    94. ...
    95. } // retranslateUi
    96.  
    97. };
    98.  
    99. namespace Ui {
    100. class UiInstallerDlg: public Ui_UiInstallerDlg {};
    101. } // namespace Ui
    102.  
    103. #endif // UIINSTALLERDLG_H
    To copy to clipboard, switch view to plain text mode 
    Last edited by qintm; 29th March 2006 at 20:47.

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.