Results 1 to 7 of 7

Thread: ShowMaximized dosen't run in my application. I don't know why.

  1. #1
    Join Date
    Sep 2010
    Posts
    7
    Qt products
    Qt/Embedded
    Platforms
    Symbian S60

    Unhappy 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.

    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication a(argc, argv);
    4. MainWindow w;
    5. #if defined(Q_WS_S60)
    6. w.showMaximized();
    7. #else
    8. w.show();
    9. #endif
    10.  
    11. return a.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 

    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.

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default 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.

  3. #3
    Join Date
    Sep 2010
    Posts
    7
    Qt products
    Qt/Embedded
    Platforms
    Symbian S60

    Default 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
    Qt Code:
    1. #ifndef MAINWINDOW_H
    2. #define MAINWINDOW_H
    3.  
    4. #include <QMainWindow>
    5.  
    6. namespace Ui {
    7. class MainWindow;
    8. }
    9.  
    10. class MainWindow : public QMainWindow
    11. {
    12. Q_OBJECT
    13.  
    14. public:
    15. explicit MainWindow(QWidget *parent = 0);
    16. ~MainWindow();
    17.  
    18. private:
    19. Ui::MainWindow *ui;
    20.  
    21. private slots:
    22. void on_pushButton_clicked();
    23. };
    24.  
    25. #endif // MAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 

    main.cpp
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "mainwindow.h"
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. MainWindow2 w;
    8.  
    9. #if defined(Q_WS_S60)
    10. w.showMaximized();
    11. #else
    12. w.show();
    13. #endif
    14.  
    15. return a.exec();
    16. }
    To copy to clipboard, switch view to plain text mode 

    mainwindow.cpp
    Qt Code:
    1. #include "mainwindow.h"
    2. #include "ui_mainwindow.h"
    3.  
    4. #include <QtGui>
    5. #include "ListviewDelegate.h"
    6.  
    7.  
    8. ListviewDelegate *listdelegate;
    9.  
    10.  
    11. MainWindow::MainWindow(QWidget *parent) :
    12. QMainWindow(parent),
    13. ui(new Ui::MainWindow)
    14. {
    15. ui->setupUi(this);
    16.  
    17.  
    18.  
    19. model = new QStandardItemModel();
    20. listdelegate = new ListviewDelegate();
    21.  
    22.  
    23. }
    24.  
    25. MainWindow::~MainWindow()
    26. {
    27. delete ui;
    28.  
    29.  
    30.  
    31. }
    32.  
    33. void MainWindow::on_pushButton_clicked()
    34. {
    35. ui->listView->setItemDelegate(listdelegate);
    36. ui->listView->setModel(model);
    37.  
    38. item->setData("InBox",ListviewDelegate::headerTextRole);
    39. item->setData("10 messages",ListviewDelegate::subHeaderTextrole);
    40. item->setData("Hola que tal aixo es una prova jfhjklsd jfdlañj fklañjf lakñfj aklj fadklñfj aklfj aklj falñ",ListviewDelegate::rightTextRole);
    41. model->appendRow(item);
    42. }
    To copy to clipboard, switch view to plain text mode 

    Thank youuu!!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: ShowMaximized dosen't run in my application. I don't know why.

    You probably forgot to apply a layout to your main window.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default 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.

  6. #6
    Join Date
    Sep 2010
    Posts
    7
    Qt products
    Qt/Embedded
    Platforms
    Symbian S60

    Default 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:

    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication app(argc, argv);
    4. QWidget* window = new QWidget;
    5. QVBoxLayout* layout = new QVBoxLayout(window);
    6. QPushButton* optsButton = new QPushButton("Options");
    7. QPushButton* exitButton = new QPushButton("Exit");
    8. QCheckBox* chkBox = new QCheckBox("Checkbox");
    9. QListView* listview = new QListView(window);
    10. layout->addWidget(listview);
    11. layout->addWidget(chkBox);
    12. layout->addWidget(optsButton);
    13. layout->addWidget(exitButton);
    14.  
    15. QObject::connect(exitButton, SIGNAL(clicked()), &app, SLOT(quit()));
    16.  
    17. wnd.setCentralWidget(window);
    18.  
    19. #if defined(Q_WS_S60)
    20. wnd.showMaximized();
    21. #else
    22. wnd.show();
    23. #endif
    24. return app.exec();
    25. }
    To copy to clipboard, switch view to plain text mode 

  7. #7
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default 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.

Similar Threads

  1. ShowMaximized() by a hot-key
    By araglin in forum Newbie
    Replies: 3
    Last Post: 29th January 2009, 14:31
  2. showMaximized in MDI
    By walito in forum Newbie
    Replies: 3
    Last Post: 14th September 2007, 00:48
  3. Problem with showMaximized()
    By Lykurg in forum Newbie
    Replies: 6
    Last Post: 11th July 2007, 09:06
  4. Why QCursor setPos() dosen't work here?
    By kar98k in forum Qt Programming
    Replies: 8
    Last Post: 1st June 2007, 12:52
  5. Why QStyle dosen't changes the standard font?
    By Dark_Tower in forum Newbie
    Replies: 8
    Last Post: 31st March 2006, 02:49

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.