[Qt-interest] QPushButton width problems / layout issues

Kustaa Nyholm Kustaa.Nyholm at planmeca.com
Thu Jun 24 15:59:35 CEST 2010


> Hey can you post the entire code generated by your UI designer header
> file.i.e UI_....h file
>

Here you go:



/***************************************************************************
*****

** Form generated from reading UI file 'menubarx13810.ui'

**

** Created: Thu Jun 24 16:58:44 2010

**      by: Qt User Interface Compiler version 4.6.2

**

** WARNING! All changes made in this file will be lost when recompiling UI
file!

****************************************************************************
****/

#ifndef MENUBARX13810_H

#define MENUBARX13810_H

#include <QtCore/QVariant>

#include <QtGui/QAction>

#include <QtGui/QApplication>

#include <QtGui/QButtonGroup>

#include <QtGui/QHBoxLayout>

#include <QtGui/QHeaderView>

#include <QtGui/QPushButton>

#include <QtGui/QSpacerItem>

#include <QtGui/QWidget>

QT_BEGIN_NAMESPACE

class Ui_Form

{

public:

    QHBoxLayout *horizontalLayout;

    QPushButton *pushButton;

    QSpacerItem *horizontalSpacer;

    QPushButton *pushButton_2;

    void setupUi(QWidget *Form)

    {

        if (Form->objectName().isEmpty())

            Form->setObjectName(QString::fromUtf8("Form"));

        Form->resize(408, 85);

        horizontalLayout = new QHBoxLayout(Form);

        
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));

        pushButton = new QPushButton(Form);

        pushButton->setObjectName(QString::fromUtf8("pushButton"));

        horizontalLayout->addWidget(pushButton);

        horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding,
QSizePolicy::Minimum);

        horizontalLayout->addItem(horizontalSpacer);

        pushButton_2 = new QPushButton(Form);

        pushButton_2->setObjectName(QString::fromUtf8("pushButton_2"));

        horizontalLayout->addWidget(pushButton_2);

        retranslateUi(Form);

        QMetaObject::connectSlotsByName(Form);

    } // setupUi

    void retranslateUi(QWidget *Form)

    {

        Form->setWindowTitle(QApplication::translate("Form", "Form", 0,
QApplication::UnicodeUTF8));

        pushButton->setText(QApplication::translate("Form", "A", 0,
QApplication::UnicodeUTF8));

        pushButton_2->setText(QApplication::translate("Form", "Long", 0,
QApplication::UnicodeUTF8));

    } // retranslateUi

};

namespace Ui {

    class Form: public Ui_Form {};

} // namespace Ui

QT_END_NAMESPACE

#endif // MENUBARX13810_H



<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Form</class>
 <widget class="QWidget" name="Form">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>408</width>
    <height>85</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Form</string>
  </property>
  <layout class="QHBoxLayout" name="horizontalLayout">
   <item>
    <widget class="QPushButton" name="pushButton">
     <property name="text">
      <string>A</string>
     </property>
    </widget>
   </item>
   <item>
    <spacer name="horizontalSpacer">
     <property name="orientation">
      <enum>Qt::Horizontal</enum>
     </property>
     <property name="sizeHint" stdset="0">
      <size>
       <width>40</width>
       <height>20</height>
      </size>
     </property>
    </spacer>
   </item>
   <item>
    <widget class="QPushButton" name="pushButton_2">
     <property name="text">
      <string>Long</string>
     </property>
    </widget>
   </item>
  </layout>
 </widget>
 <resources/>
 <connections/>
</ui>





More information about the Qt-interest-old mailing list