ShowMaximized dosen't run in my application. I don't know why.
Hello,
If I create a simple application with qt creator for a mobile with symbian s60. It dosen't maximize the widgets with showMaximized.
Code:
int main(int argc, char *argv[])
{
MainWindow w;
#if defined(Q_WS_S60)
w.showMaximized();
#else
w.show();
#endif
return a.exec();
}
I don't understand why. Is there a bug?
Or maybe I have to run the function in another widget like the layout grid?
I'm a bit desperated.
Thank you.
Re: ShowMaximized dosen't run in my application. I don't know why.
just to make the test... use QMainWindow instead of your Mainwindow and see if the problem persists.
Re: ShowMaximized dosen't run in my application. I don't know why.
Well, the project use QMainWindow. I show you the code:
mainwindow.h
Code:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
{
Q_OBJECT
public:
explicit MainWindow
(QWidget *parent
= 0);
~MainWindow();
private:
Ui::MainWindow *ui;
private slots:
void on_pushButton_clicked();
};
#endif // MAINWINDOW_H
main.cpp
Code:
#include <QtGui/QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
MainWindow2 w;
#if defined(Q_WS_S60)
w.showMaximized();
#else
w.show();
#endif
return a.exec();
}
mainwindow.cpp
Code:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QtGui>
#include "ListviewDelegate.h"
ListviewDelegate *listdelegate;
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
listdelegate = new ListviewDelegate();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
ui->listView->setItemDelegate(listdelegate);
ui->listView->setModel(model);
item->setData("InBox",ListviewDelegate::headerTextRole);
item->setData("10 messages",ListviewDelegate::subHeaderTextrole);
item->setData("Hola que tal aixo es una prova jfhjklsd jfdlañj fklañjf lakñfj aklj fadklñfj aklfj aklj falñ",ListviewDelegate::rightTextRole);
model->appendRow(item);
}
Thank youuu!!
Re: ShowMaximized dosen't run in my application. I don't know why.
You probably forgot to apply a layout to your main window.
Re: ShowMaximized dosen't run in my application. I don't know why.
I meant that dont use your derived class. Use directly a QMainWindow, just to check wether its a problem in your code.
Re: ShowMaximized dosen't run in my application. I don't know why.
Thank you!!!!!!!
Using that code works perfectly!!
I'll pay you a coffe. lol
This is the code:
Code:
int main(int argc, char *argv[])
{
layout->addWidget(listview);
layout->addWidget(chkBox);
layout->addWidget(optsButton);
layout->addWidget(exitButton);
QObject::connect(exitButton,
SIGNAL(clicked
()),
&app,
SLOT(quit
()));
wnd.setCentralWidget(window);
#if defined(Q_WS_S60)
wnd.showMaximized();
#else
wnd.show();
#endif
return app.exec();
}
Re: ShowMaximized dosen't run in my application. I don't know why.
now check your MainWindow class to see if you have used any of the size/hide/geometry functions that will cause the prob.