LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-16-2005, 12:02 PM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Blog Entries: 1

Rep: Reputation: 90
Question kdevelop/qt questions


I'm starting to use kdevelop to see if we can use it as our IDE at the office.

As you might expect, I'm just fooling around to see what and how things get done.

I'm trying the "distance conversion" example that comes with the QT tutorial. I created the UI, but when I test it, or run the application, the layout of the objects doesn't change when I resize the frame. They just remain the same size and position. What am I missing?

This is the ui file content:
Code:
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>Conversion</class>
<widget class="QDialog">
    <property name="name">
        <cstring>Conversion</cstring>
    </property>
    <property name="geometry">
        <rect>
            <x>0</x>
            <y>0</y>
            <width>350</width>
            <height>228</height>
        </rect>
    </property>
    <property name="caption">
        <string>Conversión</string>
    </property>
    <spacer>
        <property name="name">
            <cstring>spacer2</cstring>
        </property>
        <property name="orientation">
            <enum>Vertical</enum>
        </property>
        <property name="sizeType">
            <enum>Expanding</enum>
        </property>
        <property name="sizeHint">
            <size>
                <width>20</width>
                <height>20</height>
            </size>
        </property>
        <property name="geometry">
            <rect>
                <x>170</x>
                <y>160</y>
                <width>20</width>
                <height>20</height>
            </rect>
        </property>
    </spacer>
    <widget class="QLayoutWidget">
        <property name="name">
            <cstring>layout3</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>10</x>
                <y>190</y>
                <width>330</width>
                <height>28</height>
            </rect>
        </property>
        <hbox>
            <property name="name">
                <cstring>unnamed</cstring>
            </property>
            <widget class="QPushButton">
                <property name="name">
                    <cstring>limpiar</cstring>
                </property>
                <property name="text">
                    <string>L&amp;impiar</string>
                </property>
                <property name="accel">
                    <string>Alt+I</string>
                </property>
            </widget>
            <widget class="QPushButton">
                <property name="name">
                    <cstring>calcular</cstring>
                </property>
                <property name="text">
                    <string>&amp;Calcular</string>
                </property>
                <property name="accel">
                    <string>Alt+C</string>
                </property>
            </widget>
            <spacer>
                <property name="name">
                    <cstring>spacer1</cstring>
                </property>
                <property name="orientation">
                    <enum>Horizontal</enum>
                </property>
                <property name="sizeType">
                    <enum>Expanding</enum>
                </property>
                <property name="sizeHint">
                    <size>
                        <width>40</width>
                        <height>20</height>
                    </size>
                </property>
            </spacer>
            <widget class="QPushButton">
                <property name="name">
                    <cstring>cerrar</cstring>
                </property>
                <property name="text">
                    <string>Cerrar</string>
                </property>
                <property name="accel">
                    <string></string>
                </property>
            </widget>
        </hbox>
    </widget>
    <widget class="QLayoutWidget">
        <property name="name">
            <cstring>layout4</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>11</x>
                <y>11</y>
                <width>330</width>
                <height>148</height>
            </rect>
        </property>
        <grid>
            <property name="name">
                <cstring>unnamed</cstring>
            </property>
            <widget class="QLineEdit" row="3" column="1">
                <property name="name">
                    <cstring>resultado</cstring>
                </property>
                <property name="readOnly">
                    <bool>true</bool>
                </property>
            </widget>
            <widget class="QLabel" row="0" column="0">
                <property name="name">
                    <cstring>textLabel1</cstring>
                </property>
                <property name="text">
                    <string>Distancia</string>
                </property>
            </widget>
            <widget class="QLineEdit" row="0" column="1">
                <property name="name">
                    <cstring>distancia</cstring>
                </property>
            </widget>
            <widget class="QComboBox" row="2" column="1">
                <item>
                    <property name="text">
                        <string>Millas</string>
                    </property>
                </item>
                <item>
                    <property name="text">
                        <string>Yardas</string>
                    </property>
                </item>
                <item>
                    <property name="text">
                        <string>Pies</string>
                    </property>
                </item>
                <item>
                    <property name="text">
                        <string>Pulgadas</string>
                    </property>
                </item>
                <property name="name">
                    <cstring>hacia</cstring>
                </property>
            </widget>
            <widget class="QLabel" row="2" column="0">
                <property name="name">
                    <cstring>textLabel2_2</cstring>
                </property>
                <property name="text">
                    <string>Llevar a</string>
                </property>
            </widget>
            <widget class="QLabel" row="3" column="0">
                <property name="name">
                    <cstring>textLabel3</cstring>
                </property>
                <property name="text">
                    <string>Resultado</string>
                </property>
            </widget>
            <widget class="QComboBox" row="1" column="1">
                <item>
                    <property name="text">
                        <string>Kms</string>
                    </property>
                </item>
                <item>
                    <property name="text">
                        <string>mts</string>
                    </property>
                </item>
                <item>
                    <property name="text">
                        <string>cms</string>
                    </property>
                </item>
                <item>
                    <property name="text">
                        <string>mms</string>
                    </property>
                </item>
                <property name="name">
                    <cstring>desde</cstring>
                </property>
            </widget>
            <widget class="QLabel" row="1" column="0">
                <property name="name">
                    <cstring>textLabel2</cstring>
                </property>
                <property name="text">
                    <string>Unidad Métrica</string>
                </property>
            </widget>
            <widget class="QLayoutWidget" row="4" column="1">
                <property name="name">
                    <cstring>layout1</cstring>
                </property>
                <hbox>
                    <property name="name">
                        <cstring>unnamed</cstring>
                    </property>
                    <spacer>
                        <property name="name">
                            <cstring>spacer3</cstring>
                        </property>
                        <property name="orientation">
                            <enum>Horizontal</enum>
                        </property>
                        <property name="sizeType">
                            <enum>Expanding</enum>
                        </property>
                        <property name="sizeHint">
                            <size>
                                <width>80</width>
                                <height>20</height>
                            </size>
                        </property>
                    </spacer>
                    <widget class="QSpinBox">
                        <property name="name">
                            <cstring>decimales</cstring>
                        </property>
                        <property name="maxValue">
                            <number>6</number>
                        </property>
                        <property name="value">
                            <number>3</number>
                        </property>
                    </widget>
                </hbox>
            </widget>
            <widget class="QLabel" row="4" column="0">
                <property name="name">
                    <cstring>textLabel4</cstring>
                </property>
                <property name="text">
                    <string>Decimales</string>
                </property>
            </widget>
        </grid>
    </widget>
