Results 1 to 20 of 21

Thread: QT VS C++ 2005, QPushButton NOT FIRING!!!!!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Jun 2010
    Posts
    41
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT VS C++ 2005, QPushButton NOT FIRING!!!!!

    Haha sorry about the yelling :P

    I think I have them initialized, I am in MSVS 2005 and I have the qt Addin. I will show my .ui and the header it generates, that header is where I think everything is being initailized.

    xml Code:
    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <ui version="4.0">
    3. <class>TheWGEClass</class>
    4. <widget class="QMainWindow" name="TheWGEClass">
    5. <property name="geometry">
    6. <rect>
    7. <x>0</x>
    8. <y>0</y>
    9. <width>649</width>
    10. <height>348</height>
    11. </rect>
    12. </property>
    13. <property name="sizePolicy">
    14. <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
    15. <horstretch>0</horstretch>
    16. <verstretch>0</verstretch>
    17. </sizepolicy>
    18. </property>
    19. <property name="minimumSize">
    20. <size>
    21. <width>649</width>
    22. <height>348</height>
    23. </size>
    24. </property>
    25. <property name="maximumSize">
    26. <size>
    27. <width>649</width>
    28. <height>348</height>
    29. </size>
    30. </property>
    31. <property name="windowTitle">
    32. <string>TheWGE Anti-Cheat Client</string>
    33. </property>
    34. <property name="styleSheet">
    35. <string notr="true">background-image: url(:/TheWGE/gamers.PNG)</string>
    36. </property>
    37. <widget class="QWidget" name="centralWidget">
    38. <widget class="QLineEdit" name="usrLineEdit">
    39. <property name="geometry">
    40. <rect>
    41. <x>270</x>
    42. <y>200</y>
    43. <width>170</width>
    44. <height>29</height>
    45. </rect>
    46. </property>
    47. <property name="maximumSize">
    48. <size>
    49. <width>170</width>
    50. <height>29</height>
    51. </size>
    52. </property>
    53. <property name="styleSheet">
    54. <string notr="true">background-image: url(:/TheWGE/textbox.PNG);
    55. color: rgb(255, 255, 255);</string>
    56. </property>
    57. <property name="maxLength">
    58. <number>40</number>
    59. </property>
    60. <property name="frame">
    61. <bool>false</bool>
    62. </property>
    63. </widget>
    64. <widget class="QLineEdit" name="pwdLineEdit">
    65. <property name="geometry">
    66. <rect>
    67. <x>270</x>
    68. <y>230</y>
    69. <width>170</width>
    70. <height>29</height>
    71. </rect>
    72. </property>
    73. <property name="maximumSize">
    74. <size>
    75. <width>170</width>
    76. <height>29</height>
    77. </size>
    78. </property>
    79. <property name="styleSheet">
    80. <string notr="true">background-image: url(:/TheWGE/textbox.PNG);
    81. color: rgb(255, 255, 255);</string>
    82. </property>
    83. <property name="frame">
    84. <bool>false</bool>
    85. </property>
    86. </widget>
    87. <widget class="QPushButton" name="LoginBtn">
    88. <property name="geometry">
    89. <rect>
    90. <x>350</x>
    91. <y>270</y>
    92. <width>90</width>
    93. <height>31</height>
    94. </rect>
    95. </property>
    96. <property name="styleSheet">
    97. <string notr="true">background-image: url(:/TheWGE/login.PNG)</string>
    98. </property>
    99. <property name="text">
    100. <string/>
    101. </property>
    102. <property name="flat">
    103. <bool>true</bool>
    104. </property>
    105. </widget>
    106. </widget>
    107. </widget>
    108. <layoutdefault spacing="6" margin="11"/>
    109. <resources>
    110. <include location="thewge.qrc"/>
    111. </resources>
    112. <connections/>
    113. </ui>
    To copy to clipboard, switch view to plain text mode 



    and my generated header for the gui

    Qt Code:
    1. /********************************************************************************
    2. ** Form generated from reading UI file 'thewge.ui'
    3. **
    4. ** Created: Thu Jun 10 19:57:08 2010
    5. ** by: Qt User Interface Compiler version 4.6.2
    6. **
    7. ** WARNING! All changes made in this file will be lost when recompiling UI file!
    8. ********************************************************************************/
    9.  
    10. #ifndef UI_THEWGE_H
    11. #define UI_THEWGE_H
    12.  
    13. #include <QtCore/QVariant>
    14. #include <QtGui/QAction>
    15. #include <QtGui/QApplication>
    16. #include <QtGui/QButtonGroup>
    17. #include <QtGui/QHeaderView>
    18. #include <QtGui/QLineEdit>
    19. #include <QtGui/QMainWindow>
    20. #include <QtGui/QPushButton>
    21. #include <QtGui/QWidget>
    22.  
    23. QT_BEGIN_NAMESPACE
    24.  
    25. class Ui_TheWGEClass
    26. {
    27. public:
    28. QWidget *centralWidget;
    29. QLineEdit *usrLineEdit;
    30. QLineEdit *pwdLineEdit;
    31. QPushButton *LoginBtn;
    32.  
    33. void setupUi(QMainWindow *TheWGEClass)
    34. {
    35. if (TheWGEClass->objectName().isEmpty())
    36. TheWGEClass->setObjectName(QString::fromUtf8("TheWGEClass"));
    37. TheWGEClass->resize(649, 348);
    38. QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    39. sizePolicy.setHorizontalStretch(0);
    40. sizePolicy.setVerticalStretch(0);
    41. sizePolicy.setHeightForWidth(TheWGEClass->sizePolicy().hasHeightForWidth());
    42. TheWGEClass->setSizePolicy(sizePolicy);
    43. TheWGEClass->setMinimumSize(QSize(649, 348));
    44. TheWGEClass->setMaximumSize(QSize(649, 348));
    45. TheWGEClass->setStyleSheet(QString::fromUtf8("background-image: url(:/TheWGE/gamers.PNG)"));
    46. centralWidget = new QWidget(TheWGEClass);
    47. centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
    48. usrLineEdit = new QLineEdit(centralWidget);
    49. usrLineEdit->setObjectName(QString::fromUtf8("usrLineEdit"));
    50. usrLineEdit->setGeometry(QRect(270, 200, 170, 29));
    51. usrLineEdit->setMaximumSize(QSize(170, 29));
    52. usrLineEdit->setStyleSheet(QString::fromUtf8("background-image: url(:/TheWGE/textbox.PNG);\n"
    53. "color: rgb(255, 255, 255);"));
    54. usrLineEdit->setMaxLength(40);
    55. usrLineEdit->setFrame(false);
    56. pwdLineEdit = new QLineEdit(centralWidget);
    57. pwdLineEdit->setObjectName(QString::fromUtf8("pwdLineEdit"));
    58. pwdLineEdit->setGeometry(QRect(270, 230, 170, 29));
    59. pwdLineEdit->setMaximumSize(QSize(170, 29));
    60. pwdLineEdit->setStyleSheet(QString::fromUtf8("background-image: url(:/TheWGE/textbox.PNG);\n"
    61. "color: rgb(255, 255, 255);"));
    62. pwdLineEdit->setFrame(false);
    63. LoginBtn = new QPushButton(centralWidget);
    64. LoginBtn->setObjectName(QString::fromUtf8("LoginBtn"));
    65. LoginBtn->setGeometry(QRect(350, 270, 90, 31));
    66. LoginBtn->setStyleSheet(QString::fromUtf8("background-image: url(:/TheWGE/login.PNG)"));
    67. LoginBtn->setFlat(true);
    68. TheWGEClass->setCentralWidget(centralWidget);
    69.  
    70. retranslateUi(TheWGEClass);
    71. QObject::connect(LoginBtn, SIGNAL(clicked()), pwdLineEdit, SLOT(clear()));
    72.  
    73. QMetaObject::connectSlotsByName(TheWGEClass);
    74. } // setupUi
    75.  
    76. void retranslateUi(QMainWindow *TheWGEClass)
    77. {
    78. TheWGEClass->setWindowTitle(QApplication::translate("TheWGEClass", "TheWGE Anti-Cheat Client", 0, QApplication::UnicodeUTF8));
    79. LoginBtn->setText(QString());
    80. } // retranslateUi
    81.  
    82. };
    83.  
    84. namespace Ui {
    85. class TheWGEClass: public Ui_TheWGEClass {};
    86. } // namespace Ui
    87.  
    88. QT_END_NAMESPACE
    89.  
    90. #endif // UI_THEWGE_H
    To copy to clipboard, switch view to plain text mode 

    I thought by including the ui header and adding the slot would connect the 2 together. Its a new concept to me! if I am connecting controls or linking them but this is how I would think I would do that. The ui header is generated, so I could copy the code from there and paste it into a new file and add more info in there. I tried adding the connect using this from the UI header and it doesn't fire, like so.

    QObject::connect(LoginBtn, SIGNAL(clicked()), LoginBtn, SLOT(accept()));

    Thanks for your help!
    Last edited by wysota; 11th June 2010 at 21:34. Reason: changed [qtclass] to [code]

Similar Threads

  1. Replies: 0
    Last Post: 22nd February 2010, 09:30
  2. QSocketNotifier activated() not firing
    By jflatt in forum Qt Programming
    Replies: 1
    Last Post: 10th July 2009, 20:10
  3. Qt 4.3.2 with VS 2005 SP1
    By Shawn in forum Installation and Deployment
    Replies: 1
    Last Post: 12th October 2007, 07:04
  4. QT with visual c++ 2005
    By v3n0w in forum Installation and Deployment
    Replies: 5
    Last Post: 20th May 2007, 12:37
  5. Replies: 3
    Last Post: 26th September 2006, 12:16

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.