Results 1 to 4 of 4

Thread: button on form doesn't appear at run

  1. #1
    Join Date
    Apr 2012
    Location
    Romania
    Posts
    22
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default button on form doesn't appear at run

    I have a really strange problem with an application on which I work. I've created a small GUI application for some of my needs on Qt 4.xx (I don't remember the exact version). After that I took the source and tried to make it to run on Qt 5.4.0 which I did. The problem is that, now, on Qt 5.4.0, I added two buttons on the form and when I press to Run the application I don't have the new button added. What could be the problem? I tried to check the files from my application if there is anything different and I didn't find anything, , I cleaned+run qmake+build the application a couple of times and nothing. Here is my xml version of the form file:

    Qt Code:
    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <ui version="4.0">
    3. <class>MainWindow</class>
    4. <widget class="QMainWindow" name="MainWindow">
    5. <property name="geometry">
    6. <rect>
    7. <x>0</x>
    8. <y>0</y>
    9. <width>755</width>
    10. <height>521</height>
    11. </rect>
    12. </property>
    13. <property name="windowTitle">
    14. <string>MainWindow</string>
    15. </property>
    16. <property name="windowIcon">
    17. <iconset>
    18. <normaloff>../../Documente/icon.png</normaloff>../../Documente/icon.png</iconset>
    19. </property>
    20. <widget class="QWidget" name="centralWidget">
    21. <widget class="QLabel" name="label">
    22. <property name="geometry">
    23. <rect>
    24. <x>170</x>
    25. <y>40</y>
    26. <width>41</width>
    27. <height>16</height>
    28. </rect>
    29. </property>
    30. <property name="text">
    31. <string>Site:</string>
    32. </property>
    33. </widget>
    34. <widget class="QLabel" name="label_2">
    35. <property name="geometry">
    36. <rect>
    37. <x>170</x>
    38. <y>80</y>
    39. <width>81</width>
    40. <height>16</height>
    41. </rect>
    42. </property>
    43. <property name="text">
    44. <string>Identitate:</string>
    45. </property>
    46. </widget>
    47. <widget class="QLabel" name="label_3">
    48. <property name="geometry">
    49. <rect>
    50. <x>170</x>
    51. <y>120</y>
    52. <width>51</width>
    53. <height>16</height>
    54. </rect>
    55. </property>
    56. <property name="text">
    57. <string>Parolă:</string>
    58. </property>
    59. </widget>
    60. <widget class="QLineEdit" name="lineEdit">
    61. <property name="geometry">
    62. <rect>
    63. <x>250</x>
    64. <y>40</y>
    65. <width>281</width>
    66. <height>31</height>
    67. </rect>
    68. </property>
    69. </widget>
    70. <widget class="QLineEdit" name="lineEdit_2">
    71. <property name="geometry">
    72. <rect>
    73. <x>250</x>
    74. <y>80</y>
    75. <width>281</width>
    76. <height>31</height>
    77. </rect>
    78. </property>
    79. </widget>
    80. <widget class="QLineEdit" name="lineEdit_3">
    81. <property name="geometry">
    82. <rect>
    83. <x>250</x>
    84. <y>120</y>
    85. <width>281</width>
    86. <height>31</height>
    87. </rect>
    88. </property>
    89. </widget>
    90. <widget class="QGroupBox" name="groupBox">
    91. <property name="geometry">
    92. <rect>
    93. <x>140</x>
    94. <y>10</y>
    95. <width>411</width>
    96. <height>221</height>
    97. </rect>
    98. </property>
    99. <property name="title">
    100. <string>Adăugare înregistrare</string>
    101. </property>
    102. <widget class="QPushButton" name="pushButton">
    103. <property name="geometry">
    104. <rect>
    105. <x>160</x>
    106. <y>190</y>
    107. <width>75</width>
    108. <height>23</height>
    109. </rect>
    110. </property>
    111. <property name="text">
    112. <string>Adaugă</string>
    113. </property>
    114. </widget>
    115. </widget>
    116. <widget class="QLabel" name="label_4">
    117. <property name="geometry">
    118. <rect>
    119. <x>170</x>
    120. <y>270</y>
    121. <width>31</width>
    122. <height>16</height>
    123. </rect>
    124. </property>
    125. <property name="text">
    126. <string>Site:</string>
    127. </property>
    128. </widget>
    129. <widget class="QLabel" name="label_5">
    130. <property name="geometry">
    131. <rect>
    132. <x>170</x>
    133. <y>310</y>
    134. <width>81</width>
    135. <height>16</height>
    136. </rect>
    137. </property>
    138. <property name="text">
    139. <string>Identitate:</string>
    140. </property>
    141. </widget>
    142. <widget class="QLineEdit" name="lineEdit_4">
    143. <property name="geometry">
    144. <rect>
    145. <x>250</x>
    146. <y>310</y>
    147. <width>281</width>
    148. <height>31</height>
    149. </rect>
    150. </property>
    151. </widget>
    152. <widget class="QLineEdit" name="lineEdit_5">
    153. <property name="geometry">
    154. <rect>
    155. <x>250</x>
    156. <y>350</y>
    157. <width>281</width>
    158. <height>31</height>
    159. </rect>
    160. </property>
    161. </widget>
    162. <widget class="QLabel" name="label_6">
    163. <property name="geometry">
    164. <rect>
    165. <x>170</x>
    166. <y>350</y>
    167. <width>61</width>
    168. <height>16</height>
    169. </rect>
    170. </property>
    171. <property name="text">
    172. <string>Parolă:</string>
    173. </property>
    174. </widget>
    175. <widget class="QComboBox" name="comboBox">
    176. <property name="geometry">
    177. <rect>
    178. <x>250</x>
    179. <y>270</y>
    180. <width>281</width>
    181. <height>31</height>
    182. </rect>
    183. </property>
    184. <property name="editable">
    185. <bool>true</bool>
    186. </property>
    187. <item>
    188. <property name="text">
    189. <string>Alege...</string>
    190. </property>
    191. </item>
    192. </widget>
    193. <widget class="QPushButton" name="pushButton_3">
    194. <property name="geometry">
    195. <rect>
    196. <x>420</x>
    197. <y>430</y>
    198. <width>75</width>
    199. <height>23</height>
    200. </rect>
    201. </property>
    202. <property name="text">
    203. <string>Modifică</string>
    204. </property>
    205. </widget>
    206. <widget class="QPushButton" name="pushButton_2">
    207. <property name="geometry">
    208. <rect>
    209. <x>260</x>
    210. <y>430</y>
    211. <width>75</width>
    212. <height>23</height>
    213. </rect>
    214. </property>
    215. <property name="text">
    216. <string>Șterge</string>
    217. </property>
    218. </widget>
    219. <widget class="QGroupBox" name="groupBox_2">
    220. <property name="geometry">
    221. <rect>
    222. <x>130</x>
    223. <y>240</y>
    224. <width>431</width>
    225. <height>231</height>
    226. </rect>
    227. </property>
    228. <property name="title">
    229. <string>Căutare înregistrare</string>
    230. </property>
    231. </widget>
    232. <widget class="QLineEdit" name="lineEdit_6">
    233. <property name="geometry">
    234. <rect>
    235. <x>250</x>
    236. <y>160</y>
    237. <width>281</width>
    238. <height>31</height>
    239. </rect>
    240. </property>
    241. </widget>
    242. <widget class="QLabel" name="label_7">
    243. <property name="geometry">
    244. <rect>
    245. <x>170</x>
    246. <y>160</y>
    247. <width>51</width>
    248. <height>16</height>
    249. </rect>
    250. </property>
    251. <property name="text">
    252. <string>E-mail:</string>
    253. </property>
    254. </widget>
    255. <widget class="QLabel" name="label_8">
    256. <property name="geometry">
    257. <rect>
    258. <x>170</x>
    259. <y>390</y>
    260. <width>51</width>
    261. <height>16</height>
    262. </rect>
    263. </property>
    264. <property name="text">
    265. <string>E-mail:</string>
    266. </property>
    267. </widget>
    268. <widget class="QLineEdit" name="lineEdit_7">
    269. <property name="geometry">
    270. <rect>
    271. <x>250</x>
    272. <y>390</y>
    273. <width>281</width>
    274. <height>31</height>
    275. </rect>
    276. </property>
    277. </widget>
    278. <widget class="QPushButton" name="pushButton_4">
    279. <property name="geometry">
    280. <rect>
    281. <x>650</x>
    282. <y>50</y>
    283. <width>75</width>
    284. <height>23</height>
    285. </rect>
    286. </property>
    287. <property name="text">
    288. <string>Exportă</string>
    289. </property>
    290. </widget>
    291. <widget class="QPushButton" name="pushButton_5">
    292. <property name="geometry">
    293. <rect>
    294. <x>650</x>
    295. <y>100</y>
    296. <width>75</width>
    297. <height>23</height>
    298. </rect>
    299. </property>
    300. <property name="text">
    301. <string>Importă</string>
    302. </property>
    303. </widget>
    304. <zorder>groupBox_2</zorder>
    305. <zorder>groupBox</zorder>
    306. <zorder>label</zorder>
    307. <zorder>label_2</zorder>
    308. <zorder>label_3</zorder>
    309. <zorder>lineEdit</zorder>
    310. <zorder>lineEdit_2</zorder>
    311. <zorder>lineEdit_3</zorder>
    312. <zorder>label_4</zorder>
    313. <zorder>label_5</zorder>
    314. <zorder>lineEdit_4</zorder>
    315. <zorder>lineEdit_5</zorder>
    316. <zorder>label_6</zorder>
    317. <zorder>comboBox</zorder>
    318. <zorder>pushButton_3</zorder>
    319. <zorder>pushButton_2</zorder>
    320. <zorder>lineEdit_6</zorder>
    321. <zorder>label_7</zorder>
    322. <zorder>label_8</zorder>
    323. <zorder>lineEdit_7</zorder>
    324. <zorder>pushButton_4</zorder>
    325. <zorder>pushButton_5</zorder>
    326. </widget>
    327. <widget class="QMenuBar" name="menuBar">
    328. <property name="geometry">
    329. <rect>
    330. <x>0</x>
    331. <y>0</y>
    332. <width>755</width>
    333. <height>21</height>
    334. </rect>
    335. </property>
    336. </widget>
    337. <widget class="QToolBar" name="mainToolBar">
    338. <attribute name="toolBarArea">
    339. <enum>TopToolBarArea</enum>
    340. </attribute>
    341. <attribute name="toolBarBreak">
    342. <bool>false</bool>
    343. </attribute>
    344. </widget>
    345. <widget class="QStatusBar" name="statusBar"/>
    346. </widget>
    347. <layoutdefault spacing="6" margin="11"/>
    348. <resources/>
    349. <connections/>
    350. </ui>
    To copy to clipboard, switch view to plain text mode 

    Anyone has any idea why it is not working and what can I do to fix it?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,022
    Thanks
    280
    Thanked 818 Times in 807 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: button on form doesn't appear at run

    Are you sure your configuration actually includes the new .ui file, or is it accidentally pointing to the old one? If you are sure the updated file is the one being included in your project, I would suggest going in and manually deleting the generated files (moc_*.cpp and ui_*.h) from the build location, then rebuild.

    Why aren't you using a layout on your central widget? You have everything positioned to absolute locations and sizes. If the project is configured correctly, then that might be the source of your problem.

  3. #3
    Join Date
    Apr 2012
    Location
    Romania
    Posts
    22
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: button on form doesn't appear at run

    Apparently the problem was with my ui_*.h file. I don't know what I did when I exported the file in a newer version of Qt but when I added the new objects, they didn't add in the ui_*.h file. Once I added those objects in my ui_*.h file manually everything works.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,734
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: button on form doesn't appear at run

    Then your.ui file is not listed in the pro file FORMS variable, or the time stamps are inconsistent on your files.
    You never edit the ui_*.h files directly, they are generated from the .ui file.

Similar Threads

  1. Load one form on button click
    By vinithr in forum Newbie
    Replies: 2
    Last Post: 16th April 2012, 17:47
  2. How can i expand a form with a push button?
    By Bong.Da.City in forum Qt Programming
    Replies: 4
    Last Post: 25th August 2010, 07:10
  3. Form with default button
    By miraks in forum Qt Programming
    Replies: 7
    Last Post: 25th January 2010, 15:50
  4. Replies: 10
    Last Post: 6th July 2008, 09:46
  5. Message on close(x) button of Form
    By vishal.chauhan in forum Qt Programming
    Replies: 3
    Last Post: 29th January 2007, 09:39

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.