PDA

View Full Version : button on form doesn't appear at run



Saurian
20th February 2015, 18:31
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:



<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>755</width>
<height>521</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>../../Documente/icon.png</normaloff>../../Documente/icon.png</iconset>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>170</x>
<y>40</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Site:</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>170</x>
<y>80</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Identitate:</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>170</x>
<y>120</y>
<width>51</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Parolă:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>250</x>
<y>40</y>
<width>281</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_2">
<property name="geometry">
<rect>
<x>250</x>
<y>80</y>
<width>281</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_3">
<property name="geometry">
<rect>
<x>250</x>
<y>120</y>
<width>281</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>140</x>
<y>10</y>
<width>411</width>
<height>221</height>
</rect>
</property>
<property name="title">
<string>Adăugare înregistrare</string>
</property>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>160</x>
<y>190</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Adaugă</string>
</property>
</widget>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>170</x>
<y>270</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Site:</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>170</x>
<y>310</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Identitate:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_4">
<property name="geometry">
<rect>
<x>250</x>
<y>310</y>
<width>281</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_5">
<property name="geometry">
<rect>
<x>250</x>
<y>350</y>
<width>281</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>170</x>
<y>350</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Parolă:</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox">
<property name="geometry">
<rect>
<x>250</x>
<y>270</y>
<width>281</width>
<height>31</height>
</rect>
</property>
<property name="editable">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>Alege...</string>
</property>
</item>
</widget>
<widget class="QPushButton" name="pushButton_3">
<property name="geometry">
<rect>
<x>420</x>
<y>430</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Modifică</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>260</x>
<y>430</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Șterge</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>130</x>
<y>240</y>
<width>431</width>
<height>231</height>
</rect>
</property>
<property name="title">
<string>Căutare înregistrare</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_6">
<property name="geometry">
<rect>
<x>250</x>
<y>160</y>
<width>281</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>170</x>
<y>160</y>
<width>51</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>E-mail:</string>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>170</x>
<y>390</y>
<width>51</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>E-mail:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_7">
<property name="geometry">
<rect>
<x>250</x>
<y>390</y>
<width>281</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_4">
<property name="geometry">
<rect>
<x>650</x>
<y>50</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Exportă</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_5">
<property name="geometry">
<rect>
<x>650</x>
<y>100</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Importă</string>
</property>
</widget>
<zorder>groupBox_2</zorder>
<zorder>groupBox</zorder>
<zorder>label</zorder>
<zorder>label_2</zorder>
<zorder>label_3</zorder>
<zorder>lineEdit</zorder>
<zorder>lineEdit_2</zorder>
<zorder>lineEdit_3</zorder>
<zorder>label_4</zorder>
<zorder>label_5</zorder>
<zorder>lineEdit_4</zorder>
<zorder>lineEdit_5</zorder>
<zorder>label_6</zorder>
<zorder>comboBox</zorder>
<zorder>pushButton_3</zorder>
<zorder>pushButton_2</zorder>
<zorder>lineEdit_6</zorder>
<zorder>label_7</zorder>
<zorder>label_8</zorder>
<zorder>lineEdit_7</zorder>
<zorder>pushButton_4</zorder>
<zorder>pushButton_5</zorder>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>755</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>


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

d_stranz
20th February 2015, 22:58
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.

Saurian
22nd February 2015, 12:32
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.

ChrisW67
22nd February 2015, 20:44
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.