forked from qt-creator/qt-creator
Set size of widgets for devices to match default resolution
* When creating a new project for some device: Set UI element size to the device resolution.
This commit is contained in:
@@ -5,6 +5,10 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
%CLASS% w;
|
||||
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
|
||||
w.showMaximized();
|
||||
#else
|
||||
w.show();
|
||||
#endif
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
<width>%WIDGET_WIDTH%</width>
|
||||
<height>%WIDGET_HEIGHT%</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
|
||||
@@ -208,6 +208,8 @@ bool GuiAppWizard::parametrizeTemplate(const QString &templatePath, const QStrin
|
||||
contents.replace(QLatin1String("%INCLUDE%"), params.headerFileName);
|
||||
contents.replace(QLatin1String("%CLASS%"), params.className);
|
||||
contents.replace(QLatin1String("%BASECLASS%"), params.baseClassName);
|
||||
contents.replace(QLatin1String("%WIDGET_HEIGHT%"), QString::number(params.widgetHeight));
|
||||
contents.replace(QLatin1String("%WIDGET_WIDTH%"), QString::number(params.widgetWidth));
|
||||
|
||||
const QChar dot = QLatin1Char('.');
|
||||
|
||||
|
||||
@@ -30,8 +30,11 @@
|
||||
#include "guiappwizarddialog.h"
|
||||
|
||||
#include "filespage.h"
|
||||
#include "qt4target.h"
|
||||
#include "qtprojectparameters.h"
|
||||
|
||||
#include <QtCore/QSet>
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
@@ -104,6 +107,19 @@ GuiAppParameters GuiAppWizardDialog::parameters() const
|
||||
rc.headerFileName = m_filesPage->headerFileName();
|
||||
rc.formFileName = m_filesPage->formFileName();
|
||||
rc.designerForm = m_filesPage->formInputChecked();
|
||||
QSet<QString> targets = selectedTargets();
|
||||
if (targets.contains(QLatin1String(MAEMO_DEVICE_TARGET_ID)) ||
|
||||
targets.contains(QLatin1String(MAEMO_EMULATOR_TARGET_ID))) {
|
||||
rc.widgetWidth = 800;
|
||||
rc.widgetHeight = 480;
|
||||
} else if (targets.contains(QLatin1String(S60_DEVICE_TARGET_ID)) ||
|
||||
targets.contains(QLatin1String(S60_EMULATOR_TARGET_ID))) {
|
||||
rc.widgetWidth = 360;
|
||||
rc.widgetHeight = 640;
|
||||
} else {
|
||||
rc.widgetWidth = 400;
|
||||
rc.widgetHeight = 300;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ struct GuiAppParameters
|
||||
QString sourceFileName;
|
||||
QString headerFileName;
|
||||
QString formFileName;
|
||||
int widgetWidth;
|
||||
int widgetHeight;
|
||||
bool designerForm;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user