Why can't I modify old project's .ui file?
-
Hey guys i am beginner at Qt. Yesterday I downloaded a project from web which is working perfectly fine but when I try to modify its .ui file in Design Mode nothing shows up.
It's Everything that shows up.
What am I missing here?
Btw I am using latest version of qt in Windows and I am not quite sure what original creator used. -
Hi
Normally it's not an issue if the UI file is not ultra old.It might be broken.
Could you post it here ?or if really long then
https://paste.ofcode.org/THE UI file is an XML file so e can look in it and see.
-
@D_Sharad said in Why can't I modify old project's .ui file?:
nothing shows up.
"Nothing" is wrong here :)
You can see something in the top left corner... Don't know what this is, but looks like some widget...As @mrjj suggests, open the ui file with any texteditor, check what's inside and if it looks like XML. If not, it's probably broken.
-
@mrjj Thankyou for your reply.
It's
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="QRadioButton" name="radioButtonSimple">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>84</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Обычный</string>
</property>
</widget>
<widget class="QRadioButton" name="radioButtonCompl">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>105</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Инженерный</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>142</width>
<height>27</height>
</rect>
</property>
</widget>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>I got it from :https://github.com/Bychin/Qt-simple-calculator.git
-
@D_Sharad said in Why can't I modify old project's .ui file?:
<width>16</width>
<height>16</height>There you have it. The
mainWindow
in QtDesigner has a 16x16 geometry. And this is what you see at the top left (the square). It's just too small to see everything, but as soon as you run the program, it is set up correctlyMainWindow c'tor:
setMinimumSize(380, 450); setMaximumSize(380, 450);
The repo owner just threw all the widgets onto the mainWindow without any layout and size policies. The rest in done in code.
So nothing is broken. If you want to modify something, you probably have to do it in the code file, because the ui file does pretty much nothing, except holding the unorganized widgets (LineEdit and two RadioButtons)