</widget>
<connections>
    <connection>
        <sender>limpiar</sender>
        <signal>clicked()</signal>
        <receiver>resultado</receiver>
        <slot>clear()</slot>
    </connection>
    <connection>
        <sender>limpiar</sender>
        <signal>clicked()</signal>
        <receiver>distancia</receiver>
        <slot>clear()</slot>
    </connection>
    <connection>
        <sender>limpiar</sender>
        <signal>clicked()</signal>
        <receiver>distancia</receiver>
        <slot>setFocus()</slot>
    </connection>
    <connection>
        <sender>cerrar</sender>
        <signal>clicked()</signal>
        <receiver>Conversion</receiver>
        <slot>close()</slot>
    </connection>
    <connection>
        <sender>calcular</sender>
        <signal>clicked()</signal>
        <receiver>Conversion</receiver>
        <slot>slotCalcular()</slot>
    </connection>
    <connection>
        <sender>decimales</sender>
        <signal>valueChanged(int)</signal>
        <receiver>Conversion</receiver>
        <slot>slotCalcular()</slot>
    </connection>
    <connection>
        <sender>desde</sender>
        <signal>activated(int)</signal>
        <receiver>Conversion</receiver>
        <slot>slotCalcular()</slot>
    </connection>
    <connection>
        <sender>hacia</sender>
        <signal>activated(int)</signal>
        <receiver>Conversion</receiver>
        <slot>slotCalcular()</slot>
    </connection>
</connections>
<tabstops>
    <tabstop>distancia</tabstop>
    <tabstop>desde</tabstop>
    <tabstop>hacia</tabstop>
    <tabstop>resultado</tabstop>
    <tabstop>decimales</tabstop>
    <tabstop>limpiar</tabstop>
    <tabstop>calcular</tabstop>
    <tabstop>cerrar</tabstop>
</tabstops>
<slots>
    <slot>slotCalcular()</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>
Boy! I didn't expect it to be so long.

Also, when I run it, the buttons at the bottom don't have the right size. They are too short.

and finally: should I go to a kdevelop forum for the cascade of questions I'll be making or should I stay here? Is there a kdevelop forum around there? maybe at www.kdevelop.org?

Last edited by eantoranz; 12-16-2005 at 12:04 PM.
 
Old 12-18-2005, 02:35 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
The layout is OK, but you need to do one small thing. Open it in Designer (the program you have used to draw it), click somewhere in the empty space of the window and then 'Lay Out in Grid' (Ctrl+G). It should resize as yu expect then.

Button sizes: if you think they're too small, use the 'Minimum Size' option. For me they look good.

And finally, LQ is a good place for qt/kdevelop/programming questions
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using KDevelop for C++ d00bid00b Programming 4 09-20-2005 03:22 PM
Where is kdevelop??? baraujo SUSE / openSUSE 2 03-25-2005 10:20 AM
KDevelop questions... ssobeht Programming 3 03-07-2005 03:18 PM
kdevelop and mozilla questions elvee Linux - Software 4 08-26-2004 08:37 PM
Kdevelop PowerFromPoland Programming 0 11-07-2003 03:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration